- Timestamp:
- 02/13/25 10:05:35 (4 months ago)
- Branches:
- master
- Children:
- a70b5a4
- Parents:
- 57e58a3
- Location:
- src/main
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/skychasemk/dto/BookingDTO.java
r57e58a3 r3d60932 10 10 private Integer bookingID; 11 11 private Integer userID; 12 private FlightflightId;12 private Integer flightId; 13 13 private LocalDate bookingDate; 14 14 private PaymentStatus status; … … 16 16 private Integer seatNumber; 17 17 18 public FlightgetFlightId() {18 public Integer getFlightId() { 19 19 return flightId; 20 20 } 21 21 22 public void setFlightId( FlightflightId) {22 public void setFlightId(Integer flightId) { 23 23 this.flightId = flightId; 24 24 } … … 47 47 } 48 48 49 public FlightgetFlightID() {49 public Integer getFlightID() { 50 50 return flightId; 51 51 } 52 52 53 public void setFlightID( FlightflightId) {53 public void setFlightID(Integer flightId) { 54 54 this.flightId = flightId; 55 55 } -
src/main/java/com/example/skychasemk/dto/PaymentDTO.java
r57e58a3 r3d60932 2 2 3 3 import lombok.Getter; 4 import lombok.Setter; 4 5 5 6 import java.math.BigDecimal; … … 12 13 private Long paymentID; 13 14 @Getter 14 private Integer bookingI D;15 private Integer bookingId; 15 16 private Integer userID; 16 17 @Getter … … 22 23 @Getter 23 24 private PaymentStatus status; 25 @Setter 24 26 @Getter 25 27 private Long flightId; 26 27 public void setFlightId(Long flightId) {28 this.flightId = flightId;29 }30 28 31 29 public enum PaymentStatus { … … 40 38 CREDIT 41 39 } 42 40 public Integer getBookingID() { 41 return bookingId; 42 } 43 43 public void setPaymentID(Long paymentID) { 44 44 this.paymentID = paymentID; 45 45 } 46 46 47 public void setBookingID(Integer bookingID) {48 this.bookingID = bookingID;49 }50 47 51 48 public Long getUserID() { -
src/main/java/com/example/skychasemk/model/Administrator.java
r57e58a3 r3d60932 6 6 @Entity 7 7 @Data 8 @Table(name=" Administrator")8 @Table(name="administrator") 9 9 public class Administrator { 10 10 @Id -
src/main/java/com/example/skychasemk/model/Airport.java
r57e58a3 r3d60932 4 4 5 5 @Entity 6 @Table(name=" Airport")6 @Table(name="airport") 7 7 public class Airport { 8 8 9 9 @Id 10 10 @GeneratedValue(strategy = GenerationType.IDENTITY) 11 @Column(name = " AirportID")11 @Column(name = "airportid") 12 12 private Integer airportID; 13 13 @Column(name = "name") -
src/main/java/com/example/skychasemk/model/ApplicationUser.java
r57e58a3 r3d60932 9 9 @Entity 10 10 @Data 11 @Table(name=" ApplicationUser")11 @Table(name="application_user") 12 12 public class ApplicationUser { 13 13 … … 29 29 30 30 private String password; 31 @Column(name = "phone Number")31 @Column(name = "phone_number") 32 32 33 33 private String phoneNumber; 34 34 35 @Column(name = "date Joined")35 @Column(name = "date_joined") 36 36 private LocalDate dateJoined; 37 37 -
src/main/java/com/example/skychasemk/model/Booking.java
r57e58a3 r3d60932 9 9 10 10 @Entity 11 @Table(name=" Booking")11 @Table(name="booking") 12 12 public class Booking { 13 13 … … 16 16 @Id 17 17 @GeneratedValue(strategy = GenerationType.IDENTITY) 18 @Column(name = " BookingID")18 @Column(name = "bookingid") 19 19 20 20 private Integer bookingID; 21 21 @Setter 22 22 @Getter 23 @Column(name = " UserID")23 @Column(name = "userid") 24 24 25 25 private Integer userID; 26 26 27 //@Column(name = "flightid")28 29 //private Integer flightId;30 27 @Column(name = "booking_date") 31 28 … … 44 41 private Integer seat_number; 45 42 46 @ManyToOne(fetch = FetchType.LAZY) 47 @JoinColumn(name = "flightid") 48 Flight flightId; 43 @Column(name = "flightid") 44 private Integer flightId; 49 45 50 public FlightgetFlightId() {46 public Integer getFlightId() { 51 47 return flightId; 52 48 } 53 49 54 public void setFlightId( FlightflightId) {50 public void setFlightId(Integer flightId) { 55 51 this.flightId = flightId; 56 52 } -
src/main/java/com/example/skychasemk/model/Destination.java
r57e58a3 r3d60932 6 6 7 7 @Entity 8 @Table(name=" Destination")8 @Table(name="destination") 9 9 public class Destination { 10 10 11 11 @Id 12 12 @GeneratedValue(strategy = GenerationType.IDENTITY) 13 @Column(name = " DestinationID")13 @Column(name = "destinationid") 14 14 15 15 private Integer destinationID; 16 @Column(name = " Name")16 @Column(name = "name") 17 17 18 18 private String name; 19 @Column(name = " Country")19 @Column(name = "country") 20 20 21 21 private String country; 22 @Column(name = " Description")22 @Column(name = "description") 23 23 24 24 private String description; -
src/main/java/com/example/skychasemk/model/Flight.java
r57e58a3 r3d60932 1 1 package com.example.skychasemk.model; 2 2 3 import com.fasterxml.jackson.annotation.JsonIgnore; 3 4 import jakarta.persistence.*; 4 5 import lombok.Getter; … … 42 43 43 44 private Integer availableSeats; 44 @Column(name = "departure Date")45 @Column(name = "departure_date") 45 46 46 47 private LocalDate departureDate; 47 48 48 @Column(name="return Date")49 @Column(name="return_date") 49 50 private LocalDate returnDate; 50 51 51 52 @OneToMany(mappedBy = "flightId", fetch = FetchType.LAZY) 53 @JsonIgnore 52 54 private List<Booking> bookings; 55 56 public Flight(){} 53 57 54 58 } -
src/main/java/com/example/skychasemk/model/Notification.java
r57e58a3 r3d60932 5 5 6 6 @Entity 7 @Table(name=" Notification")7 @Table(name="notification") 8 8 public class Notification { 9 9 10 10 @Id 11 11 @GeneratedValue(strategy = GenerationType.IDENTITY) 12 @Column(name = " NotificationID")12 @Column(name = "notificationid") 13 13 14 14 private Integer notificationID; 15 @Column(name = " UserID")15 @Column(name = "userid") 16 16 17 17 private Integer userID; 18 @Column(name = " Message")18 @Column(name = "message") 19 19 20 20 private String message; 21 @Column(name = " Type")21 @Column(name = "type") 22 22 23 23 @Enumerated(EnumType.STRING) -
src/main/java/com/example/skychasemk/model/Payment.java
r57e58a3 r3d60932 19 19 private Integer paymentID; 20 20 21 @Column(name = " BookingID")21 @Column(name = "bookingid") 22 22 23 23 private Integer bookingID; -
src/main/java/com/example/skychasemk/model/SupportTicket.java
r57e58a3 r3d60932 19 19 20 20 private Integer userID; 21 @Column(name = "Subject")22 21 23 private String subject;24 22 @Getter 25 23 @Column(name = "Description") … … 62 60 } 63 61 64 public void setSubject(String subject) {65 this.subject = subject;66 }67 62 68 63 public void setDescription(String description) { -
src/main/java/com/example/skychasemk/repository/FlightRepository.java
r57e58a3 r3d60932 13 13 public interface FlightRepository extends JpaRepository<Flight, Long> { 14 14 15 @Query(value = "SELECT * FROM flight WHERE departure_airport = :departureID AND arrival_airport = :destinationID AND departure Date = :departureDate", nativeQuery = true)15 @Query(value = "SELECT * FROM flight WHERE departure_airport = :departureID AND arrival_airport = :destinationID AND departure_date = :departureDate", nativeQuery = true) 16 16 List<Flight> findFlights(@Param("departureID") Integer departureID, 17 17 @Param("destinationID") Integer destinationID, -
src/main/java/com/example/skychasemk/repository/ReviewRepository.java
r57e58a3 r3d60932 3 3 import com.example.skychasemk.model.Review; 4 4 import org.springframework.data.jpa.repository.JpaRepository; 5 import org.springframework.data.jpa.repository.Query; 6 7 import java.util.List; 5 8 6 9 public interface ReviewRepository extends JpaRepository<Review, Integer> { 7 // Custom queries can be added here if needed 10 @Query("SELECT r from Review r where r.targetID = :flightId") 11 List<Review> findReviews(); 8 12 } 9 13 -
src/main/java/com/example/skychasemk/services/ReviewService.java
r57e58a3 r3d60932 17 17 private ReviewRepository reviewRepository; 18 18 19 // Get all reviews20 19 public List<Review> getAllReviews() { 21 return reviewRepository.find All();20 return reviewRepository.findReviews(); 22 21 } 23 22 24 // Get review by ID25 23 public Optional<Review> getReviewById(Integer reviewID) { 26 24 return reviewRepository.findById(reviewID); -
src/main/java/com/example/skychasemk/services/SupportTicketService.java
r57e58a3 r3d60932 41 41 ticket.setDateCreated(LocalDate.now()); 42 42 ticket.setStatus(OPEN); 43 ticket.setSubject("Issue Opened");44 43 ticket.setDescription(dto.getDescription()); 45 44 -
src/main/resources/application.properties
r57e58a3 r3d60932 12 12 # JPA Settings 13 13 spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect 14 spring.jpa.hibernate.ddl-auto=update 14 spring.jpa.properties.hibernate.cache.use_second_level_cache=false 15 spring.jpa.properties.hibernate.cache.use_query_cache=false 15 16 spring.jpa.show-sql=true 16 17 17 18 spring.mvc.view.prefix=/static/ 18 19 spring.mvc.view.suffix=.html 20 21 22 -
src/main/resources/static/FlightSearch.html
r57e58a3 r3d60932 165 165 const bookingDate = new Date().toISOString().split('T')[0]; 166 166 167 167 168 const bookingData = { 168 flightId: flight.flightI d,169 flightId: flight.flightID, 169 170 bookingDate: bookingDate, 170 171 status: 'PENDING', … … 174 175 axios.post('/api/bookings', bookingData) 175 176 .then(response => { 177 const bookingID = response.data.bookingID; 176 178 alert("Booked successfully!"); 177 window.location.href = `/transaction?amount=${encodeURIComponent(totalCost)} `;179 window.location.href = `/transaction?amount=${encodeURIComponent(totalCost)}&bookingId=${encodeURIComponent(bookingID)}&flightId=${encodeURIComponent(flight.flightID)}`; 178 180 }) 179 181 .catch(error => { … … 189 191 190 192 const wishlistData = { 191 targetId: flight.flightI d,193 targetId: flight.flightID, 192 194 wishlisted: flight.wishlisted 193 195 }; … … 274 276 console.error("Error fetching flights", error); 275 277 }); 276 axios.get('api/bookings/getAll/${flight.flightI D}')278 axios.get('api/bookings/getAll/${flight.flightId}') 277 279 .then(response => { 278 280 console.log(response.data); -
src/main/resources/static/ReviewPage.html
r57e58a3 r3d60932 20 20 21 21 <div class="review-list"> 22 <div v-for="review in reviews" :key="review. id" class="review-item">23 <h3> {{ review.subject }}</h3>24 <p>{{ review. description}}</p>22 <div v-for="review in reviews" :key="review.reviewid" class="review-item"> 23 <h3>Description</h3> 24 <p>{{ review.review_comment }}</p> 25 25 <span>{{ review.date }}</span> 26 26 </div> … … 29 29 </div> 30 30 </div> 31 31 <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script> 32 <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script> 32 33 <script> 33 34 new Vue({ 34 35 el: '#app', 35 36 data: { 36 reviews: [ 37 { 38 id: 1, 39 subject: 'Great experience!', 40 description: 'The flight was amazing, the service was excellent, and the views were breathtaking.', 41 date: '2025-02-01', 42 }, 43 { 44 id: 2, 45 subject: 'Good but delayed', 46 description: 'The flight was comfortable, but it was delayed by two hours, which caused some inconvenience.', 47 date: '2025-02-02', 48 }, 49 { 50 id: 3, 51 subject: 'Okay, but not perfect', 52 description: 'Everything was fine, but the food options could have been better.', 53 date: '2025-02-03', 54 }, 55 ] 37 reviews: [] 56 38 }, 57 39 methods: { 58 40 logout() { 59 // Logic to log out the user, e.g., clearing session or redirecting to home page 60 window.location.href = '/'; // Redirecting to home page 41 window.location.href = '/'; 61 42 } 43 }, 44 mounted() { 45 axios.get('api/reviews') 46 .then(response => { 47 this.reviews = response.data; 48 console.log(response.data); 49 }) 50 .catch(error => { 51 console.error("Error fetching reviews", error); 52 }); 62 53 } 63 54 }); -
src/main/resources/static/TransactionPage.html
r57e58a3 r3d60932 53 53 el: '#app', 54 54 data: { 55 bookingId: '', 55 56 cardholder: '', 56 57 cardNumber: '', … … 63 64 this.flightId = urlParams.get('flightId'); 64 65 this.amount = urlParams.get('amount'); 66 this.bookingId = urlParams.get('bookingId') 65 67 66 68 const user = JSON.parse(localStorage.getItem("user")); … … 79 81 bookingId:this.bookingId 80 82 }; 81 83 console.log(transaction); 82 84 axios.post('api/payments', transaction) 83 85 .then(response => { 84 console.log( "Payment successful");86 console.log(response.data); 85 87 this.paymentSuccess = true; 86 88 setTimeout(() => window.location.href = '/flights',2000); -
src/main/resources/static/UserSignup.html
r57e58a3 r3d60932 35 35 <div class="form-group"> 36 36 <label for="phoneNumber">Phone Number</label> 37 <input type="text" id="phoneNumber" v-model="phone Number" required placeholder="Enter your phone number" />37 <input type="text" id="phoneNumber" v-model="phone_number" required placeholder="Enter your phone number" /> 38 38 </div> 39 39 … … 53 53 email: '', 54 54 password: '', 55 phone Number: ''55 phone_number: '' 56 56 }, 57 57 methods: { 58 58 signupUser() { 59 // Create user data object60 59 const userData = { 61 60 name: this.name, … … 63 62 email: this.email, 64 63 password: this.password, 65 phone Number: this.phoneNumber64 phone_number: this.phone_number 66 65 }; 67 66 68 // Send POST request to the backend69 67 axios.post('http://localhost:8080/api/user/signup', userData) 70 68 .then(response => { -
src/main/resources/static/WishlistPage.html
r57e58a3 r3d60932 81 81 }, 82 82 showReviews(flight) { 83 window.location.href = `/review ?flightId=${flight.id}`;83 window.location.href = `/reviews?flightId=${flight.flightid}`; 84 84 }, 85 85 logout() {
Note:
See TracChangeset
for help on using the changeset viewer.