Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: UserProfile Entity를 추가한다. #17

Merged
merged 2 commits into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package com.dnd.accompany.domain.user.entity;

import com.dnd.accompany.domain.user.entity.enums.FoodPreference;
import com.dnd.accompany.domain.user.entity.enums.Gender;
import com.dnd.accompany.domain.user.entity.enums.TravelPreference;
import com.dnd.accompany.domain.user.entity.enums.TravelStyle;
import jakarta.persistence.*;
import lombok.*;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLRestriction;

import java.util.ArrayList;
import java.util.List;

@Table(name = "user_profiles")
@Entity
@Getter
@Builder
@AllArgsConstructor
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@SQLRestriction("deleted = false")
@SQLDelete(sql = "UPDATE user_profiles SET deleted = true WHERE id = ?")
public class UserProfile {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

private Long userId;

@Enumerated(EnumType.STRING)
private Gender gender;

private int birthYear;

@ElementCollection(targetClass = TravelPreference.class)
@Enumerated(EnumType.STRING)
private List<TravelPreference> travelPreferences = new ArrayList<>();

@ElementCollection(targetClass = TravelStyle.class)
@Enumerated(EnumType.STRING)
private List<TravelStyle> travelStyles = new ArrayList<>();

@ElementCollection(targetClass = FoodPreference.class)
private List<FoodPreference> foodPreferences = new ArrayList<>();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.dnd.accompany.domain.user.entity.enums;

public enum FoodPreference {
MEAT("육류"),
SEAFOOD("해산물"),

RICE("밥류"),
VEGETABLES("채소"),

COFFEE("커피"),
DESSERT("디저트"),

FAST_FOOD("패스트푸드"),
STREET_FOOD("스트릿푸드");

private String description;

FoodPreference(String description) {
this.description = description;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.dnd.accompany.domain.user.entity.enums;

public enum Gender {
MALE, FEMALE
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.dnd.accompany.domain.user.entity.enums;

public enum TravelPreference {
PLANNED("계획적"),
UNPLANNED("무계획"),

PUBLIC_MONEY("공금"),
DUTCH_PAY("더치페이"),

LOOKING_FOR("찾아본 곳"),
DRAWN_TO("끌리는 곳"),

QUICKLY("빨리빨리"),
LEISURELY("느긋하게");

private String description;

TravelPreference(String description) {
this.description = description;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.dnd.accompany.domain.user.entity.enums;

public enum TravelStyle {
RESTAURANT_TOUR("맛집탐방"),
CAFE_TOUR("카페투어"),

LIFE_SHOT("인생샷"),
TOURIST_DESTINATION("관광지"),

ACTIVITY("액티비티"),
HEALING("힐링"),

DRIVE("드라이브"),
PACKAGE_TOUR("패키지 여행"),

SHOPPING("쇼핑"),
CULTURE_AND_ARTS("문화 예술");

private String description;

TravelStyle(String description) {
this.description = description;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.dnd.accompany.domain.user.infrastructure;

import com.dnd.accompany.domain.user.entity.UserProfile;
import org.springframework.data.jpa.repository.JpaRepository;

public interface UserProfileRepository extends JpaRepository<UserProfile, Long> {
}