Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Michal Čížek
flea-market-manager
Commits
c14c3a0e
Commit
c14c3a0e
authored
May 18, 2022
by
Lucia Lopuchova
Committed by
cizek
May 18, 2022
Browse files
Fix stand controller, service and DTOs
parent
7aeff2cf
Changes
4
Show whitespace changes
Inline
Side-by-side
backend/flea-market-manager-controller/src/main/java/cz/fi/muni/pa165/flea/market/manager/controllers/StandController.java
View file @
c14c3a0e
...
...
@@ -5,7 +5,10 @@ import cz.fi.muni.pa165.flea.market.manager.dto.stand.StandCreateDTO;
import
cz.fi.muni.pa165.flea.market.manager.dto.stand.StandDTO
;
import
cz.fi.muni.pa165.flea.market.manager.dto.stand.StandUpdateDTO
;
import
cz.fi.muni.pa165.flea.market.manager.dto.stand.StandUserDTO
;
import
cz.fi.muni.pa165.flea.market.manager.dto.standType.StandTypeDTO
;
import
cz.fi.muni.pa165.flea.market.manager.dto.user.UserDTO
;
import
cz.fi.muni.pa165.flea.market.manager.entity.Stand
;
import
cz.fi.muni.pa165.flea.market.manager.entity.StandType
;
import
cz.fi.muni.pa165.flea.market.manager.enums.ItemCategory
;
import
cz.fi.muni.pa165.flea.market.manager.service.StandService
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
...
...
@@ -93,8 +96,10 @@ public class StandController {
return
userStands
.
stream
()
.
map
(
stand
->
new
StandUserDTO
(
stand
.
getId
(),
stand
.
getItemCategories
().
stream
().
map
(
ItemCategory:
:
getLabel
).
collect
(
Collectors
.
toSet
()),
stand
.
getStandType
().
getName
(),
stand
.
getItemCategories
().
stream
().
map
(
ItemCategory:
:
getLabel
).
collect
(
Collectors
.
toList
()),
mapper
.
map
(
stand
.
getStandType
(),
StandTypeDTO
.
class
),
mapper
.
map
(
stand
.
getSeller
(),
UserDTO
.
class
),
stand
.
getEvent
().
getId
(),
stand
.
getEvent
().
getName
(),
stand
.
getEvent
().
getStartDate
().
toString
()
))
...
...
backend/flea-market-manager-service/src/main/java/cz/fi/muni/pa165/flea/market/manager/dto/stand/StandUpdateDTO.java
View file @
c14c3a0e
...
...
@@ -21,4 +21,7 @@ public class StandUpdateDTO {
private
StandTypeDTO
standType
;
private
UserDTO
seller
;
@NotNull
private
String
eventId
;
}
backend/flea-market-manager-service/src/main/java/cz/fi/muni/pa165/flea/market/manager/dto/stand/StandUserDTO.java
View file @
c14c3a0e
package
cz.fi.muni.pa165.flea.market.manager.dto.stand
;
import
cz.fi.muni.pa165.flea.market.manager.dto.standType.StandTypeDTO
;
import
cz.fi.muni.pa165.flea.market.manager.dto.user.UserDTO
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
lombok.Setter
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
java.util.List
;
import
java.util.Set
;
/**
...
...
@@ -19,10 +22,15 @@ public class StandUserDTO {
@NotBlank
private
String
id
;
private
Se
t
<
String
>
itemCategories
;
private
Lis
t
<
String
>
itemCategories
;
@NotNull
private
String
standTypeName
;
private
StandTypeDTO
standType
;
private
UserDTO
seller
;
@NotNull
private
String
eventId
;
@NotNull
private
String
eventName
;
...
...
backend/flea-market-manager-service/src/main/java/cz/fi/muni/pa165/flea/market/manager/service/StandService.java
View file @
c14c3a0e
...
...
@@ -96,6 +96,7 @@ public class StandService extends DomainServiceImpl<Stand> {
Optional
.
of
(
standUpdateDTO
.
getSeller
())
.
ifPresent
(
seller
->
stand
.
setSeller
(
userService
.
findById
(
seller
.
getId
())));
stand
.
setStandType
(
standTypeServiceService
.
findById
(
standUpdateDTO
.
getStandType
().
getId
()));
stand
.
setEvent
(
marketEventDao
.
findById
(
standUpdateDTO
.
getEventId
()));
return
stand
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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