Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
inventory-service
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ascend
inventory-service
Commits
0b86eb81
Commit
0b86eb81
authored
May 06, 2021
by
Khai Yuan Liew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[AFP-58] Work on DELETE product controller
parent
2762235b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
ProductController.java
.../nisum/ascend/inventory/controller/ProductController.java
+5
-2
No files found.
src/main/java/com/nisum/ascend/inventory/controller/ProductController.java
View file @
0b86eb81
...
...
@@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Mono
;
@RestController
@RequestMapping
(
"/api/products"
)
...
...
@@ -17,8 +18,10 @@ public class ProductController {
ProductService
productService
;
@DeleteMapping
(
value
=
"/{sku}"
)
public
void
deleteProduct
(
@PathVariable
String
sku
)
{
productService
.
removeProductBySku
(
sku
).
subscribe
();
public
Mono
<
ResponseEntity
<
Void
>>
deleteProduct
(
@PathVariable
String
sku
)
{
return
productService
.
removeProductBySku
(
sku
)
.
map
(
res
->
ResponseEntity
.
ok
().<
Void
>
build
())
.
defaultIfEmpty
(
ResponseEntity
.
notFound
().
build
());
}
@GetMapping
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment