Skip to content

Commit

Permalink
Merge pull request #6 from Prithvi333/prem1
Browse files Browse the repository at this point in the history
entity_finished
  • Loading branch information
kumarprem66 authored Jun 13, 2023
2 parents 31d6ae1 + 2d62e63 commit 258da64
Show file tree
Hide file tree
Showing 25 changed files with 697 additions and 0 deletions.
48 changes: 48 additions & 0 deletions entities/Admin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.masaiproject.tripManagement.entities;


import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

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

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer adminId;

@NotNull(message = "Name is mandatory")
@Size(min = 3,max = 30,message = "Min 3 and Max 30 Characters is allowed only")
private String adminName;

@Size(min = 6,max = 10,message = "Min 3 and Max 30 Characters is allowed only")
@NotNull(message = "password is mandatory")
@NotBlank(message = "password is mandatory")
private String password;

@Email(message = "please provide correct email")
@NotBlank(message = "please provide correct email")
private String email;

@Size(min = 10,max = 10,message = "Min 10 and Max 30 Characters is allowed only")
@NotNull(message = "mobile is mandatory")
@NotBlank(message = "mobile is mandatory")
private String mobile;


@JsonIgnore
@OneToMany(cascade = CascadeType.ALL)
private List<Report> reports;
}
45 changes: 45 additions & 0 deletions entities/Booking.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.masaiproject.tripManagement.entities;

import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.CreatedDate;

import java.time.LocalDate;


@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@NoArgsConstructor
@AllArgsConstructor
public class Booking {

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

@NotNull(message = "booking type is important")
private String bookingType;


private String description;

@NotNull(message = "give any booking title")
private String bookingTitle;

@CreatedDate
private LocalDate bookingDate;

@NotNull(message = "mention the number of person that will be in this trip")
@NotBlank(message = "mention the number of person that will be in this trip")
private Integer number_Of_Person;






}
31 changes: 31 additions & 0 deletions entities/Bus.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.masaiproject.tripManagement.entities;

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

import java.time.LocalDate;
import java.util.List;

public class Bus {

private Integer busId;
private String busType;

private String busNumber;
private Integer capacity;

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


@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;


}
74 changes: 74 additions & 0 deletions entities/Customer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package com.masaiproject.tripManagement.entities;

import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDate;
import java.util.List;

@Entity
@NoArgsConstructor
@AllArgsConstructor
@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 = 6,max = 10,message = "min 15 and max 15 characters allowed only")
private String aadharId;


@NotBlank(message = "Please select gender")
@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;


@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "booking_id")
private Booking booking;

@JsonIgnore
@OneToMany(cascade = CascadeType.ALL,mappedBy = "customer")
private List<Feedback> feedback;
}
6 changes: 6 additions & 0 deletions entities/DesEnvironment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.masaiproject.tripManagement.entities;

public enum DesEnvironment {

HOT,COLD,NORMAL
}
23 changes: 23 additions & 0 deletions entities/Destination.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.masaiproject.tripManagement.entities;

import jakarta.persistence.CascadeType;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToMany;
import jakarta.persistence.OneToMany;

import java.util.List;

public class Destination {

private Integer desId;
private String name;
private DesEnvironment desEnvironment;

@ManyToMany(cascade = CascadeType.ALL,mappedBy = "destinationList")

private List<Bus> bus;

@OneToMany(mappedBy = "destination",cascade = CascadeType.ALL)
private List<Hotel> hotels;

}
19 changes: 19 additions & 0 deletions entities/Feedback.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.masaiproject.tripManagement.entities;

import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;

import java.time.LocalDate;

public class Feedback {

private Integer feedbackId;
private String feedback;
private String rating;

private LocalDate submitDate;

@ManyToOne()
@JoinColumn(name = "customer_id")
private Customer customer;
}
6 changes: 6 additions & 0 deletions entities/Gender.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.masaiproject.tripManagement.entities;

public enum Gender {

MALE,FEMALE,OTHER
}
56 changes: 56 additions & 0 deletions entities/Hotel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package com.masaiproject.tripManagement.entities;

import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
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;


}
18 changes: 18 additions & 0 deletions entities/HotelBooking.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.masaiproject.tripManagement.entities;

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

@Entity
@PrimaryKeyJoinColumn(name = "hotel_booking_id")
public class HotelBooking extends Booking{

@JsonIgnore
@OneToOne(cascade = CascadeType.ALL,mappedBy = "booking")
private Customer customer;


@OneToOne(cascade = CascadeType.ALL)
private Hotel hotel;

}
6 changes: 6 additions & 0 deletions entities/HotelStatus.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.masaiproject.tripManagement.entities;

public enum HotelStatus {

OPEN,CLOSED,FILLED,VACANT
}
6 changes: 6 additions & 0 deletions entities/HotelType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.masaiproject.tripManagement.entities;

public enum HotelType {

ONE_STAR,TWO_STAR,THREE_STAR,FOUR_STAR,FIVE_START
}
Loading

0 comments on commit 258da64

Please sign in to comment.