Skip to content

Commit b732883

Browse files
committed
Revert "Remove EF Core migrations and identity setup"
This reverts commit 84a6630.
1 parent 2fc6386 commit b732883

20 files changed

+1171
-7
lines changed

Argon.Server.sln

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,18 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppHost", "src\AppHost\AppH
66
EndProject
77
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceDefaults", "src\ServiceDefaults\ServiceDefaults.csproj", "{3AEA5748-B88E-45FF-B3DC-319A7A8D13B4}"
88
EndProject
9+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Argon.Api", "src\Argon.Api\Argon.Api.csproj", "{D781D76E-6DD7-4C82-96D2-CA5D316BBF1E}"
10+
EndProject
11+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Argon.Api.Common", "src\Argon.Api.Common\Argon.Api.Common.csproj", "{2E23380A-5F69-4FA2-8E91-C98BBF755DB6}"
12+
EndProject
913
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Argon.Grains", "Contracts\Argon.Grains\Argon.Grains.csproj", "{9D8512AA-367B-427C-8387-AE03F2374EE0}"
1014
EndProject
1115
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Argon.Grains.Interfaces", "Contracts\Argon.Grains.Interfaces\Argon.Grains.Interfaces.csproj", "{5B50B6FF-C2ED-4DB9-B805-0CB1AA30E328}"
1216
EndProject
1317
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Argon.Orleans.Client", "Contracts\Argon.Orleans.Client\Argon.Orleans.Client.csproj", "{B53E94BD-BFB4-4BD1-BFFC-8CC0CB610100}"
1418
EndProject
19+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "src\ConsoleApp1\ConsoleApp1.csproj", "{EEC40E82-5DC5-463D-BA56-7680A0E41A4E}"
20+
EndProject
1521
Global
1622
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1723
Debug|Any CPU = Debug|Any CPU
@@ -20,9 +26,12 @@ Global
2026
GlobalSection(NestedProjects) = preSolution
2127
{872FE764-2544-4E27-9193-BA625245F8D5} = {43C63C3C-90EB-4AED-BB15-B30F76F93A9E}
2228
{3AEA5748-B88E-45FF-B3DC-319A7A8D13B4} = {43C63C3C-90EB-4AED-BB15-B30F76F93A9E}
29+
{D781D76E-6DD7-4C82-96D2-CA5D316BBF1E} = {43C63C3C-90EB-4AED-BB15-B30F76F93A9E}
30+
{2E23380A-5F69-4FA2-8E91-C98BBF755DB6} = {43C63C3C-90EB-4AED-BB15-B30F76F93A9E}
2331
{9D8512AA-367B-427C-8387-AE03F2374EE0} = {43C63C3C-90EB-4AED-BB15-B30F76F93A9E}
2432
{5B50B6FF-C2ED-4DB9-B805-0CB1AA30E328} = {43C63C3C-90EB-4AED-BB15-B30F76F93A9E}
2533
{B53E94BD-BFB4-4BD1-BFFC-8CC0CB610100} = {43C63C3C-90EB-4AED-BB15-B30F76F93A9E}
34+
{EEC40E82-5DC5-463D-BA56-7680A0E41A4E} = {43C63C3C-90EB-4AED-BB15-B30F76F93A9E}
2635
EndGlobalSection
2736
GlobalSection(ProjectConfigurationPlatforms) = postSolution
2837
{872FE764-2544-4E27-9193-BA625245F8D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -33,6 +42,14 @@ Global
3342
{3AEA5748-B88E-45FF-B3DC-319A7A8D13B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
3443
{3AEA5748-B88E-45FF-B3DC-319A7A8D13B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
3544
{3AEA5748-B88E-45FF-B3DC-319A7A8D13B4}.Release|Any CPU.Build.0 = Release|Any CPU
45+
{D781D76E-6DD7-4C82-96D2-CA5D316BBF1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
46+
{D781D76E-6DD7-4C82-96D2-CA5D316BBF1E}.Debug|Any CPU.Build.0 = Debug|Any CPU
47+
{D781D76E-6DD7-4C82-96D2-CA5D316BBF1E}.Release|Any CPU.ActiveCfg = Release|Any CPU
48+
{D781D76E-6DD7-4C82-96D2-CA5D316BBF1E}.Release|Any CPU.Build.0 = Release|Any CPU
49+
{2E23380A-5F69-4FA2-8E91-C98BBF755DB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
50+
{2E23380A-5F69-4FA2-8E91-C98BBF755DB6}.Debug|Any CPU.Build.0 = Debug|Any CPU
51+
{2E23380A-5F69-4FA2-8E91-C98BBF755DB6}.Release|Any CPU.ActiveCfg = Release|Any CPU
52+
{2E23380A-5F69-4FA2-8E91-C98BBF755DB6}.Release|Any CPU.Build.0 = Release|Any CPU
3653
{9D8512AA-367B-427C-8387-AE03F2374EE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
3754
{9D8512AA-367B-427C-8387-AE03F2374EE0}.Debug|Any CPU.Build.0 = Debug|Any CPU
3855
{9D8512AA-367B-427C-8387-AE03F2374EE0}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -45,5 +62,9 @@ Global
4562
{B53E94BD-BFB4-4BD1-BFFC-8CC0CB610100}.Debug|Any CPU.Build.0 = Debug|Any CPU
4663
{B53E94BD-BFB4-4BD1-BFFC-8CC0CB610100}.Release|Any CPU.ActiveCfg = Release|Any CPU
4764
{B53E94BD-BFB4-4BD1-BFFC-8CC0CB610100}.Release|Any CPU.Build.0 = Release|Any CPU
65+
{EEC40E82-5DC5-463D-BA56-7680A0E41A4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
66+
{EEC40E82-5DC5-463D-BA56-7680A0E41A4E}.Debug|Any CPU.Build.0 = Debug|Any CPU
67+
{EEC40E82-5DC5-463D-BA56-7680A0E41A4E}.Release|Any CPU.ActiveCfg = Release|Any CPU
68+
{EEC40E82-5DC5-463D-BA56-7680A0E41A4E}.Release|Any CPU.Build.0 = Release|Any CPU
4869
EndGlobalSection
4970
EndGlobal

src/AppHost/AppHost.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,8 @@
1616
<PackageReference Include="Aspire.Hosting.Redis" Version="8.2.1"/>
1717
</ItemGroup>
1818

19+
<ItemGroup>
20+
<ProjectReference Include="..\Argon.Api\Argon.Api.csproj"/>
21+
</ItemGroup>
22+
1923
</Project>

src/AppHost/Program.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414

1515
var apiDb = db.AddDatabase("apiDb");
1616

17-
// var api = builder.AddProject<Argon_Api>("argon-api")
18-
// .WithReference(apiDb, "DefaultConnection")
19-
// .WithReference(cache)
20-
// .WithReference(rmq)
21-
// .WithEndpoint(11111, 11111, "tcp", "siloPort", isProxied: false)
22-
// .WithEndpoint(30000, 30000, "tcp", "grainPort", isProxied: false)
23-
// .WithExternalHttpEndpoints();
17+
var api = builder.AddProject<Argon_Api>("argon-api")
18+
.WithReference(apiDb, "DefaultConnection")
19+
.WithReference(cache)
20+
.WithReference(rmq)
21+
.WithEndpoint(11111, 11111, "tcp", "siloPort", isProxied: false)
22+
.WithEndpoint(30000, 30000, "tcp", "grainPort", isProxied: false)
23+
.WithExternalHttpEndpoints();
2424

2525
builder.Build().Run();
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="8.0.10"/>
11+
</ItemGroup>
12+
13+
</Project>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
using Microsoft.AspNetCore.Identity;
2+
3+
namespace Argon.Api.Common.Models;
4+
5+
public class ApplicationUser : IdentityUser<Guid>
6+
{
7+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using Argon.Api.Common.Models;
2+
using Microsoft.AspNetCore.Identity;
3+
using Microsoft.Extensions.Logging;
4+
5+
namespace Argon.Api.Common.Services;
6+
7+
public class EmailSender(ILogger<EmailSender> logger) : IEmailSender<ApplicationUser>
8+
{
9+
public Task SendConfirmationLinkAsync(ApplicationUser user, string email, string confirmationLink)
10+
{
11+
logger.LogInformation(
12+
"Sending confirmation link to {email} for user {user} with confirmation link {confirmationLink}", email,
13+
user.UserName, confirmationLink);
14+
return Task.CompletedTask;
15+
}
16+
17+
public Task SendPasswordResetLinkAsync(ApplicationUser user, string email, string resetLink)
18+
{
19+
logger.LogInformation("Sending password reset link to {email} for user {user} with reset link {resetLink}",
20+
email, user.UserName, resetLink);
21+
return Task.CompletedTask;
22+
}
23+
24+
public Task SendPasswordResetCodeAsync(ApplicationUser user, string email, string resetCode)
25+
{
26+
logger.LogInformation("Sending password reset code to {email} for user {user} with reset code {resetCode}",
27+
email, user.UserName, resetCode);
28+
return Task.CompletedTask;
29+
}
30+
}

src/Argon.Api/Argon.Api.csproj

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.10"/>
12+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.10">
13+
<PrivateAssets>all</PrivateAssets>
14+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
15+
</PackageReference>
16+
<PackageReference Include="Microsoft.Orleans.Server" Version="8.2.0"/>
17+
<PackageReference Include="Orleans.Clustering.Kubernetes" Version="8.2.0"/>
18+
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0"/>
19+
</ItemGroup>
20+
21+
<ItemGroup>
22+
<Folder Include="Controllers\"/>
23+
</ItemGroup>
24+
25+
<ItemGroup>
26+
<ProjectReference Include="..\..\Contracts\Argon.Grains\Argon.Grains.csproj"/>
27+
<ProjectReference Include="..\Argon.Api.Common\Argon.Api.Common.csproj"/>
28+
<ProjectReference Include="..\ServiceDefaults\ServiceDefaults.csproj"/>
29+
</ItemGroup>
30+
31+
<ItemGroup>
32+
<Content Include="..\..\.dockerignore">
33+
<Link>.dockerignore</Link>
34+
</Content>
35+
</ItemGroup>
36+
37+
</Project>

src/Argon.Api/Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine-arm64v8 AS base
2+
USER $APP_UID
3+
WORKDIR /app
4+
EXPOSE 8080
5+
EXPOSE 8081
6+
7+
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine-arm64v8 AS build
8+
ARG BUILD_CONFIGURATION=Release
9+
WORKDIR /src
10+
COPY ["src/Argon.Api/Argon.Api.csproj", "src/Argon.Api/"]
11+
COPY ["src/ServiceDefaults/ServiceDefaults.csproj", "src/ServiceDefaults/"]
12+
COPY ["Contracts/Argon.Grains/Argon.Grains.csproj", "Contracts/Argon.Grains/"]
13+
COPY ["Contracts/Argon.Grains.Interfaces/Argon.Grains.Interfaces.csproj", "Contracts/Argon.Grains.Interfaces/"]
14+
COPY ["src/Argon.Api.Common/Argon.Api.Common.csproj", "src/Argon.Api.Common/"]
15+
RUN dotnet restore "src/Argon.Api/Argon.Api.csproj"
16+
COPY . .
17+
WORKDIR "/src/src/Argon.Api"
18+
RUN dotnet build "Argon.Api.csproj" -c $BUILD_CONFIGURATION -o /app/build
19+
20+
FROM build AS publish
21+
ARG BUILD_CONFIGURATION=Release
22+
RUN dotnet publish "Argon.Api.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
23+
24+
FROM base AS final
25+
WORKDIR /app
26+
COPY --from=publish /app/publish .
27+
ENTRYPOINT ["dotnet", "Argon.Api.dll"]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using Argon.Api.Common.Models;
2+
using Microsoft.AspNetCore.Identity;
3+
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
4+
using Microsoft.EntityFrameworkCore;
5+
6+
namespace Argon.Api.Entities;
7+
8+
public class ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
9+
: IdentityDbContext<ApplicationUser, IdentityRole<Guid>, Guid>(options);

src/Argon.Api/Migrations/20241012001305_Init.Designer.cs

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)