-
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.
refactor(Board): 게시글 조회에서 운영진이 작성한 공지사항 게시글일 경우 운영진임을 표시하도록 설정 (#339)
- Loading branch information
Showing
4 changed files
with
59 additions
and
9 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
48 changes: 48 additions & 0 deletions
48
src/main/java/page/clab/api/domain/board/dto/response/WriterInfo.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,48 @@ | ||
package page.clab.api.domain.board.dto.response; | ||
|
||
import lombok.Getter; | ||
import page.clab.api.domain.board.domain.Board; | ||
import page.clab.api.domain.member.domain.Role; | ||
|
||
@Getter | ||
public class WriterInfo { | ||
|
||
private String id; | ||
|
||
private String name; | ||
|
||
private Long roleLevel; | ||
|
||
private String imageUrl; | ||
|
||
public WriterInfo(String id, String name) { | ||
this.id = id; | ||
this.name = name; | ||
} | ||
|
||
public WriterInfo(String id, String name, Long roleLevel, String imageUrl) { | ||
this.id = id; | ||
this.name = name; | ||
this.roleLevel = roleLevel; | ||
this.imageUrl = imageUrl; | ||
} | ||
|
||
public static WriterInfo fromBoard(Board board) { | ||
if (board.getMember().isAdminRole() && board.isNotice()) { | ||
return new WriterInfo(null, "운영진"); | ||
} else if (board.isWantAnonymous()) { | ||
return new WriterInfo(null, board.getNickname()); | ||
} | ||
return new WriterInfo(board.getMember().getId(), board.getMember().getName()); | ||
} | ||
|
||
public static WriterInfo fromBoardDetails(Board board) { | ||
if (board.getMember().isAdminRole() && board.isNotice()) { | ||
return new WriterInfo(null, "운영진", Role.ADMIN.toRoleLevel(), null); | ||
} else if (board.isWantAnonymous()) { | ||
return new WriterInfo(null, board.getNickname(), null, null); | ||
} | ||
return new WriterInfo(board.getMember().getId(), board.getMember().getName(), board.getMember().getRole().toRoleLevel(), board.getMember().getImageUrl()); | ||
} | ||
|
||
} |