Ignore:
Timestamp:
12/19/21 19:39:00 (3 years ago)
Author:
Ema <ema_spirova@…>
Branches:
master
Children:
bdd6491
Parents:
1ad8e64
Message:

spring security 2.0

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

Legend:

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

    r1ad8e64 r84d0fbb  
    11package finki.diplomska.tripplanner.models;
    22
     3import com.fasterxml.jackson.annotation.JsonIgnore;
    34import lombok.*;
    4 import reactor.util.annotation.Nullable;
    55
    66import javax.persistence.*;
     
    1010@Data
    1111@Table(name = "planners")
    12 @NoArgsConstructor
    1312@AllArgsConstructor
    1413@Getter
     
    3433    private List<Location> locationList;
    3534
     35    @ManyToOne(fetch = FetchType.EAGER)
     36    private User user;
    3637
    37     public Planner(String name, String description, List<Location> locationList){
     38    public Planner(){
     39    }
     40
     41    public Planner(String name, String description, List<Location> locationList, User user){
    3842            this.name = name;
    3943            this.description = description;
    4044            this.locationList = locationList;
     45            this.user = user;
    4146    }
    4247
  • trip-planner/src/main/java/finki/diplomska/tripplanner/models/User.java

    r1ad8e64 r84d0fbb  
    1111import javax.validation.constraints.Email;
    1212import javax.validation.constraints.NotBlank;
     13import java.util.ArrayList;
    1314import java.util.Collection;
    1415import java.util.Date;
     16import java.util.List;
    1517
    1618@Entity
     
    3840    private Date update_At;
    3941
    40     //OneToMany with Project
     42    //OneToMany with Planners
     43    @OneToMany(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER, mappedBy = "user", orphanRemoval = true)
     44    @JsonIgnore
     45    private List<Planner> planners = new ArrayList<>();
    4146
    4247    public User() {
    4348    }
    4449
     50    public User(String username, String fullName, String password, String confirmPassword) {
     51        this.username = username;
     52        this.fullName = fullName;
     53        this.password = password;
     54        this.confirmPassword = confirmPassword;
     55    }
    4556
    4657    @PrePersist
  • trip-planner/src/main/java/finki/diplomska/tripplanner/models/dto/PlannerDto.java

    r1ad8e64 r84d0fbb  
    99    private String name;
    1010    private String description;
     11    private String user;
    1112
    12     public PlannerDto(String name, String description) {
     13    public PlannerDto(String name, String description, String user) {
    1314        this.name = name;
    1415        this.description = description;
     16        this.user = user;
    1517    }
    1618}
  • trip-planner/src/main/java/finki/diplomska/tripplanner/models/dto/UserDto.java

    r1ad8e64 r84d0fbb  
    2020    private Date update_At;
    2121
    22     public UserDto(String username, String fullName, String password, String confirmPassword, Date create_At, Date update_At) {
     22    public UserDto(String username, String fullName, String password, String confirmPassword) {
    2323        this.username = username;
    2424        this.fullName = fullName;
    2525        this.password = password;
    2626        this.confirmPassword = confirmPassword;
    27         this.create_At = create_At;
    28         this.update_At = update_At;
     27
    2928    }
    3029}
Note: See TracChangeset for help on using the changeset viewer.