source: src/main/java/edu/gjoko/schedlr/entity/Appointment.java@ 77205be

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

Add entire code

  • Property mode set to 100755
File size: 1.4 KB
Line 
1package edu.gjoko.schedlr.entity;
2
3import com.fasterxml.jackson.annotation.JsonBackReference;
4import lombok.*;
5import org.springframework.data.annotation.LastModifiedDate;
6import org.springframework.data.jpa.domain.support.AuditingEntityListener;
7
8import javax.persistence.*;
9import java.time.LocalDateTime;
10
11@Entity
12@EntityListeners(AuditingEntityListener.class)
13@Table(name = "appointment")
14@Data
15@NoArgsConstructor
16@AllArgsConstructor
17public class Appointment {
18
19 @Id
20 @GeneratedValue(strategy = GenerationType.AUTO)
21 private Long id;
22
23 @Column(name = "start_time")
24 private LocalDateTime startTime;
25
26 @Column(name = "end_time")
27 private LocalDateTime endTime;
28
29 @ManyToOne
30 @JoinColumn(name = "stakeholder_id")
31 @JsonBackReference(value = "customerAppointments")
32 private Stakeholder customer;
33
34 @ManyToOne
35 @JoinColumn(name = "service_id")
36 @JsonBackReference(value = "serviceAppointments")
37 private Service service;
38
39 @Column(name = "appointment_status", length = 32, columnDefinition = "varchar(32) default 'NEW'")
40 @Enumerated(EnumType.STRING)
41 private AppointmentStatus appointmentStatus = AppointmentStatus.NEW;
42
43 @Column(name = "created")
44 @LastModifiedDate
45 private LocalDateTime created;
46
47 @Column(name = "modified")
48 @LastModifiedDate
49 private LocalDateTime modified;
50
51 public String getTimePeriod() {
52 return startTime + " - " + endTime;
53 }
54
55}
Note: See TracBrowser for help on using the repository browser.