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

Commit

Permalink
내부 변수 표기 방법, 디렉토리 구조 고도화, gitIgnore 변경 등 프로젝트 Style 수정 (#53)
Browse files Browse the repository at this point in the history
* [style] 내부 변수에 대한 표기법 변경

기존 : m
변경 : _

* [Style] DTO 내 디렉토리 구분

Chat 관련 DTO는 DTOs/Chat에 생성해주세요.

* [Style] Auto dotnet format

* [Docs] gitIgnore 수정

Database 마이그레이션에 이용되는 /Data/ 디렉토리를 제외 시켰습니다.

---------

Co-authored-by: Dotnet Format Bot (by YeJun, Jung) <[email protected]>
  • Loading branch information
98StarJune and yejun614 authored Aug 22, 2023
1 parent 459b28d commit f74807e
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 185 deletions.
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/
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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

0 comments on commit f74807e

Please sign in to comment.