-
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.
Merge pull request #25 from One-armed-boy/feat/user_video_relation
Member - Video 간 릴레이션 설정
- Loading branch information
Showing
25 changed files
with
438 additions
and
100 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
47 changes: 44 additions & 3 deletions
47
src/main/java/com/stream/controller/dto/video/ListVideoResponse.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,22 +1,63 @@ | ||
package com.stream.controller.dto.video; | ||
|
||
import java.util.Date; | ||
import java.util.List; | ||
|
||
import com.stream.domain.video.dto.VideoDto; | ||
|
||
import lombok.Builder; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.ToString; | ||
|
||
@Getter | ||
@ToString | ||
@NoArgsConstructor | ||
@EqualsAndHashCode | ||
public class ListVideoResponse { | ||
private List<VideoDto> videos; | ||
private List<Element> videos; | ||
|
||
@Builder | ||
public ListVideoResponse(List<VideoDto> videos) { | ||
private ListVideoResponse(List<Element> videos) { | ||
this.videos = videos; | ||
} | ||
|
||
public static ListVideoResponse create(List<VideoDto> videos) { | ||
return new ListVideoResponse(videos.stream().map(videoDto -> { | ||
var member = videoDto.getMember(); | ||
var memberEmail = member != null ? member.getEmail() : null; | ||
return Element.builder() | ||
.id(videoDto.getId()) | ||
.fileTag( | ||
videoDto.getFileTag()) | ||
.extension(videoDto.getExtension()) | ||
.size(videoDto.getSize()) | ||
.member(memberEmail) | ||
.createdAt(videoDto.getCreatedAt()) | ||
.build(); | ||
}).toList()); | ||
} | ||
|
||
@Getter | ||
@ToString | ||
@NoArgsConstructor | ||
@EqualsAndHashCode | ||
public static class Element { | ||
private long id; | ||
private String fileTag; | ||
private String extension; | ||
private long size; | ||
private Date createdAt; | ||
private String member; | ||
|
||
@Builder | ||
public Element(long id, String fileTag, String extension, String member, long size, Date createdAt) { | ||
this.id = id; | ||
this.fileTag = fileTag; | ||
this.extension = extension; | ||
this.size = size; | ||
this.createdAt = createdAt; | ||
this.member = member; | ||
} | ||
} | ||
} |
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
27 changes: 27 additions & 0 deletions
27
src/main/java/com/stream/domain/video/dto/CreateVideoCommand.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,27 @@ | ||
package com.stream.domain.video.dto; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.ToString; | ||
|
||
@Getter | ||
@ToString | ||
public class CreateVideoCommand { | ||
private String fileTag; | ||
private String extension; | ||
private String path; | ||
private long size; | ||
private String description; | ||
private String memberEmail; | ||
|
||
@Builder | ||
public CreateVideoCommand(String fileTag, String extension, String path, long size, String description, | ||
String memberEmail) { | ||
this.fileTag = fileTag; | ||
this.extension = extension; | ||
this.path = path; | ||
this.size = size; | ||
this.description = description; | ||
this.memberEmail = memberEmail; | ||
} | ||
} |
Oops, something went wrong.