diff --git a/NOTE.MD b/NOTE.MD new file mode 100644 index 00000000..5fcc655c --- /dev/null +++ b/NOTE.MD @@ -0,0 +1,6 @@ +⚠️ Còn Thiếu (Tùy chọn mở rộng) +- Authorization Code Flow - Cho OAuth2 web apps +- Role/Permission Management APIs - CRUD roles +- Email Verification - Confirm email +- 2FA/MFA - Two-factor authentication +- Social Login - Google, Facebook, etc. \ No newline at end of file diff --git a/services/iam-service-net/README.md b/services/iam-service-net/README.md index 884b0960..8c94812b 100644 --- a/services/iam-service-net/README.md +++ b/services/iam-service-net/README.md @@ -53,6 +53,45 @@ dotnet build dotnet run --project src/IamService.API ``` +## Database Migrations + +### Prerequisites + +```bash +# Install EF Core tools (one-time) +dotnet tool install --global dotnet-ef +``` + +### Create Migration + +```bash +dotnet ef migrations add \ + --project src/IamService.Infrastructure \ + --startup-project src/IamService.API +``` + +### Apply Migration + +```bash +dotnet ef database update \ + --project src/IamService.Infrastructure \ + --startup-project src/IamService.API +``` + +### Neon Database Setup + +1. Create database on [Neon Console](https://console.neon.tech) +2. Copy connection string +3. Update `appsettings.Development.json`: +```json +{ + "ConnectionStrings": { + "DefaultConnection": "Host=;Port=5432;Database=;Username=;Password=;SSL Mode=Require" + } +} +``` +4. Run migrations: `dotnet ef database update ...` + ## API Endpoints ### Authentication (`/api/v1/auth`) diff --git a/services/iam-service-net/docs/en/README.md b/services/iam-service-net/docs/en/README.md index 56e055ab..5a516b05 100644 --- a/services/iam-service-net/docs/en/README.md +++ b/services/iam-service-net/docs/en/README.md @@ -55,6 +55,37 @@ dotnet build dotnet run --project src/IamService.API ``` +## Database Migrations + +### Prerequisites + +```bash +# Install EF Core tools (one-time) +dotnet tool install --global dotnet-ef +``` + +### Create Migration + +```bash +dotnet ef migrations add \ + --project src/IamService.Infrastructure \ + --startup-project src/IamService.API +``` + +### Apply Migration + +```bash +dotnet ef database update \ + --project src/IamService.Infrastructure \ + --startup-project src/IamService.API +``` + +### Neon Database Setup + +1. Create database on [Neon Console](https://console.neon.tech) +2. Update `appsettings.Development.json` with connection string +3. Run: `dotnet ef database update ...` + ## API Endpoints ### Authentication (`/api/v1/auth`) diff --git a/services/iam-service-net/docs/vi/README.md b/services/iam-service-net/docs/vi/README.md index 80134af3..43deacb4 100644 --- a/services/iam-service-net/docs/vi/README.md +++ b/services/iam-service-net/docs/vi/README.md @@ -39,6 +39,67 @@ dotnet build dotnet run --project src/IamService.API ``` +## Database Migrations + +### Yêu Cầu + +```bash +# Cài đặt EF Core tools (một lần) +dotnet tool install --global dotnet-ef +``` + +### Tạo Migration + +```bash +# Tạo migration mới +dotnet ef migrations add \ + --project src/IamService.Infrastructure \ + --startup-project src/IamService.API +``` + +### Áp Dụng Migration + +```bash +# Áp dụng migrations vào database +dotnet ef database update \ + --project src/IamService.Infrastructure \ + --startup-project src/IamService.API +``` + +### Các Lệnh Khác + +```bash +# Xóa migration cuối (nếu chưa áp dụng) +dotnet ef migrations remove \ + --project src/IamService.Infrastructure \ + --startup-project src/IamService.API + +# Tạo SQL script +dotnet ef migrations script \ + --project src/IamService.Infrastructure \ + --startup-project src/IamService.API \ + --output migrations.sql + +# Liệt kê migrations +dotnet ef migrations list \ + --project src/IamService.Infrastructure \ + --startup-project src/IamService.API +``` + +### Thiết Lập Neon Database + +1. Tạo database trên [Neon Console](https://console.neon.tech) +2. Sao chép connection string +3. Cập nhật `appsettings.Development.json`: +```json +{ + "ConnectionStrings": { + "DefaultConnection": "Host=;Port=5432;Database=;Username=;Password=;SSL Mode=Require" + } +} +``` +4. Chạy migrations: `dotnet ef database update ...` + ## API Endpoints ### Authentication (`/api/v1/auth`) diff --git a/services/iam-service-net/src/IamService.API/IamService.API.csproj b/services/iam-service-net/src/IamService.API/IamService.API.csproj index e49de080..82bb9de9 100644 --- a/services/iam-service-net/src/IamService.API/IamService.API.csproj +++ b/services/iam-service-net/src/IamService.API/IamService.API.csproj @@ -17,6 +17,10 @@ + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + diff --git a/services/iam-service-net/src/IamService.API/appsettings.Development.json b/services/iam-service-net/src/IamService.API/appsettings.Development.json index e407ac85..a4e31b60 100644 --- a/services/iam-service-net/src/IamService.API/appsettings.Development.json +++ b/services/iam-service-net/src/IamService.API/appsettings.Development.json @@ -3,17 +3,20 @@ "LogLevel": { "Default": "Debug", "Microsoft.AspNetCore": "Information", - "Microsoft.EntityFrameworkCore.Database.Command": "Information" + "Microsoft.EntityFrameworkCore": "Information" } }, - "Serilog": { - "MinimumLevel": { - "Default": "Debug", - "Override": { - "Microsoft": "Information", - "Microsoft.EntityFrameworkCore.Database.Command": "Information", - "System": "Information" - } - } + "ConnectionStrings": { + "DefaultConnection": "Host=ep-holy-glitter-a4hongg7-pooler.us-east-1.aws.neon.tech;Port=5432;Database=iam_service;Username=neondb_owner;Password=npg_Ssfy6HKO0cXI;SSL Mode=Require" + }, + "Redis": { + "ConnectionString": "localhost:6379" + }, + "Jwt": { + "Secret": "goodgo-iam-service-secret-key-32chars!", + "Issuer": "goodgo-platform", + "Audience": "goodgo-services", + "AccessTokenExpiryMinutes": 15, + "RefreshTokenExpiryDays": 7 } } \ No newline at end of file