Ignore:
Timestamp:
02/06/22 18:15:51 (3 years ago)
Author:
Ema <ema_spirova@…>
Branches:
master
Children:
571e0df
Parents:
76712b2
Message:

add location feature

Location:
trip-planner/src/main/java/finki/diplomska/tripplanner/models
Files:
4 added
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trip-planner/src/main/java/finki/diplomska/tripplanner/models/Location.java

    r76712b2 r6fe77af  
    1414@Entity
    1515@Table(name = "locations")
    16 @NoArgsConstructor
    1716@AllArgsConstructor
    1817@Getter
     
    6564    private List<Planner> plannerList;
    6665
     66    @ManyToOne
     67    @JsonBackReference
     68    @JoinColumn(name = "id_user")
     69    private User user;
    6770
    6871    @ManyToMany
     
    7477    private List<Category> categoryList;
    7578
    76 
    7779    @OneToMany(mappedBy = "location", cascade = CascadeType.REMOVE, orphanRemoval = true)
    7880    @JsonManagedReference
    7981    private List<Images> imagesList;
    8082
     83    public Location(String name, String description, String address, String priority, int duration, String trivia, byte[] photo, Region region, City city, User user) {
     84        this.name = name;
     85        this.description = description;
     86        this.address = address;
     87        this.priority = priority;
     88        this.duration = duration;
     89        this.trivia = trivia;
     90        this.photo = photo;
     91        this.region = region;
     92        this.city = city;
     93        this.user = user;
     94    }
    8195
     96    public Location() {
     97    }
    8298}
  • trip-planner/src/main/java/finki/diplomska/tripplanner/models/User.java

    r76712b2 r6fe77af  
    22
    33import com.fasterxml.jackson.annotation.JsonIgnore;
     4import com.fasterxml.jackson.annotation.JsonManagedReference;
    45import lombok.AllArgsConstructor;
    56import lombok.Getter;
     
    4445    @JsonIgnore
    4546    private List<Planner> planners = new ArrayList<>();
     47
     48    @OneToMany(cascade = CascadeType.REFRESH, mappedBy = "user", orphanRemoval = true)
     49    @JsonIgnore
     50    private List<Location> locationList = new ArrayList<>();;
    4651
    4752    public User() {
Note: See TracChangeset for help on using the changeset viewer.