[57e58a3] | 1 | package com.example.skychasemk.model;
|
---|
| 2 |
|
---|
[3d60932] | 3 | import com.fasterxml.jackson.annotation.JsonIgnore;
|
---|
[57e58a3] | 4 | import jakarta.persistence.*;
|
---|
| 5 | import lombok.Getter;
|
---|
| 6 | import lombok.Setter;
|
---|
| 7 |
|
---|
| 8 | import java.math.BigDecimal;
|
---|
| 9 | import java.time.LocalDate;
|
---|
| 10 | import java.time.LocalTime;
|
---|
| 11 | import java.util.List;
|
---|
| 12 |
|
---|
| 13 | @Setter
|
---|
| 14 | @Getter
|
---|
| 15 | @Entity
|
---|
| 16 | @Table(name="Flight")
|
---|
| 17 | public class Flight {
|
---|
| 18 |
|
---|
| 19 | // Getters and Setters
|
---|
| 20 | @Id
|
---|
| 21 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
| 22 | @Column(name = "FlightID")
|
---|
| 23 | private Long flightID;
|
---|
| 24 | @Column(name = "flight_number")
|
---|
| 25 |
|
---|
| 26 | private String flightNumber;
|
---|
| 27 | @Column(name = "departure_airport")
|
---|
| 28 |
|
---|
| 29 | private Integer departureAirport;
|
---|
| 30 | @Column(name = "arrival_airport")
|
---|
| 31 |
|
---|
| 32 | private Integer arrivalAirport;
|
---|
| 33 | @Column(name = "departure_time")
|
---|
| 34 |
|
---|
| 35 | private LocalTime departureTime;
|
---|
| 36 | @Column(name = "arrival_time")
|
---|
| 37 |
|
---|
| 38 | private LocalTime arrivalTime;
|
---|
| 39 | @Column(name = "Price")
|
---|
| 40 |
|
---|
| 41 | private BigDecimal price;
|
---|
| 42 | @Column(name = "available_seats")
|
---|
| 43 |
|
---|
| 44 | private Integer availableSeats;
|
---|
[3d60932] | 45 | @Column(name = "departure_date")
|
---|
[57e58a3] | 46 |
|
---|
| 47 | private LocalDate departureDate;
|
---|
| 48 |
|
---|
[3d60932] | 49 | @Column(name="return_date")
|
---|
[57e58a3] | 50 | private LocalDate returnDate;
|
---|
| 51 |
|
---|
| 52 | @OneToMany(mappedBy = "flightId", fetch = FetchType.LAZY)
|
---|
[3d60932] | 53 | @JsonIgnore
|
---|
[57e58a3] | 54 | private List<Booking> bookings;
|
---|
| 55 |
|
---|
[3d60932] | 56 | public Flight(){}
|
---|
| 57 |
|
---|
[57e58a3] | 58 | }
|
---|
| 59 |
|
---|