package com.sparta.topster.domain.user.entity;import com.sparta.topster.domain.BaseEntity;import com.sparta.topster.domain.like.entity.Like;import com.sparta.topster.domain.user.dto.update.UpdateReq;import jakarta.persistence.Column;import jakarta.persistence.Entity;import jakarta.persistence.EnumType;import jakarta.persistence.Enumerated;import jakarta.persistence.JoinColumn;import jakarta.persistence.OneToMany;import jakarta.persistence.Table;import java.util.ArrayList;import java.util.List;import lombok.AccessLevel;import lombok.Builder;import lombok.Getter;import lombok.NoArgsConstructor;@Entity@Table(name = "users")@NoArgsConstructor(access = AccessLevel.PROTECTED)@Getterpublic class User extends BaseEntity { @Column(nullable = false) private String username; @Column(nullable = false) private String nickname; @Column(nullable = false) private String password; @Column(nullable = false) private String email; @Column private String intro; @Enumerated(value = EnumType.STRING) @Column(nullable = false) private UserRoleEnum role; private Long kakaoId; @Builder public User(String username, String nickname, String password, String email, String intro, UserRoleEnum role){ this.username = username; this.nickname = nickname; this.password = password; this.email = email; this.intro = intro; this.role = role; } public void updateIntro(UpdateReq updateReq) { this.nickname = updateReq.getNickname(); this.intro = updateReq.getIntro(); } public User kakaoIdUpdate(Long kakaoId) { this.kakaoId = kakaoId; return this; } public User(String username, String nickname, String password, String email, UserRoleEnum role, Long kakaoId) { this.username = username; this.nickname = nickname; this.password = password; this.email = email; this.role = role; this.kakaoId = kakaoId; } public void updateIntro(String intro) { this.intro = intro; } public void updateNickname(String nickname) { this.nickname = nickname; }}
디렉토리 구조