Skip to content

Commit

Permalink
Merge pull request #10 from Prithvi333/prithvi_3
Browse files Browse the repository at this point in the history
code updated with more services , all team members work on it
  • Loading branch information
Prithvi333 authored Jun 16, 2023
2 parents 1528de0 + cda0d4e commit c950d38
Show file tree
Hide file tree
Showing 38 changed files with 965 additions and 251 deletions.
50 changes: 26 additions & 24 deletions src/main/java/com/masai/entity/Bus.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.masai.entity;

import java.util.ArrayList;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonIgnore;
Expand All @@ -25,36 +26,37 @@
@AllArgsConstructor
public class Bus {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer busId;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer busId;

@NotBlank(message = "Please provide the destination name")
@NotNull(message = "Please provide the destination name")
private String busType;
@NotBlank(message = "Please provide the destination name")
@NotNull(message = "Please provide the destination name")
private String busType;

@NotBlank(message = "Please provide the destination name")
@NotNull(message = "Please provide the destination name")
private String busNumber;
@NotBlank(message = "Please provide the destination name")
@NotNull(message = "Please provide the destination name")
private String busNumber;

@NotBlank(message = "Please provide the destination name")
@NotNull(message = "Please provide the destination name")
private Integer capacity;
@NotBlank(message = "Please provide the destination name")
@NotNull(message = "Please provide the destination name")
private Integer capacity;

@JsonIgnore
@ManyToMany(cascade = CascadeType.ALL)
private List<Route> routes;
private boolean status;

@JsonIgnore
@ManyToMany(cascade = CascadeType.ALL)
private List<Route> routes = new ArrayList<>();

@JoinColumn(name = "travels_id")
@ManyToOne(cascade = CascadeType.ALL)
@JsonIgnore
private Travels travel;


@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(name = "bus_destination",joinColumns = {@JoinColumn(referencedColumnName = "busId")},inverseJoinColumns = {@JoinColumn(referencedColumnName = "desId")})
private List<Destination> destinationList;
@JoinColumn(name = "travels_id")
@ManyToOne(cascade = CascadeType.ALL)
@JsonIgnore
private Travels travel;

@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(name = "bus_destination", joinColumns = {
@JoinColumn(referencedColumnName = "busId") }, inverseJoinColumns = {
@JoinColumn(referencedColumnName = "desId") })
private List<Destination> destinationList = new ArrayList<>();

}
107 changes: 52 additions & 55 deletions src/main/java/com/masai/entity/Customer.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.masai.entity;

import java.util.ArrayList;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonIgnore;
Expand All @@ -25,59 +26,55 @@
@Data
public class Customer {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer customerId;

@NotBlank(message = "Please provide the customer name")
@NotNull(message = "Please provide the customer name")
private String customerName;


@NotBlank(message = "Please provide the customer password")
@NotNull(message = "Please provide the customer password")
@Size(min = 6,max = 10,message = "min 6 and max 10 characters allowed only")
private String customerPassword;

@NotBlank(message = "Please provide the customer password")
@NotNull(message = "Please provide the customer password")
@Size(min = 6,message = "min 6 is characters required")
private String address;

@NotBlank(message = "Please provide the customer password")
@NotNull(message = "Please provide the customer password")
@Size(min = 15,max = 15,message = "min 15 and max 15 characters allowed only")
private String aadharId;


@NotNull(message = "Please select gender")
private Gender gender;

@NotBlank(message = "Please select your country")
@NotNull(message = "Please select your country")
private String country;


@NotBlank(message = "Please provide the customer password")
@NotNull(message = "Please provide the customer password")
@Size(min = 10,max = 10,message = "min 10 and max 10 characters allowed only")
private String mobileNo;

@Email(message = "email is not in correct format")
@NotBlank(message = "Please provide the email")
@NotNull(message = "Please provide the email")
private String email;


@OneToMany(cascade = CascadeType.ALL,mappedBy = "customerBooking",fetch = FetchType.EAGER)
@JsonIgnore
private List<HotelBooking> hotelBookings;

@OneToMany(cascade = CascadeType.ALL,mappedBy = "customer",fetch = FetchType.EAGER)
@JsonIgnore
private List<PackageBooking> packageBookings;

@JsonIgnore
@OneToMany(cascade = CascadeType.ALL,mappedBy = "customerFeedback")
private List<Feedback> feedback ;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer customerId;

@NotBlank(message = "Please provide the customer name")
@NotNull(message = "Please provide the customer name")
private String customerName;

@NotBlank(message = "Please provide the customer password")
@NotNull(message = "Please provide the customer password")
@Size(min = 6, max = 10, message = "min 6 and max 10 characters allowed only")
private String customerPassword;

@NotBlank(message = "Please provide the customer password")
@NotNull(message = "Please provide the customer password")
@Size(min = 6, message = "min 6 is characters required")
private String address;

@NotBlank(message = "Please provide the customer password")
@NotNull(message = "Please provide the customer password")
@Size(min = 15, max = 15, message = "min 15 and max 15 characters allowed only")
private String aadharId;

@NotNull(message = "Please select gender")
private Gender gender;

@NotBlank(message = "Please select your country")
@NotNull(message = "Please select your country")
private String country;

@NotBlank(message = "Please provide the customer password")
@NotNull(message = "Please provide the customer password")
@Size(min = 10, max = 10, message = "min 10 and max 10 characters allowed only")
private String mobileNo;

@Email(message = "email is not in correct format")
@NotBlank(message = "Please provide the email")
@NotNull(message = "Please provide the email")
private String email;

@OneToMany(cascade = CascadeType.ALL, mappedBy = "customerBooking", fetch = FetchType.EAGER)
@JsonIgnore
private List<HotelBooking> hotelBookings = new ArrayList<>();

@OneToMany(cascade = CascadeType.ALL, mappedBy = "customer", fetch = FetchType.EAGER)
@JsonIgnore
private List<PackageBooking> packageBookings = new ArrayList<>();

@JsonIgnore
@OneToMany(cascade = CascadeType.ALL, mappedBy = "customerFeedback")
private List<Feedback> feedback = new ArrayList<>();
}
31 changes: 17 additions & 14 deletions src/main/java/com/masai/entity/Destination.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

@Entity
Expand All @@ -16,23 +17,25 @@
@AllArgsConstructor
public class Destination {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer desId;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer desId;

@NotBlank(message = "Please provide the destination name")
@NotNull(message = "Please provide the destination name")
private String name;
@NotBlank(message = "Please provide the destination name")
@NotNull(message = "Please provide the destination name")
private String name;

@NotNull(message = "Please choose desEnvironment")
private DesEnvironment desEnvironment;
@NotNull(message = "Please choose desEnvironment")
private DesEnvironment desEnvironment;

@ManyToMany(cascade = CascadeType.ALL,mappedBy = "destinationList")
@JsonIgnore
private List<Bus> bus;
private boolean status;

@JsonIgnore
@OneToMany(mappedBy = "destination",cascade = CascadeType.ALL)
private List<Hotel> hotels;
@ManyToMany(cascade = CascadeType.ALL, mappedBy = "destinationList")
@JsonIgnore
private List<Bus> bus = new ArrayList<>();

@JsonIgnore
@OneToMany(mappedBy = "destination", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
private List<Hotel> hotels = new ArrayList<>();

}
78 changes: 40 additions & 38 deletions src/main/java/com/masai/entity/Hotel.java
Original file line number Diff line number Diff line change
@@ -1,56 +1,58 @@
package com.masai.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;

import jakarta.persistence.CascadeType;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDate;

@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Hotel {



@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer hotelId;

@NotBlank(message = "Please provide the hotel name")
@NotNull(message = "Please provide the hotel name")
private String hotelName;

@NotNull(message = "Please provide the hotel type")
@NotEmpty(message = "Please provide the hotel type")
private HotelType hotelType;

@NotNull(message = "Please provide the hotel description")
@NotEmpty(message = "Please provide the hotel description")
private String hotelDescription;

@NotNull(message = "Please provide the hotel address")
@NotEmpty(message = "Please provide the hotel address")
private String address;

@NotNull(message = "Please provide the rent details")
@NotEmpty(message = "Please provide the rent details")
private Double rent;

@NotNull(message = "Please provide the STATUS")
@NotEmpty(message = "Please provide the STATUS")
private HotelStatus status;

@JsonIgnore
@ManyToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "destin_id")
private Destination destination;

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer hotelId;

@NotBlank(message = "Please provide the hotel name")
@NotNull(message = "Please provide the hotel name")
private String hotelName;

@NotNull(message = "Please provide the hotel type")
@NotEmpty(message = "Please provide the hotel type")
private HotelType hotelType;

@NotNull(message = "Please provide the hotel description")
@NotEmpty(message = "Please provide the hotel description")
private String hotelDescription;

@NotNull(message = "Please provide the hotel address")
@NotEmpty(message = "Please provide the hotel address")
private String address;

@NotNull(message = "Please provide the rent details")
@NotEmpty(message = "Please provide the rent details")
private Double rent;
private boolean stats;
@NotNull(message = "Please provide the STATUS")
@NotEmpty(message = "Please provide the STATUS")
private HotelStatus status;

@JsonIgnore
@ManyToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "destin_id")
private Destination destination;

}
Loading

0 comments on commit c950d38

Please sign in to comment.