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
39fd6818
Commit
39fd6818
authored
May 18, 2022
by
Lucia Lopuchova
Committed by
cizek
May 18, 2022
Browse files
Add StandUserDTO and new endpoint findAllBySellerId
parent
84f7c90e
Changes
2
Hide 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 @
39fd6818
...
@@ -4,6 +4,7 @@ import cz.fi.muni.pa165.flea.market.manager.dto.enums.EnumDTO;
...
@@ -4,6 +4,7 @@ import cz.fi.muni.pa165.flea.market.manager.dto.enums.EnumDTO;
import
cz.fi.muni.pa165.flea.market.manager.dto.stand.StandCreateDTO
;
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.StandDTO
;
import
cz.fi.muni.pa165.flea.market.manager.dto.stand.StandUpdateDTO
;
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.entity.Stand
;
import
cz.fi.muni.pa165.flea.market.manager.entity.Stand
;
import
cz.fi.muni.pa165.flea.market.manager.enums.ItemCategory
;
import
cz.fi.muni.pa165.flea.market.manager.enums.ItemCategory
;
import
cz.fi.muni.pa165.flea.market.manager.service.StandService
;
import
cz.fi.muni.pa165.flea.market.manager.service.StandService
;
...
@@ -85,4 +86,17 @@ public class StandController {
...
@@ -85,4 +86,17 @@ public class StandController {
.
map
(
itemCategory
->
new
EnumDTO
(
itemCategory
.
name
(),
itemCategory
.
getLabel
()))
.
map
(
itemCategory
->
new
EnumDTO
(
itemCategory
.
name
(),
itemCategory
.
getLabel
()))
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
}
}
@GetMapping
(
value
=
"/list/user/{userId}"
)
public
List
<
StandUserDTO
>
findAllBySellerId
(
@PathVariable
(
"userId"
)
String
userId
)
{
List
<
Stand
>
userStands
=
standService
.
findAllBySellerId
(
userId
);
return
userStands
.
stream
()
.
map
(
stand
->
new
StandUserDTO
(
stand
.
getId
(),
stand
.
getItemCategories
().
stream
().
map
(
ItemCategory:
:
getLabel
).
collect
(
Collectors
.
toSet
()),
stand
.
getStandType
().
getName
(),
stand
.
getEvent
().
getName
()
))
.
collect
(
Collectors
.
toList
());
}
}
}
\ No newline at end of file
backend/flea-market-manager-service/src/main/java/cz/fi/muni/pa165/flea/market/manager/dto/stand/StandUserDTO.java
0 → 100644
View file @
39fd6818
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
;
/**
* @author Lucia Lopuchova
*/
@Getter
@Setter
@AllArgsConstructor
public
class
StandUserDTO
{
@NotBlank
private
String
id
;
private
Set
<
String
>
itemCategories
;
@NotNull
private
String
standTypeName
;
@NotNull
private
String
eventName
;
}
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