PUT /api/candidate/profile
行政区划、学校班级、特长类别校验 证件号码唯一性 自动创建资料审核工作流 资料和用户显示名称原子更新 POST /api/candidate/registrations 资料审核状态、报名时间和科目校验 重复报名防护 自动选择负载最低的审批管理员 报名、科目和审批流原子写入
This commit is contained in:
+22
-8
@@ -3,47 +3,61 @@ using Eis.Infrastructure.Candidate;
|
||||
|
||||
namespace Eis.Web.Candidate;
|
||||
|
||||
public static class NativeCandidateReadEndpoints
|
||||
public static class NativeCandidateEndpoints
|
||||
{
|
||||
public static IEndpointRouteBuilder MapNativeCandidateReadEndpoints(
|
||||
public static IEndpointRouteBuilder MapNativeCandidateEndpoints(
|
||||
this IEndpointRouteBuilder endpoints,
|
||||
CandidateMigrationOptions options)
|
||||
{
|
||||
if (!options.NativeReadEnabled)
|
||||
if (!options.NativeEnabled)
|
||||
{
|
||||
return endpoints;
|
||||
}
|
||||
|
||||
endpoints.MapGet("/api/candidate/dashboard", async (
|
||||
HttpContext context,
|
||||
ICandidateQueryService service,
|
||||
ICandidateService service,
|
||||
CancellationToken cancellationToken) => ToResult(
|
||||
context,
|
||||
await service.GetDashboardAsync(SessionToken(context), cancellationToken)));
|
||||
endpoints.MapGet("/api/candidate/notices", async (
|
||||
HttpContext context,
|
||||
ICandidateQueryService service,
|
||||
ICandidateService service,
|
||||
CancellationToken cancellationToken) => ToResult(
|
||||
context,
|
||||
await service.GetNoticesAsync(SessionToken(context), cancellationToken)));
|
||||
endpoints.MapGet("/api/candidate/profile", async (
|
||||
HttpContext context,
|
||||
ICandidateQueryService service,
|
||||
ICandidateService service,
|
||||
CancellationToken cancellationToken) => ToResult(
|
||||
context,
|
||||
await service.GetProfileAsync(SessionToken(context), cancellationToken)));
|
||||
endpoints.MapPut("/api/candidate/profile", async (
|
||||
HttpContext context,
|
||||
System.Text.Json.Nodes.JsonObject request,
|
||||
ICandidateService service,
|
||||
CancellationToken cancellationToken) => ToResult(
|
||||
context,
|
||||
await service.UpdateProfileAsync(SessionToken(context), request, cancellationToken)));
|
||||
endpoints.MapGet("/api/candidate/exams", async (
|
||||
HttpContext context,
|
||||
ICandidateQueryService service,
|
||||
ICandidateService service,
|
||||
CancellationToken cancellationToken) => ToResult(
|
||||
context,
|
||||
await service.GetExamsAsync(SessionToken(context), cancellationToken)));
|
||||
endpoints.MapGet("/api/candidate/registrations", async (
|
||||
HttpContext context,
|
||||
ICandidateQueryService service,
|
||||
ICandidateService service,
|
||||
CancellationToken cancellationToken) => ToResult(
|
||||
context,
|
||||
await service.GetRegistrationsAsync(SessionToken(context), cancellationToken)));
|
||||
endpoints.MapPost("/api/candidate/registrations", async (
|
||||
HttpContext context,
|
||||
System.Text.Json.Nodes.JsonObject request,
|
||||
ICandidateService service,
|
||||
CancellationToken cancellationToken) => ToResult(
|
||||
context,
|
||||
await service.CreateRegistrationAsync(SessionToken(context), request, cancellationToken)));
|
||||
|
||||
return endpoints;
|
||||
}
|
||||
@@ -37,7 +37,7 @@ var authenticationOptions = AuthenticationOptions.FromEnvironment(
|
||||
builder.Environment.IsProduction(),
|
||||
builder.Configuration.GetValue<bool>("AuthenticationMigration:NativeEnabled"));
|
||||
var candidateMigrationOptions = CandidateMigrationOptions.FromEnvironment(
|
||||
builder.Configuration.GetValue<bool>("CandidateMigration:NativeReadEnabled"),
|
||||
builder.Configuration.GetValue<bool>("CandidateMigration:NativeEnabled"),
|
||||
authenticationOptions.NativeEnabled,
|
||||
authenticationOptions.SharesLegacySessions);
|
||||
builder.Services.AddEisInfrastructure(
|
||||
@@ -81,9 +81,9 @@ app.MapGet("/health/migration", async (LegacyApiProxy proxy, CancellationToken c
|
||||
},
|
||||
candidate = new
|
||||
{
|
||||
nativeReadEnabled = candidateMigrationOptions.NativeReadEnabled,
|
||||
nativeRoutes = candidateMigrationOptions.NativeReadEnabled
|
||||
? new[] { "dashboard", "notices", "profile", "exams", "registrations" }
|
||||
nativeEnabled = candidateMigrationOptions.NativeEnabled,
|
||||
nativeRoutes = candidateMigrationOptions.NativeEnabled
|
||||
? new[] { "GET dashboard", "GET notices", "GET/PUT profile", "GET exams", "GET/POST registrations" }
|
||||
: []
|
||||
},
|
||||
features = MigrationFeatureCatalog.Current(authenticationOptions.NativeEnabled)
|
||||
@@ -92,7 +92,7 @@ app.MapGet("/health/migration", async (LegacyApiProxy proxy, CancellationToken c
|
||||
|
||||
app.MapNativePublicEndpoints();
|
||||
app.MapNativeAuthenticationEndpoints(authenticationOptions);
|
||||
app.MapNativeCandidateReadEndpoints(candidateMigrationOptions);
|
||||
app.MapNativeCandidateEndpoints(candidateMigrationOptions);
|
||||
|
||||
string[] methods =
|
||||
[
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"NativeEnabled": false
|
||||
},
|
||||
"CandidateMigration": {
|
||||
"NativeReadEnabled": false
|
||||
"NativeEnabled": false
|
||||
},
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
|
||||
Reference in New Issue
Block a user