-
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.
- Loading branch information
1 parent
75ebec4
commit 87d0b37
Showing
4 changed files
with
50 additions
and
18 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
20 changes: 6 additions & 14 deletions
20
src/main/java/com/smunity/server/domain/member/dto/MemberInfoResponseDto.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,32 +1,24 @@ | ||
package com.smunity.server.domain.member.dto; | ||
|
||
import com.smunity.server.global.common.entity.Member; | ||
import com.smunity.server.global.common.entity.enums.MemberRole; | ||
import lombok.Builder; | ||
import org.springframework.data.domain.Page; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Builder | ||
public record MemberInfoResponseDto( | ||
Long id, | ||
String username, | ||
MemberRole memberRole, | ||
LocalDateTime createdAt, | ||
LocalDateTime updatedAt | ||
String name, | ||
String department, | ||
String email | ||
) { | ||
|
||
public static MemberInfoResponseDto from(Member member) { | ||
return MemberInfoResponseDto.builder() | ||
.id(member.getId()) | ||
.username(member.getUsername()) | ||
.memberRole(member.getRole()) | ||
.createdAt(member.getCreatedAt()) | ||
.updatedAt(member.getUpdatedAt()) | ||
.name(member.getName()) | ||
.department(member.getDepartment().getName()) | ||
.email(member.getEmail()) | ||
.build(); | ||
} | ||
|
||
public static Page<MemberInfoResponseDto> from(Page<Member> memberPage) { | ||
return memberPage.map(MemberInfoResponseDto::from); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
src/main/java/com/smunity/server/domain/member/dto/MemberResponseDto.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,38 @@ | ||
package com.smunity.server.domain.member.dto; | ||
|
||
import com.smunity.server.global.common.entity.Member; | ||
import com.smunity.server.global.common.entity.enums.MemberRole; | ||
import lombok.Builder; | ||
import org.springframework.data.domain.Page; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Builder | ||
public record MemberResponseDto( | ||
Long id, | ||
String username, | ||
String name, | ||
String department, | ||
String email, | ||
MemberRole memberRole, | ||
LocalDateTime createdAt, | ||
LocalDateTime updatedAt | ||
) { | ||
|
||
public static MemberResponseDto from(Member member) { | ||
return MemberResponseDto.builder() | ||
.id(member.getId()) | ||
.username(member.getUsername()) | ||
.name(member.getName()) | ||
.department(member.getDepartment().getName()) | ||
.email(member.getEmail()) | ||
.memberRole(member.getRole()) | ||
.createdAt(member.getCreatedAt()) | ||
.updatedAt(member.getUpdatedAt()) | ||
.build(); | ||
} | ||
|
||
public static Page<MemberResponseDto> from(Page<Member> memberPage) { | ||
return memberPage.map(MemberResponseDto::from); | ||
} | ||
} |
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