From 0fb38947369f3fd5014962ff81783ddc32286375 Mon Sep 17 00:00:00 2001 From: Giacomo Marciani Date: Sun, 1 Dec 2024 02:30:52 +0100 Subject: [PATCH] [Server] Fix operation name mapping. --- .../server/utils/OperationNameProvider.kt | 52 ++++++++++++------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/server/src/main/kotlin/com/yawa/server/utils/OperationNameProvider.kt b/server/src/main/kotlin/com/yawa/server/utils/OperationNameProvider.kt index 2f2d947..5277c70 100644 --- a/server/src/main/kotlin/com/yawa/server/utils/OperationNameProvider.kt +++ b/server/src/main/kotlin/com/yawa/server/utils/OperationNameProvider.kt @@ -7,34 +7,50 @@ import org.springframework.stereotype.Component class OperationNameProvider { val OPERATIONS = mapOf( - // Public - Pair(HttpMethod.GET.name(), "/api/open/getDeterministicOutcome") to "GetDeterministicOutcome", - Pair(HttpMethod.GET.name(), "/api/open/getRandomOutcome") to "GetRandomOutcome", - - // Administration - Read operations + // Admin - Server Pair(HttpMethod.GET.name(), "/manage/configprops") to "GetConfig", Pair(HttpMethod.GET.name(), "/manage/env") to "GetEnv", Pair(HttpMethod.GET.name(), "/manage/health") to "GetHealth", Pair(HttpMethod.GET.name(), "/manage/info") to "GetInfo", Pair(HttpMethod.GET.name(), "/manage/mappings") to "GetMappings", Pair(HttpMethod.GET.name(), "/manage/metrics") to "GetMetrics", - Pair(HttpMethod.GET.name(), "/manage/openapi") to "GetOpenApi", Pair(HttpMethod.GET.name(), "/manage/prometheus") to "GetPrometheus", - Pair(HttpMethod.GET.name(), "/manage/swagger-ui") to "GetSwaggerUi", - - // Administration - Write operations Pair(HttpMethod.POST.name(), "/manage/shutdown") to "ManageShutdown", + // Admin - Email + Pair(HttpMethod.POST.name(), "/admin/mail") to "SendMail", + + // Documentation + Pair(HttpMethod.GET.name(), "/manage/openapi") to "GetOpenApi", + Pair(HttpMethod.GET.name(), "/manage/swagger-ui") to "GetSwaggerUi", + // Authentication - Pair(HttpMethod.POST.name(), "/api/auth/login") to "Login", - Pair(HttpMethod.POST.name(), "/api/auth/logout") to "Logout", - - // Users management - Pair(HttpMethod.POST.name(), "/api/users/createUsers") to "CreateUsers", - Pair(HttpMethod.DELETE.name(), "/api/users/deleteUsers") to "DeleteUsers", - Pair(HttpMethod.GET.name(), "/api/users/describeUsers") to "DescribeUsers", - Pair(HttpMethod.GET.name(), "/api/users/listUsers") to "ListUsers", - Pair(HttpMethod.PATCH.name(), "/api/users/updateUsers") to "UpdateUsers", + Pair(HttpMethod.POST.name(), "/auth/login") to "Login", + Pair(HttpMethod.POST.name(), "/auth/logout") to "Logout", + Pair(HttpMethod.POST.name(), "/auth/admin/tokens") to "RefreshAuthentication", + + // Users - Creation + Pair(HttpMethod.POST.name(), "/users/{username}") to "CreateUser", + Pair(HttpMethod.POST.name(), "/users/{username}/activation") to "ActivateUser", + Pair(HttpMethod.GET.name(), "/users/{username}/tokens/activation") to "SendUserActivationToken", + + // Users - Deletion + Pair(HttpMethod.DELETE.name(), "/users/{username}") to "DeleteUser", + Pair(HttpMethod.GET.name(), "/users/{username}/tokens/deletion") to "SendUserDeletionToken", + + // Users - Password + Pair(HttpMethod.PATCH.name(), "/users/{username}/password") to "ResetPassword", + Pair(HttpMethod.GET.name(), "/users/{username}/tokens/password") to "SendPasswordResetToken", + + // Users - Profile + Pair(HttpMethod.GET.name(), "/users/{username}/profile") to "GetUserProfile", + Pair(HttpMethod.PATCH.name(), "/users/{username}/profile") to "UpdateUserProfile", + Pair(HttpMethod.DELETE.name(), "/users/{username}/picture") to "DeleteUserPicture", + Pair(HttpMethod.PATCH.name(), "/users/{username}/picture") to "UpdateUserPicture", + + // Users - Settings + Pair(HttpMethod.GET.name(), "/users/{username}/setting") to "GetUserSettings", + Pair(HttpMethod.PATCH.name(), "/users/{username}/settings") to "UpdateUserSettings", // Simple Pair(HttpMethod.GET.name(), "/simple/outcome") to "GetOutcome",