mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-09 08:30:55 +08:00
feat: implement lottery post type
This commit is contained in:
@@ -39,7 +39,9 @@ public class PostController {
|
||||
return ResponseEntity.badRequest().build();
|
||||
}
|
||||
Post post = postService.createPost(auth.getName(), req.getCategoryId(),
|
||||
req.getTitle(), req.getContent(), req.getTagIds());
|
||||
req.getTitle(), req.getContent(), req.getTagIds(),
|
||||
req.getType(), req.getPrizeDescription(), req.getPrizeIcon(),
|
||||
req.getPrizeCount(), req.getStartTime(), req.getEndTime());
|
||||
draftService.deleteDraft(auth.getName());
|
||||
PostDetailDto dto = postMapper.toDetailDto(post, auth.getName());
|
||||
dto.setReward(levelService.awardForPost(auth.getName()));
|
||||
@@ -67,6 +69,12 @@ public class PostController {
|
||||
return ResponseEntity.ok(postMapper.toDetailDto(post, viewer));
|
||||
}
|
||||
|
||||
@PostMapping("/{id}/lottery/join")
|
||||
public ResponseEntity<Void> joinLottery(@PathVariable Long id, Authentication auth) {
|
||||
postService.joinLottery(id, auth.getName());
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public List<PostSummaryDto> listPosts(@RequestParam(value = "categoryId", required = false) Long categoryId,
|
||||
@RequestParam(value = "categoryIds", required = false) List<Long> categoryIds,
|
||||
|
||||
Reference in New Issue
Block a user