Commit 13fa5699 authored by Khalid Ali's avatar Khalid Ali

Merge branch 'feature/7-add-bid-to-user' into 'master'

Feature/7-Add-Bid-To-User

Closes #7

See merge request !5
parents dc8cdbbb 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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment