Skip to content

Commit 258ff82

Browse files
authored
Merge pull request #25 from alexandrunastase/master
Add .idea to .gitignore. Add *.sln files to project. Add other minor fixes
2 parents 7547738 + 3becebd commit 258ff82

File tree

6 files changed

+30
-7
lines changed

6 files changed

+30
-7
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@ ops/*.retry
2828
# other
2929
*.js.map
3030

31+
# IDE
32+
.idea/

api.sln

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "api", "api\api.csproj", "{62842846-868D-4B6E-A191-C37121587533}"
4+
EndProject
5+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "api.test", "api.test\api.test.csproj", "{002B4B4F-3A5D-4342-98AB-C50F7147F863}"
6+
EndProject
7+
Global
8+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
9+
Debug|Any CPU = Debug|Any CPU
10+
Release|Any CPU = Release|Any CPU
11+
EndGlobalSection
12+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
13+
{62842846-868D-4B6E-A191-C37121587533}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
14+
{62842846-868D-4B6E-A191-C37121587533}.Debug|Any CPU.Build.0 = Debug|Any CPU
15+
{62842846-868D-4B6E-A191-C37121587533}.Release|Any CPU.ActiveCfg = Release|Any CPU
16+
{62842846-868D-4B6E-A191-C37121587533}.Release|Any CPU.Build.0 = Release|Any CPU
17+
{002B4B4F-3A5D-4342-98AB-C50F7147F863}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
18+
{002B4B4F-3A5D-4342-98AB-C50F7147F863}.Debug|Any CPU.Build.0 = Debug|Any CPU
19+
{002B4B4F-3A5D-4342-98AB-C50F7147F863}.Release|Any CPU.ActiveCfg = Release|Any CPU
20+
{002B4B4F-3A5D-4342-98AB-C50F7147F863}.Release|Any CPU.Build.0 = Release|Any CPU
21+
EndGlobalSection
22+
EndGlobal

api/Controllers/AuthController.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,13 @@ public async Task<IActionResult> Login(string username, string password)
7474

7575
_logger.LogInformation($"User logged in (id: {user.Id})");
7676

77-
// Generate and issue a JWT tokek
78-
var claims = new Claim[] {
77+
// Generate and issue a JWT token
78+
var claims = new [] {
7979
new Claim(ClaimTypes.Name, user.Email),
8080
new Claim(JwtRegisteredClaimNames.Sub, user.Email),
8181
new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString())
8282
};
83+
8384
var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_jwtOptions.key));
8485
var creds = new SigningCredentials(key, SecurityAlgorithms.HmacSha256);
8586

api/Controllers/ContactController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace aspnetCoreReactTemplate.Controllers
1212
[Route("api/[controller]")]
1313
public class ContactsController : Controller
1414
{
15-
DefaultDbContext _context;
15+
private readonly DefaultDbContext _context;
1616

1717
public ContactsController(DefaultDbContext context)
1818
{
@@ -75,7 +75,7 @@ public async Task<IActionResult> Put(int id, [FromBody]Contact model)
7575
[HttpDelete("{id}")]
7676
public async Task<IActionResult> Delete(int id)
7777
{
78-
Contact contact = new Contact() { contactId = id };
78+
var contact = new Contact() { contactId = id };
7979
_context.Entry(contact).State = EntityState.Deleted;
8080

8181
await _context.SaveChangesAsync();

api/Models/Contact.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ public class Contact
88

99
[Required]
1010
[MinLength(3)]
11-
1211
public string lastName { get; set; }
1312

1413
[Required]

api/Models/DefaultDbContextInitializer.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public async Task Seed()
3434
var email = "[email protected]";
3535
if (await _userManager.FindByEmailAsync(email) == null)
3636
{
37-
ApplicationUser user = new ApplicationUser
37+
var user = new ApplicationUser
3838
{
3939
UserName = email,
4040
Email = email,
@@ -64,6 +64,5 @@ public interface IDefaultDbContextInitializer
6464
bool EnsureCreated();
6565
void Migrate();
6666
Task Seed();
67-
6867
}
6968
}

0 commit comments

Comments
 (0)