diff --git a/.gitignore b/.gitignore
index e25349f..3ecf4df 100644
--- a/.gitignore
+++ b/.gitignore
@@ -264,3 +264,4 @@ logs
.env
.swp
server/Migrations/
+server/Data/
diff --git a/server/DTOs/AuthRequest.cs b/server/DTOs/Auth/AuthRequest.cs
similarity index 100%
rename from server/DTOs/AuthRequest.cs
rename to server/DTOs/Auth/AuthRequest.cs
diff --git a/server/DTOs/AuthResponse.cs b/server/DTOs/Auth/AuthResponse.cs
similarity index 100%
rename from server/DTOs/AuthResponse.cs
rename to server/DTOs/Auth/AuthResponse.cs
diff --git a/server/DTOs/GetUserResponse.cs b/server/DTOs/Auth/GetUserResponse.cs
similarity index 100%
rename from server/DTOs/GetUserResponse.cs
rename to server/DTOs/Auth/GetUserResponse.cs
diff --git a/server/DTOs/KeyValueErrorResponse.cs b/server/DTOs/Auth/KeyValueErrorResponse.cs
similarity index 100%
rename from server/DTOs/KeyValueErrorResponse.cs
rename to server/DTOs/Auth/KeyValueErrorResponse.cs
diff --git a/server/DTOs/PutUserRequest.cs b/server/DTOs/Auth/PutUserRequest.cs
similarity index 100%
rename from server/DTOs/PutUserRequest.cs
rename to server/DTOs/Auth/PutUserRequest.cs
diff --git a/server/Data/Migrations/20230601190207_ (31ec2fe).Designer.cs b/server/Data/Migrations/20230601190207_ (31ec2fe).Designer.cs
deleted file mode 100644
index 8ca58a9..0000000
--- a/server/Data/Migrations/20230601190207_ (31ec2fe).Designer.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-//
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using server;
-
-#nullable disable
-
-namespace server.Data.Migrations
-{
- [DbContext(typeof(ApplicationDbContext))]
- [Migration("20230601190207_ (31ec2fe)")]
- partial class _31ec2fe
- {
- ///
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder.HasAnnotation("ProductVersion", "7.0.5");
-
- modelBuilder.Entity("server.Entities.UserEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("INTEGER");
-
- b.Property("Birth")
- .IsRequired()
- .HasColumnType("TEXT");
-
- b.Property("Email")
- .IsRequired()
- .HasColumnType("TEXT");
-
- b.Property("Level")
- .HasColumnType("INTEGER");
-
- b.Property("Password")
- .IsRequired()
- .HasColumnType("TEXT");
-
- b.Property("Phone")
- .IsRequired()
- .HasColumnType("TEXT");
-
- b.Property("ProfileURL")
- .HasColumnType("TEXT");
-
- b.Property("Sns")
- .IsRequired()
- .HasColumnType("TEXT");
-
- b.Property("Username")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("TEXT");
-
- b.HasKey("Id");
-
- b.ToTable("Users");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/server/Data/Migrations/20230601190207_ (31ec2fe).cs b/server/Data/Migrations/20230601190207_ (31ec2fe).cs
deleted file mode 100644
index 52b1a64..0000000
--- a/server/Data/Migrations/20230601190207_ (31ec2fe).cs
+++ /dev/null
@@ -1,41 +0,0 @@
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace server.Data.Migrations
-{
- ///
- public partial class _31ec2fe : Migration
- {
- ///
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "Users",
- columns: table => new
- {
- Id = table.Column(type: "INTEGER", nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
- Email = table.Column(type: "TEXT", nullable: false),
- Password = table.Column(type: "TEXT", nullable: false),
- Username = table.Column(type: "TEXT", maxLength: 20, nullable: false),
- Phone = table.Column(type: "TEXT", nullable: false),
- Birth = table.Column(type: "TEXT", nullable: false),
- ProfileURL = table.Column(type: "TEXT", nullable: true),
- Level = table.Column(type: "INTEGER", nullable: false),
- Sns = table.Column(type: "TEXT", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Users", x => x.Id);
- });
- }
-
- ///
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "Users");
- }
- }
-}
diff --git a/server/Data/Migrations/ApplicationDbContextModelSnapshot.cs b/server/Data/Migrations/ApplicationDbContextModelSnapshot.cs
deleted file mode 100644
index cd2dd1e..0000000
--- a/server/Data/Migrations/ApplicationDbContextModelSnapshot.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-//
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using server;
-
-#nullable disable
-
-namespace server.Data.Migrations
-{
- [DbContext(typeof(ApplicationDbContext))]
- partial class ApplicationDbContextModelSnapshot : ModelSnapshot
- {
- protected override void BuildModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder.HasAnnotation("ProductVersion", "7.0.5");
-
- modelBuilder.Entity("server.Entities.UserEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("INTEGER");
-
- b.Property("Birth")
- .IsRequired()
- .HasColumnType("TEXT");
-
- b.Property("Email")
- .IsRequired()
- .HasColumnType("TEXT");
-
- b.Property("Level")
- .HasColumnType("INTEGER");
-
- b.Property("Password")
- .IsRequired()
- .HasColumnType("TEXT");
-
- b.Property("Phone")
- .IsRequired()
- .HasColumnType("TEXT");
-
- b.Property("ProfileURL")
- .HasColumnType("TEXT");
-
- b.Property("Sns")
- .IsRequired()
- .HasColumnType("TEXT");
-
- b.Property("Username")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("TEXT");
-
- b.HasKey("Id");
-
- b.ToTable("Users");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/server/Services/AuthService.cs b/server/Services/AuthService.cs
index 9991db3..2692eeb 100644
--- a/server/Services/AuthService.cs
+++ b/server/Services/AuthService.cs
@@ -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;
@@ -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()
@@ -18,7 +18,7 @@ static AuthService()
public AuthService(ApplicationDbContext context)
{
- mContext = context;
+ _context = context;
}
public UserEntity? UserAuthorize(string email, string password)
@@ -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();
diff --git a/server/Services/ChatHttpService.cs b/server/Services/ChatHttpService.cs
index 28f1d73..f32ce6a 100644
--- a/server/Services/ChatHttpService.cs
+++ b/server/Services/ChatHttpService.cs
@@ -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;
}
}
diff --git a/server/Services/UserService.cs b/server/Services/UserService.cs
index ae68978..f60e9a1 100644
--- a/server/Services/UserService.cs
+++ b/server/Services/UserService.cs
@@ -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()
@@ -24,7 +24,7 @@ public GetUserResponse Create()
public async Task Read(long id)
{
- UserEntity? user = await this.mContext.Users.FindAsync(id);
+ UserEntity? user = await this._context.Users.FindAsync(id);
if (user == null)
{
@@ -46,7 +46,7 @@ public GetUserResponse Create()
public async Task Update(long id, PutUserRequest model)
{
- UserEntity? user = await this.mContext.Users.FindAsync(id);
+ UserEntity? user = await this._context.Users.FindAsync(id);
if (user == null)
{
@@ -58,21 +58,21 @@ public async Task 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();
}
}
diff --git a/server/server.csproj b/server/server.csproj
index 2612b7c..a74870f 100644
--- a/server/server.csproj
+++ b/server/server.csproj
@@ -35,6 +35,7 @@
+