-
Notifications
You must be signed in to change notification settings - Fork 1
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
프로젝트 상세 조회 api 구현 #23
- Loading branch information
Showing
53 changed files
with
944 additions
and
504 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
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
26 changes: 26 additions & 0 deletions
26
src/main/java/com/sendback/domain/comment/entity/Comment.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,26 @@ | ||
package com.sendback.domain.comment.entity; | ||
|
||
import com.sendback.domain.project.entity.Project; | ||
import com.sendback.global.common.BaseEntity; | ||
import jakarta.persistence.*; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.hibernate.annotations.SQLDelete; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@SQLDelete(sql = "UPDATE comment SET is_deleted = true WHERE id = ?") | ||
public class Comment extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "project_id") | ||
private Project project; | ||
|
||
private boolean isDeleted = false; | ||
} |
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
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
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
66 changes: 66 additions & 0 deletions
66
src/main/java/com/sendback/domain/project/dto/response/ProjectDetailResponseDto.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,66 @@ | ||
package com.sendback.domain.project.dto.response; | ||
|
||
import com.sendback.domain.project.entity.Project; | ||
import com.sendback.domain.project.entity.ProjectImage; | ||
import com.sendback.domain.user.entity.User; | ||
|
||
import java.util.List; | ||
|
||
import static com.sendback.global.util.CustomDateUtil.customDateFormat; | ||
|
||
public record ProjectDetailResponseDto( | ||
Long userId, | ||
String username, | ||
String userLevel, | ||
String profileImageUrl, | ||
Long projectId, | ||
String title, | ||
String fieldName, | ||
String content, | ||
String demoSiteUrl, | ||
String progress, | ||
List<String> projectImageUrl, | ||
Long frontendCount, | ||
Long backendCount, | ||
Long designerCount, | ||
Long plannerCount, | ||
Long likeCount, | ||
Long scrapCount, | ||
Long commentCount, | ||
String createdAt, | ||
String startedAt, | ||
String endedAt, | ||
boolean isAuthor, | ||
boolean isCheckedLike, | ||
boolean isCheckedScrap | ||
) { | ||
public static ProjectDetailResponseDto of(Project project, boolean isAuthor, boolean isCheckedLike, boolean isCheckedScrap) { | ||
User user = project.getUser(); | ||
return new ProjectDetailResponseDto( | ||
user.getId(), | ||
user.getNickname(), | ||
user.getLevel().getName(), | ||
user.getProfileImageUrl(), | ||
project.getId(), | ||
project.getTitle(), | ||
project.getFieldName().getName(), | ||
project.getContent(), | ||
project.getDemoSiteUrl(), | ||
project.getProgress().getValue(), | ||
project.getProjectImages().stream().map(ProjectImage::getImageUrl).toList(), | ||
project.getProjectParticipantCount().getFrontendCount(), | ||
project.getProjectParticipantCount().getBackendCount(), | ||
project.getProjectParticipantCount().getDesignCount(), | ||
project.getProjectParticipantCount().getPlannerCount(), | ||
project.getLikes().stream().filter(like -> !like.isDeleted()).count(), | ||
project.getScraps().stream().filter(scrap -> !scrap.isDeleted()).count(), | ||
project.getComments().stream().filter(comment -> !comment.isDeleted()).count(), | ||
customDateFormat(project.getCreatedAt()), | ||
project.getStartedAt().toString(), | ||
project.getEndedAt().toString(), | ||
isAuthor, | ||
isCheckedLike, | ||
isCheckedScrap | ||
); | ||
} | ||
} |
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.