-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #886 from amido/feature/4714-4715-Swagger-Annotati…
…ons-and-Controller-Impls Feature/4714 & 4715 Swagger annotations and Controller impls
- Loading branch information
Showing
41 changed files
with
677 additions
and
1,665 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
java/src/main/java/com/amido/stacks/workloads/menu/api/v1/CategoryController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package com.amido.stacks.workloads.menu.api.v1; | ||
|
||
import static org.springframework.http.HttpStatus.OK; | ||
|
||
import com.amido.stacks.core.api.annotations.CreateAPIResponses; | ||
import com.amido.stacks.core.api.annotations.DeleteAPIResponses; | ||
import com.amido.stacks.core.api.annotations.UpdateAPIResponses; | ||
import com.amido.stacks.core.api.dto.response.ResourceCreatedResponse; | ||
import com.amido.stacks.core.api.dto.response.ResourceUpdatedResponse; | ||
import com.amido.stacks.workloads.menu.api.v1.dto.request.CreateCategoryRequest; | ||
import com.amido.stacks.workloads.menu.api.v1.dto.request.UpdateCategoryRequest; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.Parameter; | ||
import java.util.UUID; | ||
import javax.validation.Valid; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.DeleteMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.PutMapping; | ||
import org.springframework.web.bind.annotation.RequestAttribute; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RequestMapping( | ||
path = "/v1/menu/{id}/category", | ||
produces = MediaType.APPLICATION_JSON_VALUE + "; charset=utf-8") | ||
@RestController | ||
public class CategoryController { | ||
|
||
@PostMapping | ||
@Operation( | ||
tags = "Category", | ||
summary = "Create a category in the menu", | ||
description = "Adds a category to menu", | ||
operationId = "AddMenuCategory") | ||
@CreateAPIResponses | ||
ResponseEntity<ResourceCreatedResponse> addMenuCategory( | ||
@Parameter(description = "Menu id", required = true) @PathVariable("id") UUID menuId, | ||
@Valid @RequestBody CreateCategoryRequest body, | ||
@Parameter(hidden = true) @RequestAttribute("CorrelationId") String correlationId) { | ||
|
||
return new ResponseEntity<>(new ResourceCreatedResponse(UUID.randomUUID()), HttpStatus.CREATED); | ||
} | ||
|
||
@PutMapping("/{categoryId}") | ||
@Operation( | ||
tags = "Category", | ||
summary = "Update a category in the menu", | ||
description = "Update a category to menu", | ||
operationId = "UpdateMenuCategory") | ||
@UpdateAPIResponses | ||
ResponseEntity<ResourceUpdatedResponse> updateMenuCategory( | ||
@Parameter(description = "Menu id", required = true) @PathVariable("id") UUID menuId, | ||
@Parameter(description = "Category id", required = true) @PathVariable("categoryId") | ||
UUID categoryId, | ||
@Valid @RequestBody UpdateCategoryRequest body, | ||
@Parameter(hidden = true) @RequestAttribute("CorrelationId") String correlationId) { | ||
|
||
return new ResponseEntity<>(new ResourceUpdatedResponse(UUID.randomUUID()), OK); | ||
} | ||
|
||
@DeleteMapping("/{categoryId}") | ||
@Operation( | ||
tags = "Category", | ||
summary = "Removes a category and its items from menu", | ||
description = "Removes a category and its items from menu", | ||
operationId = "DeleteCategory") | ||
@DeleteAPIResponses | ||
ResponseEntity<Void> deleteCategory( | ||
@Parameter(description = "Menu id", required = true) @PathVariable("id") UUID menuId, | ||
@Parameter(description = "Category id", required = true) @PathVariable("categoryId") | ||
UUID categoryId, | ||
@Parameter(hidden = true) @RequestAttribute("CorrelationId") String correlationId) { | ||
|
||
return new ResponseEntity<>(OK); | ||
} | ||
} |
72 changes: 0 additions & 72 deletions
72
java/src/main/java/com/amido/stacks/workloads/menu/api/v1/CreateCategoryController.java
This file was deleted.
Oops, something went wrong.
74 changes: 0 additions & 74 deletions
74
java/src/main/java/com/amido/stacks/workloads/menu/api/v1/CreateItemController.java
This file was deleted.
Oops, something went wrong.
69 changes: 0 additions & 69 deletions
69
java/src/main/java/com/amido/stacks/workloads/menu/api/v1/CreateMenuController.java
This file was deleted.
Oops, something went wrong.
71 changes: 0 additions & 71 deletions
71
java/src/main/java/com/amido/stacks/workloads/menu/api/v1/DeleteCategoryController.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.