13
13
import jakarta .persistence .OneToMany ;
14
14
import jakarta .persistence .OneToOne ;
15
15
import jakarta .persistence .Table ;
16
+
16
17
import java .time .LocalDateTime ;
17
18
import java .util .ArrayList ;
18
19
import java .util .List ;
20
+
19
21
import lombok .AccessLevel ;
20
22
import lombok .Builder ;
21
23
import lombok .Getter ;
25
27
import org .hibernate .annotations .SQLDelete ;
26
28
import org .hibernate .annotations .UpdateTimestamp ;
27
29
import poomasi .domain .farm .dto .FarmUpdateRequest ;
30
+
31
+ import java .time .LocalDateTime ;
32
+
28
33
import poomasi .domain .order .entity ._farm .OrderedFarm ;
29
34
import poomasi .domain .review .entity .Review ;
30
35
34
39
@ NoArgsConstructor (access = AccessLevel .PROTECTED )
35
40
@ SQLDelete (sql = "UPDATE farm SET deleted_at=current_timestamp WHERE id = ?" )
36
41
public class Farm {
37
-
38
42
@ Id
39
43
@ GeneratedValue (strategy = GenerationType .IDENTITY )
40
44
private Long id ;
@@ -67,6 +71,10 @@ public class Farm {
67
71
@ Enumerated (EnumType .STRING )
68
72
private FarmStatus status = FarmStatus .OPEN ;
69
73
74
+ @ Comment ("카테고리 ID" )
75
+ @ Column (name = "category_id" )
76
+ private Long categoryId ;
77
+
70
78
@ Comment ("체험 비용" )
71
79
private int experiencePrice ;
72
80
@@ -87,6 +95,9 @@ public class Farm {
87
95
@ UpdateTimestamp
88
96
private LocalDateTime updatedAt = LocalDateTime .now ();
89
97
98
+ @ Column (name = "phone_number" )
99
+ private String phoneNumber ;
100
+
90
101
@ OneToMany (cascade = CascadeType .REMOVE , orphanRemoval = true )
91
102
@ JoinColumn (name = "entityId" )
92
103
private List <Review > reviewList = new ArrayList <>();
@@ -98,10 +109,7 @@ public class Farm {
98
109
private double averageRating ;
99
110
100
111
@ Builder
101
- public Farm (Long id , String name , Long ownerId , String address , String addressDetail ,
102
- Double latitude , Double longitude , String description , int experiencePrice ,
103
- Integer maxCapacity , Integer maxReservation , String businessNumber ,
104
- LocalDateTime deletedAt ) {
112
+ public Farm (Long id , String name , Long ownerId , String address , String addressDetail , Double latitude , Double longitude , String description , int experiencePrice , Integer maxCapacity , Integer maxReservation , String businessNumber , LocalDateTime deletedAt , Long categoryId , String phoneNumber ) {
105
113
this .id = id ;
106
114
this .name = name ;
107
115
this .ownerId = ownerId ;
@@ -115,6 +123,8 @@ public Farm(Long id, String name, Long ownerId, String address, String addressDe
115
123
this .maxReservation = maxReservation ;
116
124
this .businessNumber = businessNumber ;
117
125
this .deletedAt = deletedAt ;
126
+ this .categoryId = categoryId ;
127
+ this .phoneNumber = phoneNumber ;
118
128
averageRating = 0.0f ;
119
129
}
120
130
0 commit comments