Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature/Inhabas#228] 공모전 게시판 API 구현 #230

Merged
merged 50 commits into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
165e2d9
[feature/Inhabas#228] VO 일부 수정 및 컬럼,테이블 이름 수정
skytin1004 Jan 30, 2024
39e7d7f
[feature/Inhabas#228] VO 구현 및 DTO 변수 일부 수정
skytin1004 Jan 31, 2024
d55f23f
[feature/Inhabas#228] VO 구현
skytin1004 Feb 1, 2024
e4ef474
[feature/Inhabas#228] DTO, Service 구현
skytin1004 Feb 2, 2024
29356e2
[feature/Inhabas#228] Service 오타 수정
skytin1004 Feb 5, 2024
e4efb66
[feature/Inhabas#228] Service 오타 수정
skytin1004 Feb 5, 2024
4acbd63
[feature/Inhabas#228] 공모전 게시판 검색 기능 추가
skytin1004 Feb 5, 2024
08272f7
[feature/Inhabas#228] 공모전 게시판 검색 기능 추가
skytin1004 Feb 5, 2024
cb8ac5c
[feature/Inhabas#228] 공모전 게시판 검색 repositoryImpl로직 변경 및 serviceImpl 구현
skytin1004 Feb 6, 2024
889dc40
[feature/Inhabas#228] 공모전 게시판 검색 관련 DTO 수정, association 추가
skytin1004 Feb 6, 2024
83a7e95
[feature/Inhabas#228] 공모전 게시판 DTO D-Day 추가
skytin1004 Feb 6, 2024
2abf0b4
Merge branch 'InhaBas:master' into contest-board
skytin1004 Feb 7, 2024
cbea217
[feature/Inhabas#228] 공모전 게시판 파일 URI 저장방식 갱신, ContestType에 따른 게시판 분리 …
skytin1004 Feb 7, 2024
f722f29
[feature/Inhabas#228] ContestType 컨버터 구현, Controller 수정
skytin1004 Feb 8, 2024
e78ab14
[feature/Inhabas#228] Controller response 정리
skytin1004 Feb 8, 2024
a956460
[feature/Inhabas#228] Controller 오타 수정
skytin1004 Feb 8, 2024
69200ae
[feature/Inhabas#228] 불필요한 코드 삭제
skytin1004 Feb 13, 2024
b8ee27e
[feature/Inhabas#228] Image파일 보장
skytin1004 Feb 13, 2024
462c90d
[feature/Inhabas#228] 예외 처리 ErrorCode 사용
skytin1004 Feb 13, 2024
9fdc3a8
[feature/Inhabas#228] 세부 필터링 구현
skytin1004 Feb 15, 2024
bc22526
[feature/Inhabas#228] 공모전 정렬 기능 수정
skytin1004 Feb 15, 2024
1ee68ca
[feature/Inhabas#228] spotlessApply
skytin1004 Feb 15, 2024
c6115ca
[feature/Inhabas#228] 공모전 게시판 구현 완료
skytin1004 Feb 16, 2024
5e822d3
[feature/Inhabas#228] 공모전 게시판 구현 완료 - 리펙토링
skytin1004 Feb 16, 2024
78ff80e
[feature/Inhabas#228] 타입 문제 해결
skytin1004 Feb 16, 2024
a5cbe27
[feature/Inhabas#228] 썸네일, 이미지, 기타 파일 분류 완료
skytin1004 Feb 16, 2024
f72de2b
[feature/Inhabas#228] 분류 기능 리펙토링
skytin1004 Feb 16, 2024
f72cbcc
[feature/Inhabas#228] domain 테스트 파일 생성
skytin1004 Feb 17, 2024
0911dd2
[feature/Inhabas#228] 테이블 수정에 따른 컬럼 이름 및 조건 수정
skytin1004 Feb 17, 2024
04ef87d
[feature/Inhabas#228] contest 유틸 클래스 global 이동 및 리펙토링
skytin1004 Feb 19, 2024
38792c3
[feature/Inhabas#228] 공모전 게시판 정렬 기능 구현 완료
skytin1004 Feb 19, 2024
cfca94a
[feature/Inhabas#228] 공모전 게시판 정렬 기능 controller 리펙토링
skytin1004 Feb 19, 2024
7256e24
[feature/Inhabas#228] 공모전 게시판 도메인 테스트 코드 구현
skytin1004 Feb 19, 2024
7b2f41d
Merge branch 'master' of https://github.com/skytin1004/Inhabas.com-ap…
skytin1004 Feb 20, 2024
6950a35
[feature/Inhabas#234] 충돌 해결
skytin1004 Feb 21, 2024
d27c6c7
[feature/Inhabas#234] 충돌 해결
skytin1004 Feb 21, 2024
b43e0fe
Merge branch 'master' of https://github.com/skytin1004/Inhabas.com-ap…
skytin1004 Feb 21, 2024
db74a33
[feature/Inhabas#234] 충돌 해결
skytin1004 Feb 21, 2024
1426dd5
[feature/Inhabas#234] 최근 커밋 반영ㅇ
skytin1004 Feb 21, 2024
9747ad1
[feature/Inhabas#234] 서비스 테스트 코드 구현 및 리펙토링
skytin1004 Feb 22, 2024
51c8209
[feature/Inhabas#234] 서비스 및 레포지토리 테스트 코드 오류 해결중..
skytin1004 Feb 22, 2024
4effd25
[feature/Inhabas#234] service, repository 테스트 구현 완료ㅛ
skytin1004 Feb 23, 2024
f7e27d8
[feature/Inhabas#234] controller 테스트 구현 완료
skytin1004 Feb 24, 2024
9c97aa4
[feature/Inhabas#234] 공모전 게시판 config 구현
skytin1004 Feb 24, 2024
277c02a
[feature/Inhabas#234] requestPart 개선
skytin1004 Feb 24, 2024
5d7c35b
[feature/Inhabas#234] requestPart 문제 해결, 모든 테스트 구현
skytin1004 Feb 26, 2024
e9067db
[feature/Inhabas#234] spotleaaApply
skytin1004 Feb 26, 2024
3158f12
[feature/Inhabas#234] 리뷰 반영
skytin1004 Feb 26, 2024
240b1d9
[feature/Inhabas#234] 리뷰 반영
skytin1004 Feb 26, 2024
0b305dc
[feature/Inhabas#234] 리펙토링, 공모전 게시판 구현
skytin1004 Mar 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,38 +1,50 @@
package com.inhabas.api.domain.contest.domain;

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.Table;

import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

import com.inhabas.api.domain.board.domain.NormalBoard;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import com.inhabas.api.domain.board.domain.BaseBoard;
import com.inhabas.api.domain.board.domain.valueObject.Content;
import com.inhabas.api.domain.board.domain.valueObject.Title;
import com.inhabas.api.domain.contest.domain.valueObject.Association;
import com.inhabas.api.domain.contest.domain.valueObject.Topic;
import com.inhabas.api.domain.file.domain.BoardFile;

@Entity
@Table(name = "contest_board")
@Table(name = "CONTEST")
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class ContestBoard extends NormalBoard {
@EntityListeners(AuditingEntityListener.class)
@DiscriminatorValue("CONTEST")
public class ContestBoard extends BaseBoard {

@Embedded private Topic topic;

@Embedded private Association association;

@Column private LocalDate start;
@Embedded private Content content;

@Column(name = "DATE_CONTEST_START", nullable = false)
private LocalDate dateContestStart;

@Column private LocalDate deadline;
@Column(name = "DATE_CONTEST_END", nullable = false)
private LocalDate dateContestEnd;
skytin1004 marked this conversation as resolved.
Show resolved Hide resolved

/* Getter */
public String getAssociation() {
return association.getValue();
}
Expand All @@ -41,32 +53,55 @@ public String getTopic() {
return topic.getValue();
}

/* Constructor */
public String getContent() {
return content.getValue();
}

@Builder
public ContestBoard(
String title,
String contents,
String content,
String association,
String topic,
LocalDate start,
LocalDate deadline) {
LocalDate dateContestStart,
LocalDate dateContestEnd) {

this.title = new Title(title);
this.content = new Content(contents);
this.content = new Content(content);
this.association = new Association(association);
this.topic = new Topic(topic);
this.start = start;
this.deadline = deadline;
this.dateContestStart = dateContestStart;
this.dateContestEnd = dateContestEnd;
}

// 첨부파일 수정
public void updateFiles(List<BoardFile> files) {

if (this.files != null) {
this.files.clear();
} else {
this.files = new ArrayList<>();
}

for (BoardFile file : files) {
addFile(file);
}
}

// public void modify(String title, String contents, String association, String topic,
// LocalDate start, LocalDate deadline, StudentId loginMember) {
//
// super.modify(title, contents, loginMember);
// this.association = new Association(association);
// this.topic = new Topic(topic);
// this.start = start;
// this.deadline = deadline;
// }
// 공모전 정보 수정
public void updateContest(
String title,
String content,
String association,
String topic,
LocalDate dateContestStart,
LocalDate dateContestEnd) {

this.title = new Title(title);
this.content = new Content(content);
this.association = new Association(association);
this.topic = new Topic(topic);
this.dateContestStart = dateContestStart;
this.dateContestEnd = dateContestEnd;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@Embeddable
public class Association {

@Column(name = "association", length = 100, nullable = false)
@Column(name = "ASSO", length = 100, nullable = false)
private String value;

@Transient private final int MAX_LENGTH = 100;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

@Embeddable
public class Topic {
@Column(name = "topic", length = 500, nullable = false)
@Column(name = "TOPIC", length = 500, nullable = false)
private String value;

@Transient private final int MAX_LENGTH = 500;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package com.inhabas.api.domain.contest.dto;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;

import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.inhabas.api.domain.file.dto.FileDownloadDto;
import io.swagger.v3.oas.annotations.media.Schema;

// 공모전 게시판 단일 조회
@Getter
@NoArgsConstructor
public class ContestBoardDetailDto {

@NotNull @Positive private Long id;

@NotBlank private String title;

@NotBlank private String content;

@NotBlank private String writerName;

@NotBlank private String association;

@NotBlank private String topic;

@NotNull private List<FileDownloadDto> files;

@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
private LocalDate dateContestStart;

@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
private LocalDate dateContestEnd;

@NotNull
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss")
@Schema(type = "string", example = "2024-11-01T00:00:00")
private LocalDateTime dateCreated;

@NotNull
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss")
@Schema(type = "string", example = "2024-11-01T00:00:00")
private LocalDateTime dateUpdated;

@Builder
public ContestBoardDetailDto(
Long id,
String title,
String content,
String writerName,
String association,
String topic,
LocalDate dateContestStart,
LocalDate dateContestEnd,
LocalDateTime dateCreated,
LocalDateTime dateUpdated,
List<FileDownloadDto> files) {
this.id = id;
Copy link
Member Author

@skytin1004 skytin1004 Feb 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

공모전 게시판 단일 조회에서 단순히 첨부파일을 썸네일, 이미지, 기타 파일로 분류(위치 이동함 - 아래 댓글 참고)

this.title = title;
this.content = content;
this.writerName = writerName;
this.association = association;
this.topic = topic;
this.dateContestStart = dateContestStart;
this.dateContestEnd = dateContestEnd;
this.dateCreated = dateCreated;
this.dateUpdated = dateUpdated;
this.files = files;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.inhabas.api.domain.contest.dto;

import java.time.LocalDate;

import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.inhabas.api.domain.file.dto.FileDownloadDto;

// 공모전 게시판 전체 조회
@Getter
@NoArgsConstructor
public class ContestBoardDto {
// 공모전 게시판 id
private Long id;
private String title;
private String topic;

@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
private LocalDate dateContestStart;

@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
private LocalDate dateContestEnd;

private FileDownloadDto thumbnail;

@Builder
public ContestBoardDto(
Long id,
String title,
String topic,
LocalDate dateContestStart,
LocalDate dateContestEnd,
FileDownloadDto thumbnail) {
this.id = id;
this.title = title;
this.topic = topic;
this.dateContestStart = dateContestStart;
this.dateContestEnd = dateContestEnd;
this.thumbnail = thumbnail;
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
package com.inhabas.api.domain.contest.dto;

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

import javax.validation.constraints.Future;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

import org.springframework.web.multipart.MultipartFile;

import org.hibernate.validator.constraints.Length;

// 공모전 게시판 글 업데이트 및 저장
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
public class SaveContestBoardDto {

@NotBlank(message = "제목을 입력하세요.")
@Length(max = 100, message = "제목은 최대 100자입니다.")
private String title;

@NotBlank(message = "본문을 입력하세요.")
private String contents;
private String content;

@Length(max = 100, message = "100자 이내로 작성해주세요.")
@NotBlank(message = "협회기관을 입력하세요.")
Expand All @@ -34,9 +38,29 @@ public class SaveContestBoardDto {
private String topic;

@NotNull(message = "공모전 모집 시작일을 등록해주세요.")
private LocalDate start;
private LocalDate dateContestStart;

@NotNull(message = "공모전 모집 마감일을 등록해주세요.")
@Future(message = "이미 모집기간이 종료된 공모전은 등록할 수 없습니다.")
private LocalDate deadline;
private LocalDate dateContestEnd;

private List<MultipartFile> files;

@Builder
public SaveContestBoardDto(
String title,
String content,
String association,
String topic,
LocalDate dateContestStart,
LocalDate dateContestEnd,
List<MultipartFile> files) {
this.title = title;
this.content = content;
this.association = association;
this.topic = topic;
this.dateContestStart = dateContestStart;
this.dateContestEnd = dateContestEnd;
this.files = (files != null) ? files : new ArrayList<>();
}
}
Loading
Loading