Skip to content

Commit cb28684

Browse files
authored
Merge branch 'master' into snyk-fix-48d174cc40f1bb97823b4cd4991f942d
2 parents 1b1f0e5 + f0353dc commit cb28684

File tree

51 files changed

+1509
-2330
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1509
-2330
lines changed

java/pom.xml

Lines changed: 612 additions & 590 deletions
Large diffs are not rendered by default.
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
package com.amido.stacks.workloads.menu.api.v1;
2+
3+
import static org.springframework.http.HttpStatus.OK;
4+
5+
import com.amido.stacks.core.api.annotations.CreateAPIResponses;
6+
import com.amido.stacks.core.api.annotations.DeleteAPIResponses;
7+
import com.amido.stacks.core.api.annotations.UpdateAPIResponses;
8+
import com.amido.stacks.core.api.dto.response.ResourceCreatedResponse;
9+
import com.amido.stacks.core.api.dto.response.ResourceUpdatedResponse;
10+
import com.amido.stacks.workloads.menu.api.v1.dto.request.CreateCategoryRequest;
11+
import com.amido.stacks.workloads.menu.api.v1.dto.request.UpdateCategoryRequest;
12+
import com.amido.stacks.workloads.menu.service.v1.CategoryService;
13+
import io.swagger.v3.oas.annotations.Operation;
14+
import io.swagger.v3.oas.annotations.Parameter;
15+
import java.util.UUID;
16+
import javax.validation.Valid;
17+
import lombok.RequiredArgsConstructor;
18+
import org.springframework.http.HttpStatus;
19+
import org.springframework.http.MediaType;
20+
import org.springframework.http.ResponseEntity;
21+
import org.springframework.web.bind.annotation.DeleteMapping;
22+
import org.springframework.web.bind.annotation.PathVariable;
23+
import org.springframework.web.bind.annotation.PostMapping;
24+
import org.springframework.web.bind.annotation.PutMapping;
25+
import org.springframework.web.bind.annotation.RequestAttribute;
26+
import org.springframework.web.bind.annotation.RequestBody;
27+
import org.springframework.web.bind.annotation.RequestMapping;
28+
import org.springframework.web.bind.annotation.RestController;
29+
30+
@RequestMapping(
31+
path = "/v1/menu/{id}/category",
32+
produces = MediaType.APPLICATION_JSON_VALUE + "; charset=utf-8")
33+
@RestController
34+
@RequiredArgsConstructor
35+
public class CategoryController {
36+
37+
private final CategoryService categoryService;
38+
39+
@PostMapping
40+
@Operation(
41+
tags = "Category",
42+
summary = "Create a category in the menu",
43+
description = "Adds a category to menu",
44+
operationId = "AddMenuCategory")
45+
@CreateAPIResponses
46+
ResponseEntity<ResourceCreatedResponse> createCategory(
47+
@Parameter(description = "Menu id", required = true) @PathVariable("id") UUID menuId,
48+
@Valid @RequestBody CreateCategoryRequest body,
49+
@Parameter(hidden = true) @RequestAttribute("CorrelationId") String correlationId) {
50+
51+
return new ResponseEntity<>(categoryService.create(body, correlationId), HttpStatus.CREATED);
52+
}
53+
54+
@PutMapping("/{categoryId}")
55+
@Operation(
56+
tags = "Category",
57+
summary = "Update a category in the menu",
58+
description = "Update a category to menu",
59+
operationId = "UpdateMenuCategory")
60+
@UpdateAPIResponses
61+
ResponseEntity<ResourceUpdatedResponse> updateCategory(
62+
@Parameter(description = "Menu id", required = true) @PathVariable("id") UUID menuId,
63+
@Parameter(description = "Category id", required = true) @PathVariable("categoryId")
64+
UUID categoryId,
65+
@Valid @RequestBody UpdateCategoryRequest body,
66+
@Parameter(hidden = true) @RequestAttribute("CorrelationId") String correlationId) {
67+
68+
return new ResponseEntity<>(
69+
categoryService.update(menuId, categoryId, body, correlationId), OK);
70+
}
71+
72+
@DeleteMapping("/{categoryId}")
73+
@Operation(
74+
tags = "Category",
75+
summary = "Removes a category and its items from menu",
76+
description = "Removes a category and its items from menu",
77+
operationId = "DeleteCategory")
78+
@DeleteAPIResponses
79+
ResponseEntity<Void> deleteCategory(
80+
@Parameter(description = "Menu id", required = true) @PathVariable("id") UUID menuId,
81+
@Parameter(description = "Category id", required = true) @PathVariable("categoryId")
82+
UUID categoryId,
83+
@Parameter(hidden = true) @RequestAttribute("CorrelationId") String correlationId) {
84+
85+
return new ResponseEntity<>(OK);
86+
}
87+
}

java/src/main/java/com/amido/stacks/workloads/menu/api/v1/CreateCategoryController.java

Lines changed: 0 additions & 72 deletions
This file was deleted.

java/src/main/java/com/amido/stacks/workloads/menu/api/v1/CreateItemController.java

Lines changed: 0 additions & 74 deletions
This file was deleted.

java/src/main/java/com/amido/stacks/workloads/menu/api/v1/CreateMenuController.java

Lines changed: 0 additions & 69 deletions
This file was deleted.

java/src/main/java/com/amido/stacks/workloads/menu/api/v1/DeleteCategoryController.java

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)