-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feature/Inhabas#228] 공모전 게시판 API 구현
[feature/Inhabas#228] 공모전 게시판 API 구현
- Loading branch information
Showing
43 changed files
with
2,432 additions
and
950 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
resource-server/src/main/java/com/inhabas/api/domain/contest/domain/ContestField.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.inhabas.api.domain.contest.domain; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.Embedded; | ||
import javax.persistence.Entity; | ||
import javax.persistence.EntityListeners; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.Table; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
import com.inhabas.api.domain.BaseEntity; | ||
import com.inhabas.api.domain.contest.domain.valueObject.ContestFieldName; | ||
|
||
@Entity | ||
@Table(name = "CONTEST_FIELD") | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@EntityListeners(AuditingEntityListener.class) | ||
public class ContestField extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "ID") | ||
private Long id; | ||
|
||
@Embedded private ContestFieldName name; | ||
|
||
@Builder | ||
public ContestField(String name) { | ||
this.name = new ContestFieldName(name); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...ver/src/main/java/com/inhabas/api/domain/contest/domain/valueObject/ContestFieldName.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.inhabas.api.domain.contest.domain.valueObject; | ||
|
||
import java.util.Objects; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.Embeddable; | ||
import javax.persistence.Transient; | ||
|
||
import com.inhabas.api.auth.domain.error.businessException.InvalidInputException; | ||
|
||
@Embeddable | ||
public class ContestFieldName { | ||
|
||
@Column(name = "NAME", length = 15, nullable = false) | ||
private String value; | ||
|
||
@Transient private final int MAX_LENGTH = 15; | ||
|
||
public ContestFieldName() {} | ||
|
||
public ContestFieldName(String value) { | ||
if (validate(value)) this.value = value; | ||
else throw new InvalidInputException(); | ||
} | ||
|
||
private boolean validate(Object value) { | ||
if (Objects.isNull(value)) return false; | ||
if (!(value instanceof String)) return false; | ||
|
||
String o = (String) value; | ||
if (o.isBlank()) return false; | ||
return o.length() < MAX_LENGTH; | ||
} | ||
|
||
public String getValue() { | ||
return value; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...e-server/src/main/java/com/inhabas/api/domain/contest/domain/valueObject/ContestType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.inhabas.api.domain.contest.domain.valueObject; | ||
|
||
public enum ContestType { | ||
CONTEST("contest", 18), | ||
ACTIVITY("activity", 19); | ||
|
||
private final String boardType; | ||
private final int menuId; | ||
|
||
ContestType(String boardType, int menuId) { | ||
this.boardType = boardType; | ||
this.menuId = menuId; | ||
} | ||
|
||
public String getBoardType() { | ||
return boardType; | ||
} | ||
|
||
public int getMenuId() { | ||
return menuId; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
resource-server/src/main/java/com/inhabas/api/domain/contest/domain/valueObject/OrderBy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.inhabas.api.domain.contest.domain.valueObject; | ||
|
||
import com.inhabas.api.domain.contest.domain.QContestBoard; | ||
import com.querydsl.core.types.OrderSpecifier; | ||
|
||
public enum OrderBy { | ||
DATE_CONTEST_END { | ||
public OrderSpecifier<?> getOrderBy(QContestBoard contestBoard) { | ||
return contestBoard.dateContestEnd.desc(); | ||
} | ||
}, | ||
|
||
DATE_CREATED { | ||
public OrderSpecifier<?> getOrderBy(QContestBoard contestBoard) { | ||
return contestBoard.dateCreated.desc(); | ||
} | ||
}; | ||
|
||
public abstract OrderSpecifier<?> getOrderBy(QContestBoard contestBoard); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.