forked from kookmin-sw/cap-template
-
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.
- Loading branch information
Showing
4 changed files
with
57 additions
and
1 deletion.
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
30 changes: 30 additions & 0 deletions
30
backend/src/main/java/com/project/capstone/assignment/controller/dto/AssignmentResponse.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,30 @@ | ||
package com.project.capstone.assignment.controller.dto; | ||
|
||
import com.project.capstone.assignment.domain.Assignment; | ||
import com.project.capstone.content.controller.dto.ContentResponse; | ||
import com.project.capstone.content.domain.Content; | ||
import com.project.capstone.post.controller.dto.PostResponse; | ||
import com.project.capstone.post.domain.Post; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public record AssignmentResponse( | ||
Long id, | ||
String name, | ||
String startDate, | ||
String endDate, | ||
List<ContentResponse> contentList | ||
) { | ||
public AssignmentResponse(Assignment assignment) { | ||
this(assignment.getId(), assignment.getName(), assignment.getStartDate(), assignment.getEndDate(), createContentList(assignment.getContentList())); | ||
} | ||
|
||
private static List<ContentResponse> createContentList(List<Content> contents) { | ||
List<ContentResponse> contentResponseList = new ArrayList<>(); | ||
for (Content content : contents) { | ||
contentResponseList.add(new ContentResponse(content)); | ||
} | ||
return contentResponseList; | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
backend/src/main/java/com/project/capstone/assignment/domain/AssignmentRepository.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,6 +1,10 @@ | ||
package com.project.capstone.assignment.domain; | ||
|
||
import com.project.capstone.club.domain.Club; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.List; | ||
|
||
public interface AssignmentRepository extends JpaRepository<Assignment, Long> { | ||
List<Assignment> findAssignmentsByClub(Club club); | ||
} |
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