Skip to content
This repository was archived by the owner on Jul 21, 2024. It is now read-only.

내부 변수 표기 방법, 디렉토리 구조 고도화, gitIgnore 변경 등 프로젝트 Style 수정 #53

Merged
merged 4 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -264,3 +264,4 @@ logs
.env
.swp
server/Migrations/
server/Data/
66 changes: 0 additions & 66 deletions server/Data/Migrations/20230601190207_ (31ec2fe).Designer.cs

This file was deleted.

41 changes: 0 additions & 41 deletions server/Data/Migrations/20230601190207_ (31ec2fe).cs

This file was deleted.

63 changes: 0 additions & 63 deletions server/Data/Migrations/ApplicationDbContextModelSnapshot.cs

This file was deleted.

8 changes: 4 additions & 4 deletions server/Services/AuthService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.IdentityModel.Tokens.Jwt;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using System.Text;
using Microsoft.IdentityModel.Tokens;
Expand All @@ -8,7 +8,7 @@ namespace server.Services;

public class AuthService
{
private readonly ApplicationDbContext mContext;
private readonly ApplicationDbContext _context;
private static readonly string SECRET;

static AuthService()
Expand All @@ -18,7 +18,7 @@ static AuthService()

public AuthService(ApplicationDbContext context)
{
mContext = context;
_context = context;
}

public UserEntity? UserAuthorize(string email, string password)
Expand All @@ -27,7 +27,7 @@ public AuthService(ApplicationDbContext context)
userEntity.Email = email;
userEntity.Password = password;

UserEntity[] results = mContext.Users.Where(
UserEntity[] results = _context.Users.Where(
userEntity => (userEntity.Email == email) && (userEntity.Password == password)
).ToArray();

Expand Down
4 changes: 2 additions & 2 deletions server/Services/ChatHttpService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ namespace server.Services;

public class ChatHttpService : IChatHttpService
{
private readonly ApplicationDbContext mContext;
private readonly ApplicationDbContext _context;

public ChatHttpService(ApplicationDbContext context)
{
mContext = context;
_context = context;
}
}
18 changes: 9 additions & 9 deletions server/Services/UserService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ namespace server.Services;

public class UserService : IUserService
{
private readonly ApplicationDbContext mContext;
private readonly ApplicationDbContext _context;

public UserService(ApplicationDbContext context)
{
mContext = context;
_context = context;
}
private bool UserEntityExists(long id)
{
return (mContext.Users?.Any(e => e.Id == id)).GetValueOrDefault();
return (_context.Users?.Any(e => e.Id == id)).GetValueOrDefault();
}

public GetUserResponse Create()
Expand All @@ -24,7 +24,7 @@ public GetUserResponse Create()

public async Task<GetUserResponse?> Read(long id)
{
UserEntity? user = await this.mContext.Users.FindAsync(id);
UserEntity? user = await this._context.Users.FindAsync(id);

if (user == null)
{
Expand All @@ -46,7 +46,7 @@ public GetUserResponse Create()

public async Task<bool> Update(long id, PutUserRequest model)
{
UserEntity? user = await this.mContext.Users.FindAsync(id);
UserEntity? user = await this._context.Users.FindAsync(id);

if (user == null)
{
Expand All @@ -58,21 +58,21 @@ public async Task<bool> Update(long id, PutUserRequest model)
user.Phone = model.phone ?? user.Phone;
user.Birth = model.birth ?? user.Birth;

await mContext.SaveChangesAsync();
await _context.SaveChangesAsync();

return true;
}

public async Task Delete(long id)
{
UserEntity? user = await mContext.Users.FindAsync(id);
UserEntity? user = await _context.Users.FindAsync(id);

if (user == null)
{
throw new Exception("The user with that ID does not exist.");
}

mContext.Users.Remove(user);
await mContext.SaveChangesAsync();
_context.Users.Remove(user);
await _context.SaveChangesAsync();
}
}
1 change: 1 addition & 0 deletions server/server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<None Remove="Middlewares\" />
</ItemGroup>
<ItemGroup>
<Folder Include="DTOs\Chat\" />
<Folder Include="Utilities\" />
<Folder Include="Attributes\" />
<Folder Include="Middlewares\" />
Expand Down