source: src/main/java/edu/gjoko/schedlr/entity/Service.java@ 1413ee2

Last change on this file since 1413ee2 was 1413ee2, checked in by gjoko kostadinov <gjokokostadinov@…>, 6 months ago

Add all bug fixes.

  • Property mode set to 100755
File size: 1.8 KB
Line 
1package edu.gjoko.schedlr.entity;
2
3import com.fasterxml.jackson.annotation.JsonBackReference;
4import com.fasterxml.jackson.annotation.JsonIgnore;
5import com.fasterxml.jackson.annotation.JsonManagedReference;
6import lombok.AllArgsConstructor;
7import lombok.Getter;
8import lombok.NoArgsConstructor;
9import lombok.Setter;
10import org.springframework.data.annotation.CreatedDate;
11import org.springframework.data.annotation.LastModifiedDate;
12import org.springframework.data.jpa.domain.support.AuditingEntityListener;
13
14import javax.persistence.*;
15import java.time.LocalDateTime;
16import java.util.List;
17
18@Entity
19@EntityListeners(AuditingEntityListener.class)
20@Table(name = "service")
21@Getter
22@Setter
23@NoArgsConstructor
24@AllArgsConstructor
25public class Service {
26
27 @Id
28 @GeneratedValue(strategy = GenerationType.SEQUENCE)
29 private Long id;
30
31 @Column(name = "duration")
32 private Integer duration;
33
34 @Column(name = "price")
35 private Integer price;
36
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)
44 @JoinColumn(name = "service_type_id", referencedColumnName = "id")
45 private ServiceType serviceType;
46
47 @ManyToOne
48 @JoinColumn(name = "business_id")
49 @JsonBackReference(value = "services")
50 private Business business;
51
52 @OneToMany(mappedBy="service")
53 @JsonManagedReference(value = "serviceAppointments")
54 private List<Appointment> appointments;
55
56 @Column(name = "service_status")
57 @Enumerated(EnumType.STRING)
58 private ServiceStatus serviceStatus;
59
60 @Column(name = "created")
61 @CreatedDate
62 @JsonIgnore
63 private LocalDateTime created;
64
65 @Column(name = "modified")
66 @LastModifiedDate
67 @JsonIgnore
68 private LocalDateTime modified;
69}
Note: See TracBrowser for help on using the repository browser.