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
719e63af
Commit
719e63af
authored
May 05, 2021
by
Khai Yuan Liew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[AFP-58] Start work on delete endpoint
parent
892ead98
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
ProductController.java
.../nisum/ascend/inventory/controller/ProductController.java
+12
-1
ProductService.java
...va/com/nisum/ascend/inventory/service/ProductService.java
+5
-0
No files found.
src/main/java/com/nisum/ascend/inventory/controller/ProductController.java
View file @
719e63af
package
com
.
nisum
.
ascend
.
inventory
.
controller
;
import
com.nisum.ascend.inventory.dto.ProductDto
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
com.nisum.ascend.inventory.service.ProductService
;
import
reactor.core.publisher.Mono
;
@RestController
@RequestMapping
(
"/api/products"
)
public
class
ProductController
{
@Autowired
ProductService
productService
;
@DeleteMapping
(
value
=
"/{sku}"
)
public
void
deleteProduct
(
@PathVariable
String
sku
)
{
productService
.
removeProductBySku
(
sku
).
subscribe
();
}
}
src/main/java/com/nisum/ascend/inventory/service/ProductService.java
View file @
719e63af
...
...
@@ -5,10 +5,15 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
reactor.core.publisher.Flux
;
import
com.nisum.ascend.inventory.repository.ProductRepository
;
import
reactor.core.publisher.Mono
;
@Service
public
class
ProductService
{
@Autowired
ProductRepository
productRepository
;
public
Mono
<
Void
>
removeProductBySku
(
String
sku
){
return
productRepository
.
deleteById
(
sku
);
}
}
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