Changeset 4b34fed
- Timestamp:
- 01/11/23 15:32:11 (23 months ago)
- Branches:
- main
- Children:
- 0328cb0
- Parents:
- e341a60
- Location:
- FullyStocked/src/main/java/com/bazi/fullystocked/Services/Implementations
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
FullyStocked/src/main/java/com/bazi/fullystocked/Services/Implementations/OrderedArticlesServiceImpl.java
re341a60 r4b34fed 2 2 3 3 import com.bazi.fullystocked.Models.Enumerations.ArticleStatus; 4 import com.bazi.fullystocked.Models.Enumerations.OrderStatus; 4 5 import com.bazi.fullystocked.Models.Exceptions.InvalidArgumentsException; 5 6 import com.bazi.fullystocked.Models.OrderedArticles; … … 33 34 public Optional<OrderedArticles> update(Integer oarticleid, int price, int quantity) { 34 35 OrderedArticles orderedArticles=orderedArticlesRepository.findById(oarticleid).orElseThrow(InvalidArgumentsException::new); 36 if(!orderedArticles.getOrder().getStatus().equals(OrderStatus.SENT)) 37 { 38 throw new InvalidArgumentsException(); 39 } 35 40 if(price<=0 || quantity<=0) 36 41 { -
FullyStocked/src/main/java/com/bazi/fullystocked/Services/Implementations/OrdersServiceImpl.java
re341a60 r4b34fed 174 174 if(order.getArticlesList().stream().anyMatch(orderedArticles -> !orderedArticles.getArticlestatus().equals(ArticleStatus.PROCESSED))) 175 175 { 176 throw new InvalidArgumentsException();176 return Optional.of(order); 177 177 } 178 178 }
Note:
See TracChangeset
for help on using the changeset viewer.