Skip to content

Commit

Permalink
update :: API 접근 권한 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
ori0o0p committed Aug 8, 2024
1 parent 457d23a commit 4ed6727
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import com.example.whopper.domain.document.dto.response.FullDocumentResponse;
import com.example.whopper.domain.document.dto.response.ReleasedDocumentResponse;
import com.example.whopper.domain.document.dto.response.SearchDocumentResponse;
import com.example.whopper.global.annotation.OnlyStudent;
import com.example.whopper.global.annotation.OnlyTeacher;
import com.example.whopper.global.utils.DataResponseInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
Expand All @@ -30,30 +32,35 @@ public class DocumentController {
private final ReleaseDocumentUseCase releaseDocumentUseCase;
private final CancelReleaseDocumentUseCase cancelReleaseDocumentUseCase;

@OnlyTeacher
@ResponseStatus(HttpStatus.NO_CONTENT)
@PostMapping("/release/{documentId}")
public void release(@PathVariable String documentId) {
releaseDocumentUseCase.release(documentId);
}

@OnlyTeacher
@ResponseStatus(HttpStatus.NO_CONTENT)
@PostMapping("/release/cancel/{documentId}")
public void cancelRelease(@PathVariable String documentId) {
cancelReleaseDocumentUseCase.cancel(documentId);
}

@OnlyStudent
@ResponseStatus(HttpStatus.NO_CONTENT)
@PatchMapping("/submit")
public void submit() {
submitMyDocumentUseCase.submit();
}

@OnlyStudent
@ResponseStatus(HttpStatus.NO_CONTENT)
@PatchMapping("/submit/cancel")
public void cancelSubmit() {
cancelSubmitMyDocumentUseCase.cancel();
}

@OnlyTeacher
@GetMapping("/student")
public DataResponseInfo<SearchDocumentResponse> search(@ModelAttribute SearchDocumentRequest request) {
return findDocumentUseCase.searchDocument(request);
Expand All @@ -69,50 +76,59 @@ public FullDocumentResponse findReleasedDocument(@PathVariable String documentId
return findDocumentUseCase.findReleasedDocument(documentId);
}

@OnlyTeacher
@GetMapping("/student/{documentId}")
public FullDocumentResponse getSubmittedDocument(@PathVariable String documentId) {
return findDocumentUseCase.getSubmittedDocument(documentId);
}

@OnlyStudent
@GetMapping("/completion")
public CompletionElementLevel getCompletionLevel() {
return findDocumentUseCase.getCurrentStudentDocumentCompletionLevel();
}

@OnlyStudent
@GetMapping
public DocumentResponse getIntroduceRecentlySharedDocuments() {
return findDocumentUseCase.getIntroduceRecentlySharedDocuments();
}

@OnlyStudent
@GetMapping("/detail")
public FullDocumentResponse getCurrentDocument() {
return findDocumentUseCase.getCurrentStudentDocument();
}

@OnlyStudent
@ResponseStatus(HttpStatus.NO_CONTENT)
@PatchMapping("/writer-info")
public void updateWriterInfo(@RequestBody UpdateWriterInfoRequest request) {
updateWriterInfoUseCase.update(request);
}

@OnlyStudent
@ResponseStatus(HttpStatus.NO_CONTENT)
@PatchMapping("/introduce")
public void updateIntroduce(@RequestBody IntroduceElement request) {
updateIntroduceUseCase.update(request);
}

@OnlyStudent
@ResponseStatus(HttpStatus.NO_CONTENT)
@PatchMapping("/project")
public void updateProjectList(@RequestPart("projectList") UpdateListRequest<ProjectElement> request) {
updateProjectListUseCase.update(request.list());
}

@OnlyStudent
@ResponseStatus(HttpStatus.NO_CONTENT)
@PatchMapping("/achievement")
public void updateAchievementList(@RequestBody UpdateListRequest<AchievementElement> request) {
updateAchievementListUseCase.update(request.list());
}

@OnlyStudent
@ResponseStatus(HttpStatus.NO_CONTENT)
@PatchMapping("/activity")
public void updateActivityList(@RequestBody UpdateListRequest<ActivityElement> request) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.example.whopper.domain.feedback.application.usecase.UpdateFeedbackUseCase;
import com.example.whopper.domain.feedback.dto.DeleteFeedbackRequest;
import com.example.whopper.domain.feedback.dto.FeedbackRequest;
import com.example.whopper.global.annotation.OnlyTeacher;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PatchMapping;
Expand All @@ -23,16 +24,19 @@ public class FeedbackController {

private final DeleteFeedbackUseCase deleteFeedbackUseCase;

@OnlyTeacher
@PostMapping
public void addFeedback(FeedbackRequest request) {
addFeedbackUseCase.addFeedback(request);
}

@OnlyTeacher
@PatchMapping
public void updateFeedback(FeedbackRequest request) {
updateFeedbackUseCase.updateFeedback(request);
}

@OnlyTeacher
@DeleteMapping
public void deleteFeedback(DeleteFeedbackRequest request) {
deleteFeedbackUseCase.deleteFeedback(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.example.whopper.domain.file.application.usecase.SaveImageUseCase;
import com.example.whopper.domain.file.dto.response.ImagePathResponse;
import com.example.whopper.domain.file.type.ImageType;
import com.example.whopper.global.annotation.OnlyStudent;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
Expand All @@ -19,6 +20,7 @@ public class FileController {

private final SaveImageUseCase saveImageUseCase;

@OnlyStudent
@PostMapping(value = "/image", consumes = {
MediaType.MULTIPART_FORM_DATA_VALUE
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.example.whopper.domain.major.application.usecase.DeleteMajorUseCase;
import com.example.whopper.domain.major.application.usecase.FindMajorUseCase;
import com.example.whopper.domain.major.domain.MajorEntity;
import com.example.whopper.global.annotation.OnlyTeacher;
import com.example.whopper.global.utils.DataResponseInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
Expand All @@ -18,6 +19,7 @@ public class MajorController {
private final FindMajorUseCase findMajorUseCase;
private final DeleteMajorUseCase deleteMajorUseCase;

@OnlyTeacher
@PostMapping
public void add(@RequestBody AddMajorRequest request) {
addMajorUseCase.add(request.majors());
Expand All @@ -28,6 +30,7 @@ public DataResponseInfo<MajorEntity> findAll() {
return findMajorUseCase.findAll();
}

@OnlyTeacher
@DeleteMapping("/{majorId}")
public void delete(@PathVariable String majorId) {
deleteMajorUseCase.delete(majorId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.example.whopper.domain.student.application.usecase.GetCurrentUserInfoUseCase;
import com.example.whopper.domain.student.dto.GetCurrentUserInfoResponse;
import com.example.whopper.global.annotation.OnlyStudent;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
Expand All @@ -12,7 +13,8 @@
@RequiredArgsConstructor
public class StudentController {
private final GetCurrentUserInfoUseCase getCurrentUserInfoUseCase;


@OnlyStudent
@GetMapping("/current/info")
public GetCurrentUserInfoResponse getCurrentUserInfoResponse() {
return getCurrentUserInfoUseCase.get();
Expand Down

0 comments on commit 4ed6727

Please sign in to comment.