Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
NEWSPRINGISGOOD committed Jan 16, 2024
1 parent 88ef35e commit 305ed92
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
Expand All @@ -19,7 +18,6 @@
import java.util.Map;

@RestController
@PreAuthorize("hasAnyRole('ROLE_ADMIN','ROLE_CERTIFIED','ROLE_USER')")
@RequestMapping("/app/category")
public class CategoryController {
private final CategoryService categoryService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.util.Map;

@RestController
@PreAuthorize("hasAnyRole('ROLE_ADMIN','ROLE_CERTIFIED','ROLE_USER')")
@RequestMapping("app/member")
@RequiredArgsConstructor
@Slf4j
Expand Down Expand Up @@ -182,7 +181,6 @@ public BaseResponse<?> test() {
log.info(email);
return new BaseResponse<>(BaseResponseStatus.SUCCESS, "굿");
}

@PostMapping("clear")
public BaseResponse<?> clearing() throws IOException {
univCert.list(mail_api_key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@

import com.umc.StudyFlexBE.config.jwt.JwtTokenProvider;
import com.umc.StudyFlexBE.dto.request.NaverDto;
import com.umc.StudyFlexBE.dto.response.APICallException;
import com.umc.StudyFlexBE.dto.response.BaseResponse;
import com.umc.StudyFlexBE.dto.response.BaseResponseStatus;
import com.umc.StudyFlexBE.dto.response.InvalidAuthorizationCodeException;
import com.umc.StudyFlexBE.dto.response.LoginRes;
import com.umc.StudyFlexBE.dto.response.*;
import com.umc.StudyFlexBE.entity.Member;
import com.umc.StudyFlexBE.entity.MsgEntity;
import com.umc.StudyFlexBE.service.NaverService;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
Expand All @@ -28,7 +23,6 @@

@RequiredArgsConstructor
@RestController
@PreAuthorize("hasAnyRole('ROLE_ADMIN','ROLE_CERTIFIED','ROLE_USER')")
@RequestMapping("/app/naver")
public class NaverController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
Expand All @@ -17,7 +16,6 @@
import java.util.Map;

@RestController
@PreAuthorize("hasAnyRole('ROLE_ADMIN','ROLE_CERTIFIED','ROLE_USER')")
@RequestMapping("/app/search")
public class SearchController {
private final SearchService searchService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import java.util.Map;

@RestController
@PreAuthorize("hasAnyRole('ROLE_USER','ROLE_ADMIN','ROLE_CERTIFIED')")
@RequestMapping("/app/studies")
public class StudyController {
private final StudyService studyService;
Expand All @@ -27,6 +26,7 @@ public StudyController(StudyService studyService) {
}

@PostMapping
@PreAuthorize("hasAnyRole('ROLE_USER','ROLE_ADMIN','ROLE_CERTIFIED')")
public BaseResponse<?> createStudy(@ModelAttribute StudyReq study){
try {
StudyRes studyRes = studyService.createStudy(study, getEmail());
Expand All @@ -37,6 +37,7 @@ public BaseResponse<?> createStudy(@ModelAttribute StudyReq study){
}

@GetMapping("/checkName")
@PreAuthorize("hasAnyRole('ROLE_USER','ROLE_ADMIN','ROLE_CERTIFIED')")
public BaseResponse<?> checkDuplicateStudyName(@RequestParam String study_name){
try {
studyService.checkDuplicateStudyName(study_name);
Expand All @@ -47,6 +48,7 @@ public BaseResponse<?> checkDuplicateStudyName(@RequestParam String study_name){
}

@GetMapping("/{study_id}/checkAuthority")
@PreAuthorize("hasAnyRole('ROLE_USER','ROLE_ADMIN','ROLE_CERTIFIED')")
public BaseResponse<?> checkAuthority(@PathVariable Long study_id){
try{
StudyAuthorityType studyAuthorityType = studyService.checkAuthority(study_id, getEmail());
Expand All @@ -57,6 +59,7 @@ public BaseResponse<?> checkAuthority(@PathVariable Long study_id){
}

@PostMapping("/{study_id}/participation")
@PreAuthorize("hasAnyRole('ROLE_USER','ROLE_ADMIN','ROLE_CERTIFIED')")
public BaseResponse<?> participation(@PathVariable Long study_id){
try {
StudyParticipationRes res = StudyParticipationRes.builder()
Expand All @@ -67,6 +70,8 @@ public BaseResponse<?> participation(@PathVariable Long study_id){
return new BaseResponse<>(e.getStatus());
}
}

// 아래 3개는 메인 페이지에 위치하기 때문에 회원가입 안 한 사람도 볼 수 있도록
@GetMapping("/latest")
public BaseResponse<?> getLatestStudies() {
try {
Expand Down Expand Up @@ -98,6 +103,7 @@ public BaseResponse<?> getStudyRanking() {
}

@PostMapping("/{study_id}/postNotice")
@PreAuthorize("hasAnyRole('ROLE_USER','ROLE_ADMIN','ROLE_CERTIFIED')")
public BaseResponse<?> postStudyNotice(
@PathVariable Long study_id,
@RequestBody @Valid StudyNoticeReq studyNoticeReq){
Expand All @@ -110,6 +116,7 @@ public BaseResponse<?> postStudyNotice(
}

@GetMapping("/{study_id}/notice/{notice_id}")
@PreAuthorize("hasAnyRole('ROLE_USER','ROLE_ADMIN','ROLE_CERTIFIED')")
public BaseResponse<?> getStudyNotice(@PathVariable Long study_id, @PathVariable Long notice_id){
try {
StudyNoticeRes studyNotice = studyService.getStudyNotice(study_id, notice_id, getEmail());
Expand All @@ -120,6 +127,7 @@ public BaseResponse<?> getStudyNotice(@PathVariable Long study_id, @PathVariable
}

@DeleteMapping("/{study_id}/notice/{notice_id}")
@PreAuthorize("hasAnyRole('ROLE_USER','ROLE_ADMIN','ROLE_CERTIFIED')")
public BaseResponse<?> deleteStudyNotice(@PathVariable Long study_id, @PathVariable Long notice_id){
try {
studyService.deleteStudyNotice(study_id, notice_id, getEmail());
Expand All @@ -130,6 +138,7 @@ public BaseResponse<?> deleteStudyNotice(@PathVariable Long study_id, @PathVaria
}

@GetMapping("/{study_id}/notice")
@PreAuthorize("hasAnyRole('ROLE_USER','ROLE_ADMIN','ROLE_CERTIFIED')")
public BaseResponse<?> getStudyNotices(@PathVariable Long study_id){
try {
StudyNoticesInfoRes studyNotices = studyService.getStudyNotices(study_id, getEmail());
Expand All @@ -140,6 +149,7 @@ public BaseResponse<?> getStudyNotices(@PathVariable Long study_id){
}

@GetMapping("/{study_id}/completed")
@PreAuthorize("hasAnyRole('ROLE_USER','ROLE_ADMIN','ROLE_CERTIFIED')")
public BaseResponse<?> checkCompletedStudyWeek(@PathVariable Long study_id, @RequestParam int week){
try {
ProgressRes progressReq = studyService.checkCompletedStudyWeek(study_id, week, getEmail());
Expand All @@ -150,6 +160,7 @@ public BaseResponse<?> checkCompletedStudyWeek(@PathVariable Long study_id, @Req
}

@GetMapping("/{study_id}/progress")
@PreAuthorize("hasAnyRole('ROLE_USER','ROLE_ADMIN','ROLE_CERTIFIED')")
public BaseResponse<?> getStudyProgressList(@PathVariable Long study_id){
try {
Map<String, Object> studyProgressList = studyService.getStudyProgressList(study_id, getEmail());
Expand All @@ -160,6 +171,7 @@ public BaseResponse<?> getStudyProgressList(@PathVariable Long study_id){
}

@GetMapping("/{study_id}/details")
@PreAuthorize("hasAnyRole('ROLE_USER','ROLE_ADMIN','ROLE_CERTIFIED')")
public BaseResponse<?> getStudyDetail(@PathVariable Long study_id){
try {
StudyDetailRes studyDetail = studyService.getStudyDetail(study_id);
Expand Down

0 comments on commit 305ed92

Please sign in to comment.