Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Khalid Ali
bookshare-backend
Commits
1b9dba78
Commit
1b9dba78
authored
Jan 13, 2019
by
Khalid Ali
Browse files
Feature/7-Add-Bid-To-User
parent
dc8cdbbb
Changes
1
Show whitespace changes
Inline
Side-by-side
src/main/java/com/gmu/bookshare/web/BookshareApiController.java
View file @
1b9dba78
...
...
@@ -100,8 +100,10 @@ public class BookshareApiController {
@ResponseStatus
(
HttpStatus
.
CREATED
)
public
BidDto
addBid
(
@PathVariable
Long
id
,
@RequestBody
BidDto
bidDto
)
{
BidEntity
bid
=
convertBidToEntity
(
bidDto
);
listingService
.
addBid
(
id
,
bid
);
shareUserService
.
getShareUser
().
addBid
(
bid
);
BidEntity
bidCreated
=
bidService
.
addListing
(
bid
);
listingService
.
addBid
(
id
,
bidCreated
);
return
convertBidToDto
(
bidCreated
);
}
...
...
@@ -120,6 +122,22 @@ public class BookshareApiController {
return
convertShareUserToDto
(
user
);
}
@GetMapping
(
value
=
"/user/bid"
)
List
<
BidDto
>
getBidsAssociatedWithShareUser
()
{
ShareUser
shareUser
=
shareUserService
.
getShareUser
();
return
shareUser
.
getBidsOwned
().
stream
()
.
map
(
this
::
convertBidToDto
)
.
collect
(
Collectors
.
toList
());
}
@GetMapping
(
value
=
"/user/listing"
)
List
<
ListingDto
>
getListingsAssociatedWithShareUser
()
{
ShareUser
shareUser
=
shareUserService
.
getShareUser
();
return
shareUser
.
getListingsOwned
().
stream
()
.
map
(
this
::
convertToDto
)
.
collect
(
Collectors
.
toList
());
}
@GetMapping
(
name
=
"/login"
)
public
String
index
(
ModelMap
modelMap
)
{
Authentication
auth
=
SecurityContextHolder
.
getContext
()
...
...
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