From f1d0e90bde738269d0c1607df16d97fc325dcc82 Mon Sep 17 00:00:00 2001 From: Swordsteel Date: Mon, 18 Aug 2025 10:58:22 +0200 Subject: [PATCH] update paths --- .../ltd/hlaeja/controller/AccountController.kt | 4 ++-- .../ltd/hlaeja/controller/DeviceController.kt | 6 +++--- .../ltd/hlaeja/controller/NodeController.kt | 6 +++--- .../ltd/hlaeja/controller/TypeController.kt | 18 ++++++++++-------- .../hlaeja/security/authorize/AdminPaths.kt | 8 ++++---- .../resources/templates/account/create.html | 4 ++-- src/main/resources/templates/account/edit.html | 4 ++-- .../resources/templates/account/users.html | 6 +++--- .../templates/authentication/logout.html | 3 +-- src/main/resources/templates/device/list.html | 6 +++--- src/main/resources/templates/layout.html | 8 ++++---- src/main/resources/templates/node/list.html | 2 +- src/main/resources/templates/type/form.html | 4 ++-- src/main/resources/templates/type/list.html | 10 +++++----- 14 files changed, 45 insertions(+), 44 deletions(-) diff --git a/src/main/kotlin/ltd/hlaeja/controller/AccountController.kt b/src/main/kotlin/ltd/hlaeja/controller/AccountController.kt index b2409cd..a5e7452 100644 --- a/src/main/kotlin/ltd/hlaeja/controller/AccountController.kt +++ b/src/main/kotlin/ltd/hlaeja/controller/AccountController.kt @@ -30,7 +30,7 @@ import org.springframework.web.bind.annotation.RequestMapping import reactor.core.publisher.Mono @Controller -@RequestMapping("/account") +@RequestMapping("/accounts") class AccountController( private val accountRegistryService: AccountRegistryService, ) { @@ -110,7 +110,7 @@ class AccountController( } else { Mono.just(accountForm) .flatMap { accountRegistryService.addAccount(it.toAccountRequest()) } - .map { "redirect:/account" } + .map { "redirect:/accounts" } .onErrorResume { error -> val errorMessage = when (error) { is UsernameDuplicateException -> "Username already exists. Please choose another." diff --git a/src/main/kotlin/ltd/hlaeja/controller/DeviceController.kt b/src/main/kotlin/ltd/hlaeja/controller/DeviceController.kt index 2af1fe8..864496f 100644 --- a/src/main/kotlin/ltd/hlaeja/controller/DeviceController.kt +++ b/src/main/kotlin/ltd/hlaeja/controller/DeviceController.kt @@ -20,9 +20,9 @@ class DeviceController( ) { @GetMapping( - "/device", - "/device/page-{page}", - "/device/page-{page}/show-{show}", + "/devices", + "/devices/page-{page}", + "/devices/page-{page}/show-{show}", ) fun getDevice( @PathVariable(required = false) @Min(MIN) page: Int = DEFAULT_PAGE, diff --git a/src/main/kotlin/ltd/hlaeja/controller/NodeController.kt b/src/main/kotlin/ltd/hlaeja/controller/NodeController.kt index 49f8cbb..6e1c07a 100644 --- a/src/main/kotlin/ltd/hlaeja/controller/NodeController.kt +++ b/src/main/kotlin/ltd/hlaeja/controller/NodeController.kt @@ -19,9 +19,9 @@ class NodeController( private val deviceRegistryService: DeviceRegistryService, ) { @GetMapping( - "/node", - "/node/page-{page}", - "/node/page-{page}/show-{show}", + "/nodes", + "/nodes/page-{page}", + "/nodes/page-{page}/show-{show}", ) fun getNodes( @PathVariable(required = false) @Min(MIN) page: Int = DEFAULT_PAGE, diff --git a/src/main/kotlin/ltd/hlaeja/controller/TypeController.kt b/src/main/kotlin/ltd/hlaeja/controller/TypeController.kt index 69a6a03..fb05b6c 100644 --- a/src/main/kotlin/ltd/hlaeja/controller/TypeController.kt +++ b/src/main/kotlin/ltd/hlaeja/controller/TypeController.kt @@ -24,17 +24,19 @@ import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.ModelAttribute import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.PostMapping +import org.springframework.web.bind.annotation.RequestMapping import reactor.core.publisher.Mono @Controller +@RequestMapping("/types") class TypeController( private val deviceRegistryService: DeviceRegistryService, ) { @GetMapping( - "/type", - "/type/page-{page}", - "/type/page-{page}/show-{show}", + "", + "/page-{page}", + "/page-{page}/show-{show}", ) fun getTypes( @PathVariable(required = false) @Min(MIN) page: Int = DEFAULT_PAGE, @@ -48,7 +50,7 @@ class TypeController( } .then(Mono.just("type/list")) - @GetMapping("/type/create") + @GetMapping("/create") fun getCreateType( model: Model, ): Mono = Mono.just("type/form") @@ -56,7 +58,7 @@ class TypeController( model.addAttribute("typeForm", TypeForm()) } - @PostMapping("/type/create") + @PostMapping("/create") fun postCreateType( @Validated @ModelAttribute("typeForm") typeForm: TypeForm, bindingResult: BindingResult, @@ -68,7 +70,7 @@ class TypeController( } else { Mono.just(typeForm) .flatMap { deviceRegistryService.createType(it.toTypeRequest()) } - .map { "redirect:/type" } + .map { "redirect:/types" } .onErrorResume { error -> val errorMessage = when (error) { is TypeNameDuplicateException -> "Type name already exists. Please choose another." @@ -79,7 +81,7 @@ class TypeController( } } - @GetMapping("/type-{type}") + @GetMapping("/edit-{type}") fun getEditType( @PathVariable type: UUID, model: Model, @@ -90,7 +92,7 @@ class TypeController( } .then(Mono.just("type/form")) - @PostMapping("/type-{type}") + @PostMapping("/edit-{type}") fun postEditType( @PathVariable type: UUID, @Validated @ModelAttribute("typeForm") typeForm: TypeForm, diff --git a/src/main/kotlin/ltd/hlaeja/security/authorize/AdminPaths.kt b/src/main/kotlin/ltd/hlaeja/security/authorize/AdminPaths.kt index ac1c188..d530794 100644 --- a/src/main/kotlin/ltd/hlaeja/security/authorize/AdminPaths.kt +++ b/src/main/kotlin/ltd/hlaeja/security/authorize/AdminPaths.kt @@ -3,8 +3,8 @@ package ltd.hlaeja.security.authorize import org.springframework.security.config.web.server.ServerHttpSecurity.AuthorizeExchangeSpec fun AuthorizeExchangeSpec.adminPaths(): AuthorizeExchangeSpec.Access = pathMatchers( - "/account/**", - "/type/**", - "/device/**", - "/node/**", + "/accounts/**", + "/typse/**", + "/devices/**", + "/nodes/**", ) diff --git a/src/main/resources/templates/account/create.html b/src/main/resources/templates/account/create.html index df6e4bf..e1ad776 100644 --- a/src/main/resources/templates/account/create.html +++ b/src/main/resources/templates/account/create.html @@ -11,7 +11,7 @@

New Account Registration


-
+
@@ -44,7 +44,7 @@
- Cancel + Cancel
diff --git a/src/main/resources/templates/account/edit.html b/src/main/resources/templates/account/edit.html index 68d30f7..0044971 100644 --- a/src/main/resources/templates/account/edit.html +++ b/src/main/resources/templates/account/edit.html @@ -8,7 +8,7 @@
-
+

Edit User


@@ -59,7 +59,7 @@
- Cancel + Cancel
diff --git a/src/main/resources/templates/account/users.html b/src/main/resources/templates/account/users.html index 824a78e..ef221fb 100644 --- a/src/main/resources/templates/account/users.html +++ b/src/main/resources/templates/account/users.html @@ -20,7 +20,7 @@
@@ -38,11 +38,11 @@ username Loading... ID - Edit + Edit
- +
diff --git a/src/main/resources/templates/authentication/logout.html b/src/main/resources/templates/authentication/logout.html index ef9c952..5f99a49 100644 --- a/src/main/resources/templates/authentication/logout.html +++ b/src/main/resources/templates/authentication/logout.html @@ -12,8 +12,7 @@

Confirm System Logout

Are you sure you want to terminate your session?

- Cancel - + diff --git a/src/main/resources/templates/device/list.html b/src/main/resources/templates/device/list.html index f61e6b5..a789332 100644 --- a/src/main/resources/templates/device/list.html +++ b/src/main/resources/templates/device/list.html @@ -8,7 +8,7 @@
-

Device

+

Devices


@@ -25,7 +25,7 @@ ID - Time + Time Actions @@ -41,7 +41,7 @@
- +
diff --git a/src/main/resources/templates/layout.html b/src/main/resources/templates/layout.html index c6ed573..3dfc74e 100644 --- a/src/main/resources/templates/layout.html +++ b/src/main/resources/templates/layout.html @@ -32,11 +32,11 @@ - +
diff --git a/src/main/resources/templates/type/form.html b/src/main/resources/templates/type/form.html index 953af6b..7d8cf50 100644 --- a/src/main/resources/templates/type/form.html +++ b/src/main/resources/templates/type/form.html @@ -20,7 +20,7 @@
-
+
@@ -32,7 +32,7 @@
diff --git a/src/main/resources/templates/type/list.html b/src/main/resources/templates/type/list.html index e69f795..184b264 100644 --- a/src/main/resources/templates/type/list.html +++ b/src/main/resources/templates/type/list.html @@ -8,7 +8,7 @@
-

Device Types

+

Types


- + @@ -41,12 +41,12 @@ - +
NameName Time ID Actions EditEdit
- +