Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
warehouse-management
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
1
Merge Requests
1
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
warehouse-management
Commits
49019ac4
Commit
49019ac4
authored
May 10, 2021
by
Alex Pinto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: trying to fix endpoints
parent
88155b03
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
11 deletions
+30
-11
pom.xml
pom.xml
+5
-0
WarehouseController.java
...nalproject/warehouse/controllers/WarehouseController.java
+3
-1
NotFoundException.java
...dfinalproject/warehouse/exceptions/NotFoundException.java
+14
-0
SessionRepository.java
...inalproject/warehouse/repositories/SessionRepository.java
+0
-9
SessionService.java
...ascendfinalproject/warehouse/services/SessionService.java
+1
-1
WarehouseOrderService.java
...inalproject/warehouse/services/WarehouseOrderService.java
+7
-0
No files found.
pom.xml
View file @
49019ac4
...
@@ -80,6 +80,11 @@
...
@@ -80,6 +80,11 @@
<artifactId>
google-api-client
</artifactId>
<artifactId>
google-api-client
</artifactId>
<version>
1.31.2
</version>
<version>
1.31.2
</version>
</dependency>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-validation
</artifactId>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
src/main/java/com/ascendfinalproject/warehouse/controllers/WarehouseController.java
View file @
49019ac4
...
@@ -11,6 +11,8 @@ import org.springframework.web.bind.annotation.*;
...
@@ -11,6 +11,8 @@ import org.springframework.web.bind.annotation.*;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Mono
;
import
reactor.core.publisher.Mono
;
import
javax.validation.Valid
;
@RestController
@RestController
@RequestMapping
(
value
=
"/api"
)
@RequestMapping
(
value
=
"/api"
)
public
class
WarehouseController
{
public
class
WarehouseController
{
...
@@ -32,7 +34,7 @@ public class WarehouseController {
...
@@ -32,7 +34,7 @@ public class WarehouseController {
@CrossOrigin
@CrossOrigin
@PostMapping
(
value
=
"/orders"
)
@PostMapping
(
value
=
"/orders"
)
public
Mono
<
WarehouseOrder
>
createOrder
(
@RequestBody
WarehouseOrder
order
)
{
public
Mono
<
WarehouseOrder
>
createOrder
(
@
Valid
@
RequestBody
WarehouseOrder
order
)
{
return
orderService
.
createOrder
(
order
);
return
orderService
.
createOrder
(
order
);
}
}
...
...
src/main/java/com/ascendfinalproject/warehouse/exceptions/NotFoundException.java
0 → 100644
View file @
49019ac4
package
com
.
ascendfinalproject
.
warehouse
.
exceptions
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.web.bind.annotation.ResponseStatus
;
@ResponseStatus
(
HttpStatus
.
NOT_FOUND
)
public
class
NotFoundException
extends
RuntimeException
{
public
NotFoundException
()
{
super
();
}
public
NotFoundException
(
String
message
)
{
super
(
message
);
}
}
src/main/java/com/ascendfinalproject/warehouse/repositories/SessionRepository.java
deleted
100644 → 0
View file @
88155b03
package
com
.
ascendfinalproject
.
warehouse
.
repositories
;
import
com.ascendfinalproject.warehouse.models.Session
;
import
org.springframework.data.repository.CrudRepository
;
public
interface
SessionRepository
extends
CrudRepository
<
Session
,
String
>
{
}
src/main/java/com/ascendfinalproject/warehouse/services/SessionService.java
View file @
49019ac4
...
@@ -30,7 +30,7 @@ public class SessionService {
...
@@ -30,7 +30,7 @@ public class SessionService {
}
}
return
ResponseEntity
return
ResponseEntity
.
status
(
HttpStatus
.
BAD_REQUEST
)
.
status
(
HttpStatus
.
BAD_REQUEST
)
.
body
(
null
);
.
body
(
session
);
}
}
...
...
src/main/java/com/ascendfinalproject/warehouse/services/WarehouseOrderService.java
View file @
49019ac4
package
com
.
ascendfinalproject
.
warehouse
.
services
;
package
com
.
ascendfinalproject
.
warehouse
.
services
;
import
com.ascendfinalproject.warehouse.exceptions.NotFoundException
;
import
com.ascendfinalproject.warehouse.models.Item
;
import
com.ascendfinalproject.warehouse.models.Item
;
import
com.ascendfinalproject.warehouse.models.WarehouseOrder
;
import
com.ascendfinalproject.warehouse.models.WarehouseOrder
;
import
com.ascendfinalproject.warehouse.repositories.WarehouseOrderRepository
;
import
com.ascendfinalproject.warehouse.repositories.WarehouseOrderRepository
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.reactive.function.server.ServerResponse
;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Mono
;
import
reactor.core.publisher.Mono
;
...
@@ -21,6 +24,7 @@ public class WarehouseOrderService {
...
@@ -21,6 +24,7 @@ public class WarehouseOrderService {
public
Mono
<
WarehouseOrder
>
findOrderById
(
String
id
)
{
public
Mono
<
WarehouseOrder
>
findOrderById
(
String
id
)
{
return
orderRepository
.
findById
(
id
);
return
orderRepository
.
findById
(
id
);
// .switchIfEmpty(ServerResponse.notFound().build());
}
}
public
Flux
<
WarehouseOrder
>
getOrders
()
{
public
Flux
<
WarehouseOrder
>
getOrders
()
{
...
@@ -42,6 +46,9 @@ public class WarehouseOrderService {
...
@@ -42,6 +46,9 @@ public class WarehouseOrderService {
public
Mono
<
WarehouseOrder
>
updateOrder
(
WarehouseOrder
order
,
String
id
)
{
public
Mono
<
WarehouseOrder
>
updateOrder
(
WarehouseOrder
order
,
String
id
)
{
return
orderRepository
.
findById
(
id
)
return
orderRepository
.
findById
(
id
)
.
doOnError
(
error
->
{
throw
new
NotFoundException
(
"Warehouse order of ID: "
+
id
+
" not found"
);
})
.
flatMap
(
existingOrder
->
{
.
flatMap
(
existingOrder
->
{
existingOrder
.
setStatus
(
order
.
getStatus
());
existingOrder
.
setStatus
(
order
.
getStatus
());
existingOrder
.
setModifiedAt
(
new
Date
(
System
.
currentTimeMillis
()));
existingOrder
.
setModifiedAt
(
new
Date
(
System
.
currentTimeMillis
()));
...
...
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