-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Issue/#79
- Loading branch information
Showing
30 changed files
with
581 additions
and
39 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
34 changes: 34 additions & 0 deletions
34
zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/admin/controller/AdminRes.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,34 @@ | ||
package org.haedal.zzansuni.admin.controller; | ||
|
||
import lombok.Builder; | ||
import org.haedal.zzansuni.user.domain.UserModel; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
public class AdminRes { | ||
@Builder | ||
public record ManagerAndAdmin( | ||
Long id, | ||
String email, | ||
String name, | ||
String role, | ||
LocalDateTime createdAt | ||
) { | ||
public static ManagerAndAdmin from(UserModel.Main userMain) { | ||
return ManagerAndAdmin.builder() | ||
.id(userMain.id()) | ||
.email(userMain.email()) | ||
.name(userMain.nickname()) | ||
.role(userMain.role().name()) | ||
.createdAt(userMain.createdAt()) | ||
.build(); | ||
} | ||
|
||
public static List<ManagerAndAdmin> from(List<UserModel.Main> userMainList) { | ||
return userMainList.stream() | ||
.map(ManagerAndAdmin::from) | ||
.toList(); | ||
} | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
...er/app/src/main/java/org/haedal/zzansuni/challengegroup/controller/ChallengeGroupReq.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 |
---|---|---|
@@ -1,5 +1,73 @@ | ||
package org.haedal.zzansuni.challengegroup.controller; | ||
|
||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.NotNull; | ||
import org.haedal.zzansuni.admin.controller.AdminReq; | ||
import org.haedal.zzansuni.challengegroup.domain.ChallengeCategory; | ||
import org.haedal.zzansuni.challengegroup.domain.ChallengeGroupCommand; | ||
|
||
import java.time.LocalDate; | ||
import java.util.List; | ||
|
||
public class ChallengeGroupReq { | ||
public record Update( | ||
@NotNull(message = "id는 필수값입니다.") | ||
Long id, | ||
@NotBlank(message = "title은 필수값입니다.") | ||
String title, | ||
@NotBlank(message = "content는 필수값입니다.") | ||
String content, | ||
@NotBlank(message = "guide는 필수값입니다.") | ||
String guide, | ||
@NotNull(message = "category는 필수값입니다.") | ||
ChallengeCategory category, | ||
@NotNull(message = "joinStartDate는 필수값입니다.") | ||
LocalDate joinStartDate, | ||
@NotNull(message = "joinEndDate는 필수값입니다.") | ||
LocalDate joinEndDate, | ||
List<UpdateChallenge> updateChallenges, | ||
List<AdminReq.CreateChallengeRequest> createChallenges | ||
) { | ||
public ChallengeGroupCommand.Update toCommand() { | ||
return ChallengeGroupCommand.Update.builder() | ||
.id(id) | ||
.title(title) | ||
.content(content) | ||
.guide(guide) | ||
.category(category) | ||
.joinStartDate(joinStartDate) | ||
.joinEndDate(joinEndDate) | ||
.updateChallenges(updateChallenges.stream().map(UpdateChallenge::toCommand).toList()) | ||
.createChallenges(createChallenges.stream().map(AdminReq.CreateChallengeRequest::toCommand).toList()) | ||
.build(); | ||
} | ||
} | ||
|
||
|
||
public record UpdateChallenge( | ||
@NotNull(message = "id는 필수값입니다.") | ||
Long id, | ||
@NotNull(message = "activePeriod는 필수값입니다.") | ||
Integer activePeriod, | ||
@NotNull(message = "requiredCount는 필수값입니다.") | ||
Integer requiredCount, | ||
@NotNull(message = "onceExp는 필수값입니다.") | ||
Integer onceExp, | ||
@NotNull(message = "successExp는 필수값입니다.") | ||
Integer successExp, | ||
@NotNull(message = "difficulty는 필수값입니다.") | ||
Integer difficulty | ||
){ | ||
public ChallengeGroupCommand.UpdateChallenge toCommand() { | ||
return ChallengeGroupCommand.UpdateChallenge.builder() | ||
.id(id) | ||
.activePeriod(activePeriod) | ||
.requiredCount(requiredCount) | ||
.onceExp(onceExp) | ||
.successExp(successExp) | ||
.difficulty(difficulty) | ||
.build(); | ||
} | ||
} | ||
|
||
} |
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
Oops, something went wrong.