Skip to content

Commit

Permalink
[FEAT] 과제제안 API 구현 (#129)
Browse files Browse the repository at this point in the history
* [FEAT] 과제 제안 API 개발 & 이메일 API 개발 (#68)

* [FEAT] Video 관련 API 개발 (#51)

* feat: talk 및 jobInterview 레포지토리 추가

* feat: jobInterview DTO 추가

* feat: add create and get jobinterview api

* feat: add update and delete jobinterview api

* fix: change BaseVideoEntity access level

* refactor: add new line in JobInterview Category

* refactor: change dto name

* fix: change string check annotation to NotBlank

* refactor: change category enum class name

* feat: add enum validator

* refactor: apply dto format discussed in PR #12

* fix: apply static factory method

* chore: remove superbuilder annotation in BaseTimeEntity

* chore: transactional 어노테이션 클래스로 이동

* chore: 엔티티 객체 생성 스타일 변경

* fix: pathVariable 명시

* fix: cascade 옵션 변경

* chore: dirty checking 사용하는 방법으로 update 변경

* feat: change exception to custom BadRequestException

* chore: 접근제어자 제거

* feat: 잡페어 인터뷰 생성 테스트코드 작성

* feat: add JobInterview create Testcode

* fix: ExceptionCode 추가 및 변경사항 대응

* feat: 잡페어 인터뷰 컨트롤러 테스트

* feat: 잡페어 인터뷰 RestDocs

* feat: create QuizRepository

* feat: add Talk Request/Response DTO

* feat: implement talkservice and add exception code

* feat: implement talkController

* feat: implement TalkControllerTest

* feat: implement TalkControllerTest

* feat: 대담영상 api 문서 작성

* feat: 퀴즈 포함 대담 API 구현

* fix: 대담 연관관계 업데이트 버그 수정

* feat: add talker belonging and name field in jobinterview entity

* feat: update jobinterview testcode

* chore: remove status header

* feat: remove HasQuiz And Apply JsonUnwrapped Annotation

* refactor: remove Talks(List) Response DTO

* feat: update TalkController TestCode

* chore: update Talk API Docs

* refactor: 엔티티에서 DTO 사용 제거

* feat: @authuser 적용 및 testcode 수정

* chore: add token to request cookie and header

* fix: change local.yml

* refactor: change video package location

* refactor: test code 패키지 변경

* fix: change db url in local.yml

* [FEAT] Notice/EventNotice 관련 API 개발 (#56)

* feat: Add Notice,EventNotice entity Superbuilder, setter for update

* feat: Implement NoticeDto Inner Static class

* feat: Implement NoticeRepository

* feat: Implement NoticeService interface, NoticeServiceImpl

* feat: Implement NoticeController

* fix: @NoArgsConstructor(access = PROTECTED) for entities

* fix: change url, dto (request) field, add validation

* fix: remove service interface

* fix: change exception to bad request exception

* feat: implement getNoticeList api, minor renaming controller parameter

* fix: move @transactional annotation

* fix: remove @DaTa annotation

* refactor: refactor package structure

* fix: split response, request dto

* fix: Use static factory method instead of builder pattern

* feat: change put/post to return entity value, change update logic (use repository), fix minor naming

* feat: Implement increasing hitCount when getNotice

* fix: change protect constructor of BaseNoticeEntity to use annotation

* fix: Revise static factory method to use `from`

* [FEAT] Global Exception, Test, Restdocs 설정 (#17)

* feat: validator exception handler, BadrequestException 추가

* feat: controller test 설정 추가

* feat: index.adoc 추가

* feat: request field 템플릿 추가

* refactor: request field snippet 들여쓰기 수정

* feat: exception logger 추가

* feat: Implement RestDocs, base test code for NoticeController, change exception

- cherry-pick develop branch's 0f55de6 commit
- only for create notice
- revise to use custom BadRequestException

* fix: Add cascade option in Notice Entity

* fix: Revise parameter naming for pathvariable annotaion

* fix: Fix wrong service method description

* feat: change updateNotice, increaseHitCount to use entity method

* feat: Implement attached files handling, add NoticeListElementResponse

* refactor: rename DTOs

* fix: Revise Notice/EventNotice entity to not inherit BaseNoticeEntity

* minor renaming variables

* feat: Implement Test code/RestDocs for NoticeController

* cherry-pick: revised custom exception code #21

* feat: add custom exceptions for notice, notnull annotation for fileIds field

* refactor: rename NoticeResponse fileReponses field to files

* fix: revise NoticeService to work with request with no fileIds field

* fix: refine controllerTest code for restDocs

* fix: add pageable parameter in controllerTest

* refactor: remove unnecessary annotation

* feat: duplicate notice api for eventNotice api

* refactor: reformat (clean) code

* fix: change exception code number to prevent conflict

* feat: implement fixed notices prioritization

* refactor: change :path to {path} in adoc

* refactor: refactor adoc files

* refactor: remove debugging line for getNoticeList

* feat: new logic for updateNotice file handling (using Cascade=ALL)

* cherrypick: auth commit from develop branch

* refactor: move domain package location

* feat: duplicate eventNotice getList, update code from Notice

* refactor: remove unused import statement

* feat: auth user (admin) for create, update, delete

* feat: revise test code for auth user

* fix: Typo correction

* fix: add application-local.yml for CI

* chore: remove unnecessary comments

* refactor: move notice/eventNotice controller test package

---------

Co-authored-by: yesjuhee <[email protected]>
Co-authored-by: chanyeong <[email protected]>

* [FEAT] EvnetPeriod 관련 API 구현 완료 (#58)

* feat: EventPeriod  리포지터리 생성

* feat: devtools 패키지 추가

* feat: 엔티티에 SupeBuilder 추가

* feat: EventPeriodDto 작성

* feat:EventPeriodController 구현

* feat: EventPeriodService 구현

* refactor: 사용 안하는 import 삭제

* feat: test configurations

* feat: EvnetPeriodController 테스트 코드 작성

* feat: createEventPeriod 테스트코드, restdocs 코드 구현

* feat: GlobalExceptionHandler 추가, validation 실패시 응답바디 포멧 수정

* fix: builder 제거, DTO 분리

* feat: 정적 팩토리 메서드 사용하는 방식으로 createEventPeriod 메서드 수정

* feat: BadRequestExcption 추가

* fix: DTO 구조 변경에 맞춰 테스트 수정

* fix: Bad Request 테스트 수정, 해당 테스트 restdocs에서 제외시킴

* feat: 커스텀 에러 코드를 사용하는 방식으로 Exception Handler 수정

* fix: dto validation에 대한 응답도 ExceptionCode를 사용하도록 수정

* refactor: EventPeriodRequest -> CreateEventPeriodRequest 로 변경

* feat: getEvnetPeriods api 구현

* feat: getEventPeriods API 테스트, restdocs 구현

* fix: gitignore에 static/docs 추가

* feat: deleteEventPeriod controller 작성

* refactor: 컨트롤러 refactor

* feat: deleteEventPeriod service 구현

* feat: deleteEventPeriod test

* refactor: MockMvcRequestBuilders -> RestDocumentationRequestBuilders 로 변경

* feat: restdocs 추가

* refactor: merge conflict resolve 생략된거 해결

* refactor: index.adoc 머지 오류 수정

* fix: 도메인에서 DTO 사용 제외

* fix: createEventPeriod 요청 형식, 로직 수정

* fix: EventPeriod 조회 API 수정(리스트 조회 -> 단건 조회)

* feat: deleteEventPeriod API 삭제, updateEventPeriod API 추가

* feat: Auth 설정 추가

* refactor: event 도메인 폴더 위치 변경

* fix: test, restdocs 수정

* fix: TEST Auth 설정 추가

* fix: getEventPeriods API 복구

* fix: application-local.yml 복구

* chore: 주석 삭제

* chor: 누락된 adoc 파일 추가

* chore: 제안 답변 엔티티 이름 변경

* feat: proposal controller 작성

* feat: proposal repository 작성

* feat: proposal dto 작성

* feat: async config 추가

* feat: controller 수정

* feat: mail 관련 설정추가

* feat: 비동기 mail sender 작성

* feat: proposal 관련 dto 작성

* feat: ProposalService 작성

* feat: mailSender 인터페이스 패턴으로 구성

* refactor: event 이름 변경

* fix: cascade 적요

* feat: getProposalReplies 작성

* feat: restDocs 작성

* feat: 과제 제안 답변 조회 api 작성

* feat: 과제 제안 컨트롤러 테스트코드 작성

* feat: 과제제안 응답에 reply 필드 추가

* feat: 권한 문제 수정 및 과제제안 필드 변경

* fix: 동일성 체크 문제 수정

* fix: 권한 필터조건 수정

* fix: 과제답변 관리자도 등록할수 있도록 수정

* feat: restDocs 세분화

---------

Co-authored-by: Hyunjun Yang <[email protected]>
Co-authored-by: hyzoon <[email protected]>
Co-authored-by: yesjuhee <[email protected]>

* fix: 불필요 권한 검증로직 삭제

* fix: 형상관리 복구

* fix: proposal file 관련 수정

* fix: proposal 관련 수정

* feat: 필터링 쿼리 queryDsl 적용

* feat: persistence test 작성

* chore: terms typo

* feat: 이메일 템플릿 작성

* chore: adoc update

* fix: 파일 지연로딩 문제 수정

* fix: adoc 형상관리복구

* fix: 머지 오류 수정

* docs: html 파일 새로 빌드해서 추가

---------

Co-authored-by: chanyeong <[email protected]>
Co-authored-by: Hyunjun Yang <[email protected]>
Co-authored-by: hyzoon <[email protected]>
Co-authored-by: chanyeong <[email protected]>
  • Loading branch information
5 people authored Nov 28, 2024
1 parent 0729132 commit a1660cc
Show file tree
Hide file tree
Showing 52 changed files with 20,985 additions and 15,919 deletions.
15 changes: 14 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,17 @@ dependencies {

// minIO
implementation "io.minio:minio:8.5.11"

// queryDSL
implementation 'com.querydsl:querydsl-core'
implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta'
annotationProcessor("com.querydsl:querydsl-apt:5.0.0:jakarta") // querydsl JPAAnnotationProcessor 사용 지정
annotationProcessor("jakarta.persistence:jakarta.persistence-api") // java.lang.NoClassDefFoundError(javax.annotation.Entity) 발생 대응
annotationProcessor("jakarta.annotation:jakarta.annotation-api") // java.lang.NoClassDefFoundError (javax.annotation.Generated) 발생 대응
}



tasks.named('test') {
outputs.dir snippetsDir
useJUnitPlatform()
Expand Down Expand Up @@ -109,4 +118,8 @@ allprojects {
repositories {
maven { url 'https://jitpack.io'}
}
}
}


def querydslDir = "build/generated/querydsl"

9 changes: 5 additions & 4 deletions src/docs/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ include::{snippets}/exception-code-controller-test/get-exception-codes/exception

include::auth-controller-test.adoc[]
include::file-controller-test.adoc[]
include::user.adoc[]
include::department.adoc[]
include::application.adoc[]
include::jobInterview.adoc[]
include::talk.adoc[]
include::quiz.adoc[]
include::notice.adoc[]
include::eventNotice.adoc[]
include::eventPeriod.adoc[]
include::gallery.adoc[]
include::application.adoc[]
include::inquiry.adoc[]
include::project.adoc[]
include::inquiry.adoc[]
include::proposal.adoc[]
include::aihub-controller-test.adoc[]
include::jobInfo-controller-test.adoc[]
include::user.adoc[]
include::department.adoc[]
56 changes: 56 additions & 0 deletions src/docs/asciidoc/proposal.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
== 과제 제안 API
:source-highlighter: highlightjs

=== 과제 제안 생성 (POST /proposals)

====
operation::proposal-controller-test/create-proposal[snippets="http-request,request-fields,http-response,response-fields"]
====

=== 과제 제안 리스트 조회 (GET /proposals)

====
operation::proposal-controller-test/get-proposals[snippets="query-parameters,http-request,http-response,response-fields"]
====

=== 과제 제안 상세 조회 (GET /proposals/{proposalId})

====
operation::proposal-controller-test/get-proposal-detail[snippets="path-parameters,http-request,http-response,response-fields"]
====

=== 과제 제안 수정 (PUT /proposals/{proposalId})

====
operation::proposal-controller-test/update-proposal[snippets="path-parameters,http-request,request-fields,http-response,response-fields"]
====

=== 과제 제안 삭제 (DELETE /proposals/{proposalId})

====
operation::proposal-controller-test/delete-proposal[snippets="path-parameters,http-request,http-response"]
====

=== 과제 제안 답변 조회 (GET /proposals/{proposalId}/reply)

====
operation::proposal-controller-test/get-proposal-replies[snippets="query-parameters,http-request,http-response,response-fields"]
====

=== 과제 제안 답변 생성 (PUT /proposals/{proposalId}/reply/)

====
operation::proposal-controller-test/create-proposal-reply[snippets="path-parameters,http-request,request-fields,http-response,response-fields"]
====

=== 과제 제안 답변 수정 (PUT /proposals/{proposalId}/reply/{replyId})

====
operation::proposal-controller-test/update-proposal-reply[snippets="path-parameters,http-request,request-fields,http-response,response-fields"]
====

=== 과제 제안 답변 삭제 (DELETE /proposals/{proposalId}/reply/{replyId})

====
operation::proposal-controller-test/delete-proposal-reply[snippets="path-parameters,http-request,http-response"]
====
62 changes: 0 additions & 62 deletions src/main/java/com/scg/stop/domain/proposal/domain/Proposal.java

This file was deleted.

This file was deleted.

This file was deleted.

4 changes: 4 additions & 0 deletions src/main/java/com/scg/stop/file/domain/File.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.scg.stop.notice.domain.Notice;
import com.scg.stop.event.domain.EventNotice;
import com.scg.stop.global.domain.BaseTimeEntity;
import com.scg.stop.proposal.domain.Proposal;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
Expand Down Expand Up @@ -47,6 +48,9 @@ public class File extends BaseTimeEntity {
@JoinColumn(name = "gallery_id")
private Gallery gallery;

@ManyToOne(fetch = LAZY)
@JoinColumn(name = "proposal_id")
private Proposal proposal;
static public File of(String uuid, String name, String mimeType) {
File file = new File();
file.uuid = uuid;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.scg.stop.gallery.service;

import static com.scg.stop.global.exception.ExceptionCode.NOT_FOUND_FILE_ID;
import static com.scg.stop.global.exception.ExceptionCode.FILE_NOT_FOUND;
import static com.scg.stop.global.exception.ExceptionCode.NOT_FOUND_GALLERY_ID;

import com.scg.stop.file.domain.File;
Expand Down Expand Up @@ -29,7 +29,7 @@ public class GalleryService {
public GalleryResponse createGallery(GalleryRequest request) {
List<File> files = fileRepository.findByIdIn(request.getFileIds());
if (files.size() != request.getFileIds().size()) {
throw new BadRequestException(NOT_FOUND_FILE_ID);
throw new BadRequestException(FILE_NOT_FOUND);
}

Gallery gallery = Gallery.of(request.getTitle(), request.getYear(), request.getMonth(), files);
Expand Down Expand Up @@ -59,7 +59,7 @@ public GalleryResponse updateGallery(Long galleryId, GalleryRequest request) {

List<File> files = fileRepository.findByIdIn(request.getFileIds());
if (files.size() != request.getFileIds().size()) {
throw new BadRequestException(NOT_FOUND_FILE_ID);
throw new BadRequestException(FILE_NOT_FOUND);
}

gallery.update(request.getTitle(), request.getYear(), request.getMonth(), files);
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/com/scg/stop/global/config/QueryDslConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.scg.stop.global.config;

import com.querydsl.jpa.impl.JPAQueryFactory;
import jakarta.persistence.EntityManager;
import jakarta.persistence.PersistenceContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class QueryDslConfig {

@PersistenceContext
private EntityManager entityManager;
@Bean
public JPAQueryFactory queryFactory() {
return new JPAQueryFactory(entityManager);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ public void listen(EmailEvent event) {
log.debug("TransactionalEmailSend Error: {}", e.toString());
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
package com.scg.stop.global.exception;

import lombok.Getter;

@Getter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,12 @@ public enum ExceptionCode {
NOT_COMPATIBLE_EXCEL(71001, "엑셀 파일이 주어진 클래스와 호환되지 않습니다."),

// gallery domain
NOT_FOUND_GALLERY_ID(9001, "요청한 ID에 해당하는 갤러리가 존재하지 않습니다.");
NOT_FOUND_GALLERY_ID(9001, "요청한 ID에 해당하는 갤러리가 존재하지 않습니다."),

// proposal domain
NOT_FOUND_PROPOSAL(6000, "요청한 ID에 해당하는 과제제안이 존재하지 않습니다."),
NOT_FOUND_PROPOSALREPLY(6001, "요청한 ID에 해당하는 과제제안 답변이 존재하지 않습니다.");

private final int code;
private final String message;
}
}
2 changes: 1 addition & 1 deletion src/main/java/com/scg/stop/project/domain/Member.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ public class Member extends BaseTimeEntity {
@ManyToOne(fetch = LAZY)
@JoinColumn(name = "project_id")
private Project project;
}
}
Loading

0 comments on commit a1660cc

Please sign in to comment.