Changeset 77205be for src/main/java/edu/gjoko/schedlr/entity
- Timestamp:
- 12/26/23 18:50:43 (11 months ago)
- Branches:
- master
- Children:
- 1413ee2
- Parents:
- 950fa0d
- Location:
- src/main/java/edu/gjoko/schedlr/entity
- Files:
-
- 3 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/edu/gjoko/schedlr/entity/Appointment.java
-
Property mode
changed from
100644
to100755
r950fa0d r77205be 1 1 package edu.gjoko.schedlr.entity; 2 2 3 import lombok.AllArgsConstructor; 4 import lombok.Getter; 5 import lombok.NoArgsConstructor; 6 import lombok.Setter; 3 import com.fasterxml.jackson.annotation.JsonBackReference; 4 import lombok.*; 7 5 import org.springframework.data.annotation.LastModifiedDate; 8 6 import org.springframework.data.jpa.domain.support.AuditingEntityListener; … … 14 12 @EntityListeners(AuditingEntityListener.class) 15 13 @Table(name = "appointment") 16 @Getter 17 @Setter 14 @Data 18 15 @NoArgsConstructor 19 16 @AllArgsConstructor … … 30 27 private LocalDateTime endTime; 31 28 32 @OneToOne 33 @JoinColumn(name = "customer_id", referencedColumnName = "id") 29 @ManyToOne 30 @JoinColumn(name = "stakeholder_id") 31 @JsonBackReference(value = "customerAppointments") 34 32 private Stakeholder customer; 35 33 36 34 @ManyToOne 37 @JoinColumn(name = "business_id") 38 private Business business; 35 @JoinColumn(name = "service_id") 36 @JsonBackReference(value = "serviceAppointments") 37 private Service service; 39 38 40 @ ManyToOne41 @ JoinColumn(name = "service_id")42 private Service service;39 @Column(name = "appointment_status", length = 32, columnDefinition = "varchar(32) default 'NEW'") 40 @Enumerated(EnumType.STRING) 41 private AppointmentStatus appointmentStatus = AppointmentStatus.NEW; 43 42 44 43 @Column(name = "created") … … 49 48 @LastModifiedDate 50 49 private LocalDateTime modified; 50 51 public String getTimePeriod() { 52 return startTime + " - " + endTime; 53 } 54 51 55 } -
Property mode
changed from
-
src/main/java/edu/gjoko/schedlr/entity/Business.java
-
Property mode
changed from
100644
to100755
r950fa0d r77205be 37 37 private BusinessType businessType; 38 38 39 @ ManyToOne()39 @OneToOne(cascade = CascadeType.PERSIST) 40 40 @JoinColumn(name = "owner_id", referencedColumnName = "id", nullable = false) 41 41 @JsonProperty("owner") … … 43 43 44 44 @OneToMany(mappedBy = "business", cascade = CascadeType.PERSIST) 45 @JsonManagedReference 45 @JsonManagedReference(value = "services") 46 46 private List<Service> services; 47 47 -
Property mode
changed from
-
src/main/java/edu/gjoko/schedlr/entity/BusinessStatus.java
-
Property mode
changed from
100644
to100755
-
Property mode
changed from
-
src/main/java/edu/gjoko/schedlr/entity/BusinessType.java
-
Property mode
changed from
100644
to100755
-
Property mode
changed from
-
src/main/java/edu/gjoko/schedlr/entity/Service.java
-
Property mode
changed from
100644
to100755
r950fa0d r77205be 3 3 import com.fasterxml.jackson.annotation.JsonBackReference; 4 4 import com.fasterxml.jackson.annotation.JsonIgnore; 5 import com.fasterxml.jackson.annotation.JsonManagedReference; 5 6 import lombok.AllArgsConstructor; 6 7 import lombok.Getter; … … 13 14 import javax.persistence.*; 14 15 import java.time.LocalDateTime; 16 import java.util.List; 15 17 16 18 @Entity … … 33 35 private Integer price; 34 36 35 @OneToOne(cascade = CascadeType.PERSIST) 37 @Column(name = "cumulated_rating") 38 private Float rating = 0.0f; 39 40 @Column(name = "reviews_count") 41 private Integer reviewsCount = 0; 42 43 @OneToOne(cascade = CascadeType.MERGE) 36 44 @JoinColumn(name = "service_type_id", referencedColumnName = "id") 37 45 private ServiceType serviceType; … … 39 47 @ManyToOne 40 48 @JoinColumn(name = "business_id") 41 @JsonBackReference 49 @JsonBackReference(value = "services") 42 50 private Business business; 51 52 @OneToMany(mappedBy="service") 53 @JsonManagedReference(value = "serviceAppointments") 54 private List<Appointment> appointments; 43 55 44 56 @Column(name = "created") -
Property mode
changed from
-
src/main/java/edu/gjoko/schedlr/entity/ServiceType.java
-
Property mode
changed from
100644
to100755
-
Property mode
changed from
-
src/main/java/edu/gjoko/schedlr/entity/Stakeholder.java
-
Property mode
changed from
100644
to100755
r950fa0d r77205be 2 2 3 3 import com.fasterxml.jackson.annotation.JsonIgnore; 4 import com.fasterxml.jackson.annotation.JsonManagedReference; 4 5 import lombok.AllArgsConstructor; 5 6 import lombok.Getter; … … 12 13 import javax.persistence.*; 13 14 import java.time.LocalDateTime; 15 import java.util.List; 14 16 15 17 @Entity … … 39 41 private String email; 40 42 43 @Column(name = "phone_number") 44 private String phoneNumber; 45 41 46 @Column(name = "username") 42 47 private String username; … … 44 49 @Column(name = "password") 45 50 private String password; 51 52 @OneToMany(mappedBy = "customer") 53 @JsonManagedReference(value = "customerAppointments") 54 private List<Appointment> appointments; 46 55 47 56 @Column(name = "created") … … 54 63 @JsonIgnore 55 64 private LocalDateTime modified; 65 66 public String getFullName() { 67 return firstName + " " + lastName; 68 } 56 69 } -
Property mode
changed from
-
src/main/java/edu/gjoko/schedlr/entity/StakeholderType.java
-
Property mode
changed from
100644
to100755
-
Property mode
changed from
Note:
See TracChangeset
for help on using the changeset viewer.