source: src/main/java/edu/gjoko/schedlr/entity/Business.java@ 46fd0c7

Last change on this file since 46fd0c7 was 46fd0c7, checked in by Gjoko Kostadinov <gjoko.kostadinov@…>, 16 months ago

Add admin page initial work.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1package edu.gjoko.schedlr.entity;
2
3import com.fasterxml.jackson.annotation.JsonManagedReference;
4import com.fasterxml.jackson.annotation.JsonProperty;
5import lombok.AllArgsConstructor;
6import lombok.Getter;
7import lombok.NoArgsConstructor;
8import lombok.Setter;
9import org.springframework.data.annotation.CreatedDate;
10import org.springframework.data.annotation.LastModifiedDate;
11import org.springframework.data.jpa.domain.support.AuditingEntityListener;
12
13import javax.persistence.*;
14import java.time.LocalDateTime;
15import java.util.List;
16
17@Entity
18@EntityListeners(AuditingEntityListener.class)
19@Table(name = "business")
20@Getter
21@Setter
22@NoArgsConstructor
23@AllArgsConstructor
24public class Business {
25
26 @Id
27 @GeneratedValue(strategy = GenerationType.SEQUENCE)
28 private Long id;
29
30 @Column(name = "company_name")
31 private String companyName;
32
33 @OneToOne
34 @JoinColumn(name = "business_type_id", referencedColumnName = "id")
35 @JsonProperty("businessType")
36 private BusinessType businessType;
37
38 @ManyToOne(cascade = CascadeType.PERSIST)
39 @JoinColumn(name = "owner_id", referencedColumnName = "id", nullable = false)
40 @JsonProperty("owner")
41 private Stakeholder owner;
42
43 @OneToMany(mappedBy = "business", cascade = CascadeType.PERSIST)
44 @JsonManagedReference
45 private List<Service> services;
46
47 @Column(name = "business_status")
48 @Enumerated(EnumType.STRING)
49 private BusinessStatus businessStatus;
50
51 @Column(name = "created")
52 @CreatedDate
53 private LocalDateTime created;
54
55 @Column(name = "modified")
56 @LastModifiedDate
57 private LocalDateTime modified;
58
59
60}
Note: See TracBrowser for help on using the repository browser.