Skip to content

Commit

Permalink
Merge pull request #21 from jjuuuunnii/main
Browse files Browse the repository at this point in the history
Feat: UserId 어노테이션 삭제
  • Loading branch information
jjuuuunnii authored Jan 11, 2024
2 parents 87e4260 + 88f35a6 commit 60dc2db
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package com.snowthon.snowman.controller;

import io.swagger.v3.oas.annotations.Hidden;
import com.snowthon.snowman.annotation.UserId;
import com.snowthon.snowman.contrant.Constants;
import com.snowthon.snowman.dto.common.ResponseDto;
import com.snowthon.snowman.dto.request.VoteRequestDto;
import com.snowthon.snowman.repository.UserRepository;
import com.snowthon.snowman.service.RegionService;
import com.snowthon.snowman.service.VoteHistoryService;
import io.swagger.v3.oas.annotations.Hidden;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -37,18 +39,32 @@ public ResponseDto<?> showWeatherInfo(
return ResponseDto.ok(regionService.getWeather(latitude, longitude));
}

/**
* TODO USERID
* @param regionId
* @param voteRequestDto
* @return
*/

//3-1 투표 여부 조회
@GetMapping("/{regionId}/poll")
@Operation(summary = "투표 여부 조회", description = "투표 여부를 조회합니다")
public ResponseDto<?> hasUserVoted(@UserId Long userId, @PathVariable Long regionId) {
public ResponseDto<?> hasUserVoted(@PathVariable Long regionId) {
Long userId = 1L;
return ResponseDto.ok(voteHistoryService.checkUserVoting(userId, regionId));
}

/**
* TODO USERID
* @param regionId
* @param voteRequestDto
* @return
*/
//3-2. 투표 하기
@PostMapping("/{regionId}/poll")
@Operation(summary = "투표 하기", description = "투표를 합니다.")
public ResponseDto<?> createVote(@UserId Long userId, @PathVariable Long regionId, @RequestBody VoteRequestDto voteRequestDto) {
public ResponseDto<?> createVote(@PathVariable Long regionId, @RequestBody VoteRequestDto voteRequestDto) {
Long userId = 1L;
voteHistoryService.createVote(regionId, voteRequestDto, userId);
return ResponseDto.ok(null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,23 @@ public class UserController {

private final UserService userService;

/**
* TODO USERID
* @param userId
* @return
*/
//4-1. 모아 보기
@GetMapping("/vote-history")
@Operation(summary = "아카이빙 모아보기", description = "유저의 투표 기록들을 가져옵니다")
public ResponseDto<?> archiving(@UserId Long userId) {
public ResponseDto<?> archiving() {
Long userId = 1L;
return ResponseDto.ok(userService.getVoteHistoriesByUser(userId));
}

//4-2. 모아 보기(상세)
@GetMapping("/vote-history/{voteHistoryId}")
@Operation(summary = "아카이빙 상세보기", description = "상세한 투표정보를 가져옵니다.")
public ResponseDto<?> archivingDetail(@PathVariable Long voteHistoryId) {

return ResponseDto.ok(userService.getVoteHistoryById(voteHistoryId));
}

Expand Down

0 comments on commit 60dc2db

Please sign in to comment.