Skip to content

Commit

Permalink
Merge pull request #3 from KNU-HAEDAL/feat/entity
Browse files Browse the repository at this point in the history
Feat/entity
  • Loading branch information
momnpa333 authored May 30, 2024
2 parents 54d8ea0 + 108b232 commit cd54049
Show file tree
Hide file tree
Showing 17 changed files with 422 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.haedal.zzansuni.controller.PagingRequest;
import org.haedal.zzansuni.controller.PagingResponse;
import org.haedal.zzansuni.core.api.ApiResponse;
import org.haedal.zzansuni.domain.challenge.ChallengeCategory;
import org.haedal.zzansuni.domain.challengegroup.ChallengeCategory;
import org.haedal.zzansuni.global.jwt.JwtUser;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.GetMapping;
Expand All @@ -23,34 +23,34 @@ public class ChallengeGroupController {
@Operation(summary = "챌린지 그룹 목록 페이징", description = "챌린지 그룹 페이징 조회.")
@GetMapping("/api/challengeGroups")
public ApiResponse<PagingResponse<ChallengeGroupRes.ChallengeGroupDto>> getChallengesPaging(
@Valid PagingRequest pagingRequest,
@RequestParam ChallengeCategory category
@Valid PagingRequest pagingRequest,
@RequestParam ChallengeCategory category
) {
throw new RuntimeException("Not implemented");
}

@Operation(summary = "챌린지 그룹 상세 조회", description = "챌린지 상세 조회한다.")
@GetMapping("/api/challengeGroups/{challengeGroupId}")
public ApiResponse<ChallengeGroupRes.ChallengeGroupDetailDto> getChallengeDetail(
@PathVariable Long challengeGroupId
@PathVariable Long challengeGroupId
) {
throw new RuntimeException("Not implemented");
}

@Operation(summary = "챌린지 그룹 최근 리뷰 페이징", description = "챌린지 최근 리뷰 페이징 조회.")
@GetMapping("/api/challengeGroups/reviews")
public ApiResponse<PagingResponse<ChallengeGroupRes.ChallengeReviewDto>> getChallengeReviews(
@Valid PagingRequest pagingRequest
@Valid PagingRequest pagingRequest
) {
throw new RuntimeException("Not implemented");
}

@Operation(summary = "챌린지 그룹 랭킹 조회", description = "챌린지 랭킹 조회한다.")
@GetMapping("/api/challengeGroups/{challengeGroupId}/rankings")
public ApiResponse<ChallengeGroupRes.ChallengeGroupRankingPagingResponse> getChallengeRankings(
@AuthenticationPrincipal JwtUser jwtUser,
@PathVariable Long challengeGroupId,
@Valid PagingRequest pagingRequest
@AuthenticationPrincipal JwtUser jwtUser,
@PathVariable Long challengeGroupId,
@Valid PagingRequest pagingRequest
) {
throw new RuntimeException("Not implemented");
}
Expand All @@ -59,11 +59,10 @@ public ApiResponse<ChallengeGroupRes.ChallengeGroupRankingPagingResponse> getCha
@Operation(summary = "챌린지 그룹 숏폼 페이징", description = "챌린지 숏폼 페이징 조회한다.")
@GetMapping("/api/challengeGroups/shorts")
public ApiResponse<PagingResponse<ChallengeGroupRes.ChallengeGroupDto>> getChallengeShortsPaging(
@RequestParam Long page
@RequestParam Long page
) {
throw new RuntimeException("Not implemented");
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import lombok.Builder;
import org.haedal.zzansuni.controller.user.UserRes;
import org.haedal.zzansuni.domain.challenge.ChallengeCategory;
import org.haedal.zzansuni.domain.challenge.DayType;
import org.haedal.zzansuni.domain.challengegroup.ChallengeCategory;
import org.haedal.zzansuni.domain.challengegroup.DayType;

import java.time.LocalDate;
import java.util.List;
Expand All @@ -13,74 +13,80 @@ public class ChallengeGroupRes {

@Builder
public record ChallengeGroupDto(
Long id,
String title,
String content,
Integer participantCount,
LocalDate startDate,
LocalDate endDate,
ChallengeCategory category
Long id,
String title,
String content,
Integer participantCount,
LocalDate startDate,
LocalDate endDate,
ChallengeCategory category

) {

}

@Builder
public record ChallengeGroupDetailDto(
Long id,
String title,
String content,
Integer participantCount,
LocalDate startDate,
LocalDate endDate,
ChallengeCategory category,
/////
Integer maxDifficulty,
List<String> imageUrls,
List<ChallengeDto> challenges
Long id,
String title,
String content,
Integer participantCount,
LocalDate startDate,
LocalDate endDate,
ChallengeCategory category,
/////
Integer maxDifficulty,
List<String> imageUrls,
List<ChallengeDto> challenges
) {

}

@Builder
public record ChallengeDto(
Long id,
Integer participantCount,

Integer difficulty,
Integer onceExp,
Integer successExp,
DayType dayType,
Integer dayCount
Long id,
Integer participantCount,

Integer difficulty,
Integer onceExp,
Integer successExp,
DayType dayType,
Integer dayCount
) {

}


@Builder
public record ChallengeReviewDto(
Long challengeId,
String challengeTitle,
UserRes.UserDto user,
String content,
Integer rating
Long challengeId,
String challengeTitle,
UserRes.UserDto user,
String content,
Integer rating
) {

}


@Builder
public record ChallengeGroupRankingPagingResponse(
List<ChallengeGroupRankingDto> data,
Integer totalPage,
ChallengeGroupRankingDto myRanking //null이면 랭킹이 없는 것
List<ChallengeGroupRankingDto> data,
Integer totalPage,
ChallengeGroupRankingDto myRanking //null이면 랭킹이 없는 것
) {

}


@Builder
public record ChallengeGroupRankingDto(
Integer ranking,
//획득 포인트
Integer acquiredPoint,
UserRes.UserDto user
Integer ranking,
//획득 포인트
Integer acquiredPoint,
UserRes.UserDto user
) {

}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,72 +1,75 @@
package org.haedal.zzansuni.controller.challengegroup.challenge;

import lombok.Builder;
import org.haedal.zzansuni.domain.challenge.ChallengeCategory;
import org.haedal.zzansuni.domain.challengegroup.ChallengeCategory;

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

public class ChallengeRes {

@Builder
public record ChallengeVerificationResponse(
Integer totalCount,
Integer successCount,
Integer obtainExp
Integer totalCount,
Integer successCount,
Integer obtainExp
) {

}

@Builder
public record ChallengeRecordResponse(
String title,
Integer totalCount,
Integer successCount,
LocalDate startDate,
LocalDate endDate,
List<Long> recordIds
String title,
Integer totalCount,
Integer successCount,
LocalDate startDate,
LocalDate endDate,
List<Long> recordIds
) {

}

@Builder
public record ChallengeRecordDetailDto(
Long id,
LocalDateTime createdAt,
String content,
String imageUrl
Long id,
LocalDateTime createdAt,
String content,
String imageUrl
) {
}



}


@Builder
public record ChallengeCurrentDto(
Long id,
String title,
Integer successCount,
Integer totalCount,
Long id,
String title,
Integer successCount,
Integer totalCount,

LocalDate participationDate,
LocalDate startDate,
LocalDate endDate,
LocalDate participationDate,
LocalDate startDate,
LocalDate endDate,

ChallengeCategory category,
Boolean reviewWritten
ChallengeCategory category,
Boolean reviewWritten

) {

}

@Builder
public record ChallengeCompleteDto(
Long id,
String title,
Long id,
String title,

LocalDate successDate,
LocalDate successDate,

ChallengeCategory category,
Boolean reviewWritten
ChallengeCategory category,
Boolean reviewWritten

) {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.haedal.zzansuni.domain;

import jakarta.persistence.Column;
import jakarta.persistence.EntityListeners;
import jakarta.persistence.MappedSuperclass;
import java.time.LocalDateTime;
import lombok.Getter;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

@Getter
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public class BaseTimeEntity {

@CreatedDate
@Column(name = "created_at")
private LocalDateTime createdAt;

@LastModifiedDate
@Column(name = "last_modified_at")
private LocalDateTime lastModifiedAt;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package org.haedal.zzansuni.domain.auth;

public class AuthService {
}

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.haedal.zzansuni.domain.challengegroup;

import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
public enum ChallengeCategory {
HEALTH("건강"),
ECHO("에코"),

SHARE("나눔"),

VOLUNTEER("봉사"),
ETC("기타");

private final String korean;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package org.haedal.zzansuni.domain.challengegroup;

import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.haedal.zzansuni.domain.BaseTimeEntity;

@Entity
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
@Builder
@Getter
public class ChallengeGroup extends BaseTimeEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@Enumerated(EnumType.STRING)
private ChallengeCategory category;

private String title;

private String content;

private Integer cumulativeCount;

}
Loading

0 comments on commit cd54049

Please sign in to comment.