Ignore:
Timestamp:
02/05/23 19:55:10 (22 months ago)
Author:
Gjoko Kostadinov <gjoko.kostadinov@…>
Branches:
master
Children:
2b0a4db
Parents:
cc52b09
Message:

Adding customer registration

Location:
src/main/java/edu/gjoko/schedlr/entity
Files:
1 added
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/edu/gjoko/schedlr/entity/Business.java

    rcc52b09 ra436340  
    11package edu.gjoko.schedlr.entity;
    22
     3import com.fasterxml.jackson.annotation.JsonManagedReference;
    34import lombok.AllArgsConstructor;
    45import lombok.Getter;
     
    2526    private String name;
    2627
    27     @Column(name = "business_type")
    28     @Enumerated(EnumType.STRING)
     28    @OneToOne
     29    @JoinColumn(name = "business_type_id", referencedColumnName = "id")
    2930    private BusinessType businessType;
    3031
     
    3940    private Stakeholder owner;
    4041
     42    @OneToMany(mappedBy = "business")
     43    @JsonManagedReference
     44    private List<Service> services;
     45
    4146    @Column(name = "created")
    4247    private LocalDateTime created;
     
    4550    private LocalDateTime modified;
    4651
    47     @OneToMany(mappedBy = "business")
    48     private List<Service> services;
     52
    4953}
  • src/main/java/edu/gjoko/schedlr/entity/BusinessType.java

    rcc52b09 ra436340  
    11package edu.gjoko.schedlr.entity;
    22
    3 public enum BusinessType {
    4     TAILOR,
    5     NAIL_SALON,
    6     MASSAGE_PARLOR,
    7     MAKEUP_STUDIO,
    8     HAIRDRESSER,
    9     BARBER
     3import com.fasterxml.jackson.annotation.JsonIgnore;
     4import com.fasterxml.jackson.annotation.JsonManagedReference;
     5import com.fasterxml.jackson.annotation.JsonProperty;
     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 = "business_type")
     21@Getter
     22@Setter
     23@NoArgsConstructor
     24@AllArgsConstructor
     25public class BusinessType {
     26
     27    @Id
     28    @GeneratedValue(strategy = GenerationType.SEQUENCE)
     29    @JsonProperty("value")
     30    private Long id;
     31
     32    @Column(name = "name")
     33    @JsonProperty("text")
     34    private String name;
     35
     36    @OneToMany(mappedBy="businessType")
     37    @JsonManagedReference
     38    private List<ServiceType> serviceTypes;
     39
     40    @Column(name = "created")
     41    @CreatedDate
     42    @JsonIgnore
     43    private LocalDateTime created;
     44
     45    @Column(name = "modified")
     46    @LastModifiedDate
     47    @JsonIgnore
     48    private LocalDateTime modified;
    1049}
  • src/main/java/edu/gjoko/schedlr/entity/Service.java

    rcc52b09 ra436340  
    11package edu.gjoko.schedlr.entity;
    22
     3import com.fasterxml.jackson.annotation.JsonBackReference;
    34import lombok.AllArgsConstructor;
    45import lombok.Getter;
     
    3536    private Float price;
    3637
     38    @OneToOne
     39    @JoinColumn(name = "service_type_id", referencedColumnName = "id")
     40    private ServiceType serviceType;
     41
    3742    @ManyToOne
    38     @JoinColumn(name = "business_id")
     43    @JoinColumn(name="business_fk")
     44    @JsonBackReference
    3945    private Business business;
    4046
Note: See TracChangeset for help on using the changeset viewer.