From 6da2af9e9bc045eab0cda3b4583f01d729771d45 Mon Sep 17 00:00:00 2001 From: gstio86 Date: Wed, 13 Nov 2024 04:18:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E4=B8=80=E4=BA=9BAPI?= =?UTF-8?q?=E8=B7=AF=E5=BE=91=EF=BC=8C=E4=BD=BF=E5=85=B6=E6=9B=B4=E7=9B=B4?= =?UTF-8?q?=E8=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../me/gt/snaptickets/controller/OrderController.java | 6 +++--- .../gt/snaptickets/controller/PaymentController.java | 6 +++--- .../me/gt/snaptickets/controller/TicketController.java | 6 +++--- .../me/gt/snaptickets/controller/UserController.java | 10 +++++----- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/java/me/gt/snaptickets/controller/OrderController.java b/src/main/java/me/gt/snaptickets/controller/OrderController.java index 301515d..ca1e0d4 100644 --- a/src/main/java/me/gt/snaptickets/controller/OrderController.java +++ b/src/main/java/me/gt/snaptickets/controller/OrderController.java @@ -43,13 +43,13 @@ public ResponseEntity> getAllOrders() { } @Operation(summary = "查詢訂單") - @GetMapping("/order/{id}") + @GetMapping("/info/{id}") public ResponseEntity getOrder(@PathVariable("id") String id) { return ResponseEntity.ok(orderService.getOrderByOrderId(id)); } @Operation(summary = "更新訂單狀態") - @PostMapping("/order/{id}") + @PostMapping("/update/{id}") public ResponseEntity updateOrderStatus(@PathVariable("id") String id, @RequestBody Order.Status status) { OrderService.ActionStatus action = orderService.updateOrderStatus(id, status); if (action == OrderService.ActionStatus.UPDATE_SUCCESS) { @@ -60,7 +60,7 @@ public ResponseEntity updateOrderStatus(@PathVariable("id") String id, @ } @Operation(summary = "刪除訂單") - @DeleteMapping("/order/{id}") + @DeleteMapping("/delete/{id}") public ResponseEntity deleteOrder(@PathVariable("id") String id) { orderService.deleteOrder(id); return ResponseEntity.ok("刪除成功"); diff --git a/src/main/java/me/gt/snaptickets/controller/PaymentController.java b/src/main/java/me/gt/snaptickets/controller/PaymentController.java index 19c30ac..09b3be9 100644 --- a/src/main/java/me/gt/snaptickets/controller/PaymentController.java +++ b/src/main/java/me/gt/snaptickets/controller/PaymentController.java @@ -69,7 +69,7 @@ public ResponseEntity getPaymentByOrderId(@PathVariable("orderId") Stri } @Operation(summary = "查詢指定條件的付款資料") - @GetMapping(value = "/payments/search") + @GetMapping(value = "/search") public ResponseEntity> searchPayments( @RequestParam(value = "paymentId", required = false) String paymentId, @RequestParam(value = "orderId", required = false) String orderId, @@ -80,7 +80,7 @@ public ResponseEntity> searchPayments( } @Operation(summary = "更新付款資料狀態") - @PutMapping(value = "/payments/{id}") + @PutMapping(value = "/update/{id}") public ResponseEntity updatePaymentStatus(@PathVariable("id") String id, @RequestParam("status") Payment.Status status) { try { paymentService.updatePaymentStatus(id, status.getName()); @@ -91,7 +91,7 @@ public ResponseEntity updatePaymentStatus(@PathVariable("id") String id, } @Operation(summary = "刪除付款資料") - @DeleteMapping(value = "/payments/{id}") + @DeleteMapping(value = "/delete/{id}") public ResponseEntity deletePayment(@PathVariable("id") String id) { try { paymentService.deletePayment(id); diff --git a/src/main/java/me/gt/snaptickets/controller/TicketController.java b/src/main/java/me/gt/snaptickets/controller/TicketController.java index 77821a1..6e62dde 100644 --- a/src/main/java/me/gt/snaptickets/controller/TicketController.java +++ b/src/main/java/me/gt/snaptickets/controller/TicketController.java @@ -77,7 +77,7 @@ public ResponseEntity uploadImage(@PathVariable String id, @RequestPart } @Operation(summary = "獲取票券資料") - @GetMapping("/{id}") + @GetMapping("/info/{id}") public ResponseEntity getTicketById(@PathVariable String id) { Ticket ticket = ticketService.getByTicketId(id); if (ticket == null) { @@ -93,7 +93,7 @@ public ResponseEntity getAllTickets() { } @Operation(summary = "更新票券") - @PutMapping(value = "/{id}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) + @PutMapping(value = "/update/{id}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) public ResponseEntity updateTicket(@PathVariable String id, @RequestBody TicketDto ticketDto) { TicketService.ActionStatus status = ticketService.updateTicket(ticketDto.convertToTicket(id)); if (status == TicketService.ActionStatus.UPDATE_FAILED) { @@ -103,7 +103,7 @@ public ResponseEntity updateTicket(@PathVariable String id, @RequestBody } @Operation(summary = "刪除票券") - @DeleteMapping("/{id}") + @DeleteMapping("/delete/{id}") public ResponseEntity deleteTicket(@PathVariable String id) { TicketService.ActionStatus status = ticketService.deleteTicket(id); if (status == TicketService.ActionStatus.DELETE_FAILED) { diff --git a/src/main/java/me/gt/snaptickets/controller/UserController.java b/src/main/java/me/gt/snaptickets/controller/UserController.java index 3f7da24..9352eef 100644 --- a/src/main/java/me/gt/snaptickets/controller/UserController.java +++ b/src/main/java/me/gt/snaptickets/controller/UserController.java @@ -33,7 +33,7 @@ public class UserController { private UserTicketService userTicketService; - @Value("${jwt.secret}") + @Value("${jwt.user.secret}") private String jwtSecret; @Operation(summary = "註冊帳號") @@ -62,7 +62,7 @@ public ResponseEntity loginUser(@RequestParam String identifier, @Reques return ResponseEntity.ok().body(Map.of("username", user.getUsername(), "token", token)); } - @Operation(summary = "透過帳號查詢資料") + @Operation(summary = "查詢帳號資料") @GetMapping("/user/info/{username}") public ResponseEntity getUserByUsername(@PathVariable String username) { User user = userService.getByUsername(username); @@ -91,7 +91,7 @@ public ResponseEntity> getTicketByUsernameAndOrderId(@PathVaria } @Operation(summary = "更新帳號資訊") - @PutMapping("/user") + @PutMapping("/user/update") public ResponseEntity updateUser(@RequestBody UserDto user) { boolean success = userService.updateUser(user.convertToUser()); if (success) { @@ -101,7 +101,7 @@ public ResponseEntity updateUser(@RequestBody UserDto user) { } @Operation(summary = "更改帳號密碼") - @PutMapping("/change-password/{username}") + @PutMapping("/user/change-password/{username}") public ResponseEntity updatePassword(@PathVariable String username, @RequestParam String oldPassword, @RequestParam String newPassword) { String validationMessage = PasswordUtil.validatePassword(newPassword); // 驗證新密碼是否符合安全性要求 if (validationMessage != null) { @@ -117,7 +117,7 @@ public ResponseEntity updatePassword(@PathVariable String username, @Req } @Operation(summary = "刪除帳號") - @DeleteMapping("/user/{username}") + @DeleteMapping("/user/delete/{username}") public ResponseEntity deleteUser(@PathVariable String username) { userService.deleteUser(username); return ResponseEntity.ok("帳號已刪除");