Changeset 3d60932 for src


Ignore:
Timestamp:
02/13/25 10:05:35 (4 months ago)
Author:
ste08 <sjovanoska@…>
Branches:
master
Children:
a70b5a4
Parents:
57e58a3
Message:

Fix commiT

Location:
src/main
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/skychasemk/dto/BookingDTO.java

    r57e58a3 r3d60932  
    1010    private Integer bookingID;
    1111    private Integer userID;
    12     private Flight flightId;
     12    private Integer flightId;
    1313    private LocalDate bookingDate;
    1414    private PaymentStatus status;
     
    1616    private Integer seatNumber;
    1717
    18     public Flight getFlightId() {
     18    public Integer getFlightId() {
    1919        return flightId;
    2020    }
    2121
    22     public void setFlightId(Flight flightId) {
     22    public void setFlightId(Integer flightId) {
    2323        this.flightId = flightId;
    2424    }
     
    4747    }
    4848
    49     public Flight getFlightID() {
     49    public Integer getFlightID() {
    5050        return flightId;
    5151    }
    5252
    53     public void setFlightID(Flight flightId) {
     53    public void setFlightID(Integer flightId) {
    5454        this.flightId = flightId;
    5555    }
  • src/main/java/com/example/skychasemk/dto/PaymentDTO.java

    r57e58a3 r3d60932  
    22
    33import lombok.Getter;
     4import lombok.Setter;
    45
    56import java.math.BigDecimal;
     
    1213    private Long paymentID;
    1314    @Getter
    14     private Integer bookingID;
     15    private Integer bookingId;
    1516    private Integer userID;
    1617    @Getter
     
    2223    @Getter
    2324    private PaymentStatus status;
     25    @Setter
    2426    @Getter
    2527    private Long flightId;
    26 
    27     public void setFlightId(Long flightId) {
    28         this.flightId = flightId;
    29     }
    3028
    3129    public enum PaymentStatus {
     
    4038        CREDIT
    4139    }
    42 
     40    public Integer getBookingID() {
     41        return bookingId;
     42    }
    4343    public void setPaymentID(Long paymentID) {
    4444        this.paymentID = paymentID;
    4545    }
    4646
    47     public void setBookingID(Integer bookingID) {
    48         this.bookingID = bookingID;
    49     }
    5047
    5148    public Long getUserID() {
  • src/main/java/com/example/skychasemk/model/Administrator.java

    r57e58a3 r3d60932  
    66@Entity
    77@Data
    8 @Table(name="Administrator")
     8@Table(name="administrator")
    99public class Administrator {
    1010    @Id
  • src/main/java/com/example/skychasemk/model/Airport.java

    r57e58a3 r3d60932  
    44
    55@Entity
    6 @Table(name="Airport")
     6@Table(name="airport")
    77public class Airport {
    88
    99    @Id
    1010    @GeneratedValue(strategy = GenerationType.IDENTITY)
    11     @Column(name = "AirportID")
     11    @Column(name = "airportid")
    1212    private Integer airportID;
    1313    @Column(name = "name")
  • src/main/java/com/example/skychasemk/model/ApplicationUser.java

    r57e58a3 r3d60932  
    99@Entity
    1010@Data
    11 @Table(name="ApplicationUser")
     11@Table(name="application_user")
    1212public class ApplicationUser {
    1313
     
    2929
    3030    private String password;
    31     @Column(name = "phoneNumber")
     31    @Column(name = "phone_number")
    3232
    3333    private String phoneNumber;
    3434
    35     @Column(name = "dateJoined")
     35    @Column(name = "date_joined")
    3636    private LocalDate dateJoined;
    3737
  • src/main/java/com/example/skychasemk/model/Booking.java

    r57e58a3 r3d60932  
    99
    1010@Entity
    11 @Table(name="Booking")
     11@Table(name="booking")
    1212public class Booking {
    1313
     
    1616    @Id
    1717    @GeneratedValue(strategy = GenerationType.IDENTITY)
    18     @Column(name = "BookingID")
     18    @Column(name = "bookingid")
    1919
    2020    private Integer bookingID;
    2121    @Setter
    2222    @Getter
    23     @Column(name = "UserID")
     23    @Column(name = "userid")
    2424
    2525    private Integer userID;
    2626
    27     //@Column(name = "flightid")
    28 
    29     //private Integer flightId;
    3027    @Column(name = "booking_date")
    3128
     
    4441    private Integer seat_number;
    4542
    46     @ManyToOne(fetch = FetchType.LAZY)
    47     @JoinColumn(name = "flightid")
    48     Flight flightId;
     43    @Column(name = "flightid")
     44    private Integer flightId;
    4945
    50     public Flight getFlightId() {
     46    public Integer getFlightId() {
    5147        return flightId;
    5248    }
    5349
    54     public void setFlightId(Flight flightId) {
     50    public void setFlightId(Integer flightId) {
    5551        this.flightId = flightId;
    5652    }
  • src/main/java/com/example/skychasemk/model/Destination.java

    r57e58a3 r3d60932  
    66
    77@Entity
    8 @Table(name="Destination")
     8@Table(name="destination")
    99public class Destination {
    1010
    1111    @Id
    1212    @GeneratedValue(strategy = GenerationType.IDENTITY)
    13     @Column(name = "DestinationID")
     13    @Column(name = "destinationid")
    1414
    1515    private Integer destinationID;
    16     @Column(name = "Name")
     16    @Column(name = "name")
    1717
    1818    private String name;
    19     @Column(name = "Country")
     19    @Column(name = "country")
    2020
    2121    private String country;
    22     @Column(name = "Description")
     22    @Column(name = "description")
    2323
    2424    private String description;
  • src/main/java/com/example/skychasemk/model/Flight.java

    r57e58a3 r3d60932  
    11package com.example.skychasemk.model;
    22
     3import com.fasterxml.jackson.annotation.JsonIgnore;
    34import jakarta.persistence.*;
    45import lombok.Getter;
     
    4243
    4344    private Integer availableSeats;
    44     @Column(name = "departureDate")
     45    @Column(name = "departure_date")
    4546
    4647    private LocalDate departureDate;
    4748
    48     @Column(name="returnDate")
     49    @Column(name="return_date")
    4950    private LocalDate returnDate;
    5051
    5152    @OneToMany(mappedBy = "flightId", fetch = FetchType.LAZY)
     53    @JsonIgnore
    5254    private List<Booking> bookings;
     55
     56    public Flight(){}
    5357
    5458}
  • src/main/java/com/example/skychasemk/model/Notification.java

    r57e58a3 r3d60932  
    55
    66@Entity
    7 @Table(name="Notification")
     7@Table(name="notification")
    88public class Notification {
    99
    1010    @Id
    1111    @GeneratedValue(strategy = GenerationType.IDENTITY)
    12     @Column(name = "NotificationID")
     12    @Column(name = "notificationid")
    1313
    1414    private Integer notificationID;
    15     @Column(name = "UserID")
     15    @Column(name = "userid")
    1616
    1717    private Integer userID;
    18     @Column(name = "Message")
     18    @Column(name = "message")
    1919
    2020    private String message;
    21     @Column(name = "Type")
     21    @Column(name = "type")
    2222
    2323    @Enumerated(EnumType.STRING)
  • src/main/java/com/example/skychasemk/model/Payment.java

    r57e58a3 r3d60932  
    1919    private Integer paymentID;
    2020
    21     @Column(name = "BookingID")
     21    @Column(name = "bookingid")
    2222
    2323    private Integer bookingID;
  • src/main/java/com/example/skychasemk/model/SupportTicket.java

    r57e58a3 r3d60932  
    1919
    2020    private Integer userID;
    21     @Column(name = "Subject")
    2221
    23     private String subject;
    2422    @Getter
    2523    @Column(name = "Description")
     
    6260    }
    6361
    64     public void setSubject(String subject) {
    65         this.subject = subject;
    66     }
    6762
    6863    public void setDescription(String description) {
  • src/main/java/com/example/skychasemk/repository/FlightRepository.java

    r57e58a3 r3d60932  
    1313public interface FlightRepository extends JpaRepository<Flight, Long> {
    1414
    15     @Query(value = "SELECT * FROM flight WHERE departure_airport = :departureID AND arrival_airport = :destinationID AND departureDate = :departureDate", nativeQuery = true)
     15    @Query(value = "SELECT * FROM flight WHERE departure_airport = :departureID AND arrival_airport = :destinationID AND departure_date = :departureDate", nativeQuery = true)
    1616    List<Flight> findFlights(@Param("departureID") Integer departureID,
    1717                             @Param("destinationID") Integer destinationID,
  • src/main/java/com/example/skychasemk/repository/ReviewRepository.java

    r57e58a3 r3d60932  
    33import com.example.skychasemk.model.Review;
    44import org.springframework.data.jpa.repository.JpaRepository;
     5import org.springframework.data.jpa.repository.Query;
     6
     7import java.util.List;
    58
    69public 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();
    812}
    913
  • src/main/java/com/example/skychasemk/services/ReviewService.java

    r57e58a3 r3d60932  
    1717    private ReviewRepository reviewRepository;
    1818
    19     // Get all reviews
    2019    public List<Review> getAllReviews() {
    21         return reviewRepository.findAll();
     20        return reviewRepository.findReviews();
    2221    }
    2322
    24     // Get review by ID
    2523    public Optional<Review> getReviewById(Integer reviewID) {
    2624        return reviewRepository.findById(reviewID);
  • src/main/java/com/example/skychasemk/services/SupportTicketService.java

    r57e58a3 r3d60932  
    4141        ticket.setDateCreated(LocalDate.now());
    4242        ticket.setStatus(OPEN);
    43         ticket.setSubject("Issue Opened");
    4443        ticket.setDescription(dto.getDescription());
    4544
  • src/main/resources/application.properties

    r57e58a3 r3d60932  
    1212# JPA Settings
    1313spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
    14 spring.jpa.hibernate.ddl-auto=update
     14spring.jpa.properties.hibernate.cache.use_second_level_cache=false
     15spring.jpa.properties.hibernate.cache.use_query_cache=false
    1516spring.jpa.show-sql=true
    1617
    1718spring.mvc.view.prefix=/static/
    1819spring.mvc.view.suffix=.html
     20
     21
     22
  • src/main/resources/static/FlightSearch.html

    r57e58a3 r3d60932  
    165165                const bookingDate = new Date().toISOString().split('T')[0];
    166166
     167
    167168                const bookingData = {
    168                     flightId: flight.flightId,
     169                    flightId: flight.flightID,
    169170                    bookingDate: bookingDate,
    170171                    status: 'PENDING',
     
    174175                axios.post('/api/bookings', bookingData)
    175176                    .then(response => {
     177                        const bookingID = response.data.bookingID;
    176178                        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)}`;
    178180                    })
    179181                    .catch(error => {
     
    189191
    190192                const wishlistData = {
    191                     targetId: flight.flightId,
     193                    targetId: flight.flightID,
    192194                    wishlisted: flight.wishlisted
    193195                };
     
    274276                    console.error("Error fetching flights", error);
    275277                });
    276             axios.get('api/bookings/getAll/${flight.flightID}')
     278            axios.get('api/bookings/getAll/${flight.flightId}')
    277279                .then(response => {
    278280                    console.log(response.data);
  • src/main/resources/static/ReviewPage.html

    r57e58a3 r3d60932  
    2020
    2121            <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>
    2525                    <span>{{ review.date }}</span>
    2626                </div>
     
    2929    </div>
    3030</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>
    3233<script>
    3334    new Vue({
    3435        el: '#app',
    3536        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: []
    5638        },
    5739        methods: {
    5840            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 = '/';
    6142            }
     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                });
    6253        }
    6354    });
  • src/main/resources/static/TransactionPage.html

    r57e58a3 r3d60932  
    5353        el: '#app',
    5454        data: {
     55            bookingId: '',
    5556            cardholder: '',
    5657            cardNumber: '',
     
    6364            this.flightId = urlParams.get('flightId');
    6465            this.amount = urlParams.get('amount');
     66            this.bookingId = urlParams.get('bookingId')
    6567
    6668            const user = JSON.parse(localStorage.getItem("user"));
     
    7981                    bookingId:this.bookingId
    8082                };
    81 
     83                console.log(transaction);
    8284                axios.post('api/payments', transaction)
    8385                    .then(response => {
    84                         console.log("Payment successful");
     86                        console.log(response.data);
    8587                        this.paymentSuccess = true;
    8688                        setTimeout(() => window.location.href = '/flights',2000);
  • src/main/resources/static/UserSignup.html

    r57e58a3 r3d60932  
    3535        <div class="form-group">
    3636            <label for="phoneNumber">Phone Number</label>
    37             <input type="text" id="phoneNumber" v-model="phoneNumber" required placeholder="Enter your phone number" />
     37            <input type="text" id="phoneNumber" v-model="phone_number" required placeholder="Enter your phone number" />
    3838        </div>
    3939
     
    5353            email: '',
    5454            password: '',
    55             phoneNumber: ''
     55            phone_number: ''
    5656        },
    5757        methods: {
    5858            signupUser() {
    59                 // Create user data object
    6059                const userData = {
    6160                    name: this.name,
     
    6362                    email: this.email,
    6463                    password: this.password,
    65                     phoneNumber: this.phoneNumber
     64                    phone_number: this.phone_number
    6665                };
    6766
    68                 // Send POST request to the backend
    6967                axios.post('http://localhost:8080/api/user/signup', userData)
    7068                    .then(response => {
  • src/main/resources/static/WishlistPage.html

    r57e58a3 r3d60932  
    8181            },
    8282            showReviews(flight) {
    83                 window.location.href = `/review?flightId=${flight.id}`;
     83                window.location.href = `/reviews?flightId=${flight.flightid}`;
    8484            },
    8585            logout() {
Note: See TracChangeset for help on using the changeset viewer.