Skip to content

Commit

Permalink
๐Ÿ”€Merge: Main Merge 32์ฐจ (#154)
Browse files Browse the repository at this point in the history
* ๐Ÿ› Hotfix: ๋Œ“๊ธ€ ์ˆ˜์ • request dto ์ถ”๊ฐ€ (#149)

* Hotfix : ๋Œ“๊ธ€ ์‚ญ์ œ ์‹œ ๊ฒŒ์‹œ๋ฌผ์˜ ๋Œ“๊ธ€ ์ˆ˜ ์ฐจ๊ฐ ๋กœ์ง ์ˆ˜์ • (#151)

* ๐Ÿ› Hotfix: ๋Œ“๊ธ€ ์ˆ˜์ • request dto ์ถ”๊ฐ€

* ๐Ÿ› Hotfix: ๋Œ“๊ธ€ ์‚ญ์ œ ์‹œ ๊ฒŒ์‹œ๋ฌผ์˜ ๋Œ“๊ธ€ ์ˆ˜ ์ฐจ๊ฐ ๋กœ์ง ์ˆ˜์ •

* Feat: ํ”„๋กœํ•„ ์ด๋ชจ์ง€ ์„ค์ • ๋กœ์ง ๊ตฌํ˜„ (#153)

* ๐Ÿ—ƒ๏ธ profile ์†์„ฑ์˜ Enum value ProfileEmoji ์ƒ์„ฑ

* ๐Ÿ—ƒ๏ธ profile ์†์„ฑ ProfileEmoji ์„ค์ •

* โœจ Feat: ํšŒ์› ๊ฐ€์ž… ๋ฐ ์ •๋ณด ์ˆ˜์ •์— ํ”„๋กœํ•„ ์ด๋ชจ์ง€ ์„ค์ • ๋กœ์ง ์ถ”๊ฐ€
  • Loading branch information
joowojr authored May 20, 2024
1 parent 479e598 commit c20f242
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public ApiResponse<CommentResponse.CommentProc> updateComment(@RequestBody Comme
@DeleteMapping("/{commentId}")
public ApiResponse<CommentResponse.CommentProc> deleteComment(
@PathVariable(name = "commentId") Long commentId) {

return ApiResponse.onSuccess(commentCommandService.delete(commentId));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public static CommentItem toCommentItem(Comment comment) {
.commentId(comment.getId())
.content(comment.getContent())
.memberName(member.getEmail().split("@")[0])
.profile(member.getProfile())
.profile(member.getProfile().name())
.sinceCreation(sinceCreation)
.childComments(getChildList(comment))
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ public CommentResponse.CommentProc update(String content, Long commentId) {

public CommentResponse.CommentProc delete(Long commentId) {
Comment comment = commentQueryService.findById(commentId);
comment.getBoard().changeComment(false);
Board board = comment.getBoard();
board.changeComment(false);
commentRepository.deleteById(commentId);
return CommentResponse.toCommentProc(commentId);
}
Expand Down
34 changes: 34 additions & 0 deletions src/main/java/com/codez4/meetfolio/domain/enums/ProfileEmoji.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.codez4.meetfolio.domain.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public enum ProfileEmoji {
BACKEND,
WEB,
APP,
DESIGN,
AI,
TOOL,
MAN,
WOMAN,
MOUSE,
KEYBOARD,
FIRE,
SPARKLE;

@JsonCreator
public static ProfileEmoji convert(String source)
{
for (ProfileEmoji profileEmoji : ProfileEmoji.values()) {
if (profileEmoji.name().equals(source)) {
return profileEmoji;
}
}
return null;
}
}

12 changes: 5 additions & 7 deletions src/main/java/com/codez4/meetfolio/domain/member/Member.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package com.codez4.meetfolio.domain.member;

import com.codez4.meetfolio.domain.common.BaseTimeEntity;
import com.codez4.meetfolio.domain.enums.Authority;
import com.codez4.meetfolio.domain.enums.Grade;
import com.codez4.meetfolio.domain.enums.JobKeyword;
import com.codez4.meetfolio.domain.enums.Status;
import com.codez4.meetfolio.domain.enums.*;
import com.codez4.meetfolio.domain.member.dto.MemberRequest;
import com.codez4.meetfolio.global.security.Password;
import com.codez4.meetfolio.global.utils.TimeUtils;
Expand Down Expand Up @@ -52,8 +49,9 @@ public class Member extends BaseTimeEntity {
@Enumerated(EnumType.STRING)
private Status status;

@Column
private String profile;
@Column(nullable = false)
@Enumerated(EnumType.STRING)
private ProfileEmoji profile;

@Column(nullable = false)
@ColumnDefault("'MEMBER'")
Expand All @@ -77,7 +75,6 @@ public void withdraw(){
setInactive();
this.email = "";
this.major = "";
this.profile = "";
}

/**
Expand All @@ -87,6 +84,7 @@ public void updateInfo(MemberRequest.Patch request) {
this.major = request.getMajor();
this.grade = Grade.convert(request.getGrade());
this.jobKeyword = JobKeyword.convert(request.getJobKeyword());
this.profile = ProfileEmoji.convert(request.getProfile());
}

public void updatePassword(String password){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.codez4.meetfolio.domain.comment.service.CommentQueryService;
import com.codez4.meetfolio.domain.enums.Grade;
import com.codez4.meetfolio.domain.enums.JobKeyword;
import com.codez4.meetfolio.domain.enums.ProfileEmoji;
import com.codez4.meetfolio.domain.like.service.LikeQueryService;
import com.codez4.meetfolio.domain.member.Member;
import com.codez4.meetfolio.domain.member.dto.MemberRequest;
Expand Down Expand Up @@ -48,6 +49,7 @@ public ApiResponse<MemberResponse.MemberProc> signUp(
.grade(Grade.convert(request.getGrade()))
.jobKeyword(JobKeyword.convert(request.getJobKeyword()))
.major(request.getMajor())
.profile(ProfileEmoji.convert(request.getProfile()))
.build();
return ApiResponse.onSuccess(memberCommandService.post(post));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import com.codez4.meetfolio.domain.enums.Grade;
import com.codez4.meetfolio.domain.enums.JobKeyword;
import com.codez4.meetfolio.domain.enums.ProfileEmoji;
import com.codez4.meetfolio.domain.member.Member;
import com.codez4.meetfolio.global.annotation.EnumValid;
import com.codez4.meetfolio.global.security.Password;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
Expand All @@ -24,7 +26,6 @@ public static class SignUpRequest {
@NotBlank(message = "๋น„๋ฐ€๋ฒˆํ˜ธ ์ž…๋ ฅ์€ ํ•„์ˆ˜์ž…๋‹ˆ๋‹ค.")
private String password;


@Schema(description = "ํ•™๋…„ ๋ฐ ํ•™์ , FRESHMAN/SOPHOMORE/JUNIOR/SENIOR/GRADUATE")
@NotBlank(message = "ํ•™๋…„ ๋ฐ ํ•™์  ์ž…๋ ฅ์€ ํ•„์ˆ˜์ž…๋‹ˆ๋‹ค.")
@EnumValid(enumClass = Grade.class)
Expand All @@ -35,9 +36,15 @@ public static class SignUpRequest {
@EnumValid(enumClass = JobKeyword.class)
private String jobKeyword;

@Schema(description = "์ „๊ณต, COMPUTER_ENGINEERING", example = "COMPUTER_ENGINEERING")
@Schema(description = "์ „๊ณต")
@NotBlank(message = "์ „๊ณต ์ž…๋ ฅ์€ ํ•„์ˆ˜์ž…๋‹ˆ๋‹ค.")
private String major;


@Schema(description = "ํ”„๋กœํ•„ ์ด๋ชจ์ง€, BACKEND/WEB/APP/DESIGN/AI/TOOL/MAN/WOMAN/MOUSE/KEYBOARD/FIRE/SPARKLE")
@NotNull(message = "์ด๋ชจ์ง€๋ฅผ ์„ ํƒ์€ ํ•„์ˆ˜์ž…๋‹ˆ๋‹ค")
@EnumValid(enumClass = ProfileEmoji.class)
private String profile;
}

/*
Expand All @@ -52,6 +59,7 @@ public static class Post {
private Grade grade;
private JobKeyword jobKeyword;
private String major;
private ProfileEmoji profile;
}

@Schema(description = "์‚ฌ์šฉ์ž ์ •๋ณด ์ˆ˜์ • ์š”์ฒญ DTO")
Expand All @@ -69,15 +77,21 @@ public static class Patch {

@Schema(description = "์ˆ˜์ •ํ•˜๋Š” ํฌ๋ง ์ง๋ฌด ํ‚ค์›Œ๋“œ, BACKEND/WEB/APP/DESIGN/AI", example = "BACKEND")
private String jobKeyword;

@Schema(description = "ํ”„๋กœํ•„ ์ด๋ชจ์ง€, BACKEND/WEB/APP/DESIGN/AI/TOOL/MAN/WOMAN/MOUSE/KEYBOARD/FIRE/SPARKLE")
@NotNull(message = "์ด๋ชจ์ง€๋ฅผ ์„ ํƒ์€ ํ•„์ˆ˜์ž…๋‹ˆ๋‹ค")
@EnumValid(enumClass = ProfileEmoji.class)
private String profile;
}

public static Member toEntity(Post post) {
return Member.builder()
.email(post.getEmail())
.password(Password.encrypt(post.getPassword(), ENCODER))
.grade(post.getGrade())
.jobKeyword(post.getJobKeyword())
.major(post.getMajor())
.build();
.email(post.getEmail())
.password(Password.encrypt(post.getPassword(), ENCODER))
.grade(post.getGrade())
.jobKeyword(post.getJobKeyword())
.major(post.getMajor())
.profile(post.getProfile())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ public static class MemberDetailInfo {
private String major;
@Schema(description = "ํฌ๋ง ์ง๋ฌด")
private String jobKeyword;
@Schema(description = "ํ”„๋กœํ•„ ์ด๋ชจ์ง€")
private String profile;
@Schema(description = "ํฌ์ธํŠธ")
private int point;
@Schema(description = "ํ™œ์„ฑ ์ƒํƒœ, ACTIVE/INACTIVE/WITHDRAW(ํƒˆํ‡ด)")
Expand All @@ -111,7 +113,7 @@ public static MemberInfo toMemberInfo(Member member) {
return MemberInfo.builder()
.authority(member.getAuthority().name())
.memberName(member.getEmail().split("@")[0])
.profile(member.getProfile())
.profile(member.getProfile().name())
.major(member.getMajor())
.build();
} else if (member.getAuthority() == Authority.ADMIN) {
Expand Down Expand Up @@ -149,6 +151,7 @@ public static MemberDetailInfo toMemberDetailInfo(Member member) {
.grade(member.getGrade().getDescription())
.major(member.getMajor())
.jobKeyword(member.getJobKeyword().getDescription())
.profile(member.getProfile().name())
.point(member.getPoint())
.status(member.getStatus().name())
.build();
Expand Down

0 comments on commit c20f242

Please sign in to comment.