-
Notifications
You must be signed in to change notification settings - Fork 7
#8 Adds Event Endpoint, Auditing entity #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#8 Adds Event Endpoint, Auditing entity #18
Conversation
…pe, SeatTypeInShow, Vendor, Venue
...ackend/java/bms-monolith/src/main/java/org/lbcc/bms/bms_monolith/BmsMonolithApplication.java
Outdated
Show resolved
Hide resolved
...nd/java/bms-monolith/src/main/java/org/lbcc/bms/bms_monolith/controller/EventController.java
Outdated
Show resolved
Hide resolved
...nd/java/bms-monolith/src/main/java/org/lbcc/bms/bms_monolith/controller/EventController.java
Outdated
Show resolved
Hide resolved
...nd/java/bms-monolith/src/main/java/org/lbcc/bms/bms_monolith/controller/EventController.java
Outdated
Show resolved
Hide resolved
...a/bms-monolith/src/main/java/org/lbcc/bms/bms_monolith/common/entity/BaseAuditingEntity.java
Show resolved
Hide resolved
...-my-show/backend/java/bms-monolith/src/main/java/org/lbcc/bms/bms_monolith/entity/Event.java
Show resolved
Hide resolved
...-my-show/backend/java/bms-monolith/src/main/java/org/lbcc/bms/bms_monolith/entity/Event.java
Show resolved
Hide resolved
...-my-show/backend/java/bms-monolith/src/main/java/org/lbcc/bms/bms_monolith/entity/Event.java
Show resolved
Hide resolved
...-my-show/backend/java/bms-monolith/src/main/java/org/lbcc/bms/bms_monolith/entity/Event.java
Show resolved
Hide resolved
.../backend/java/bms-monolith/src/main/java/org/lbcc/bms/bms_monolith/audit/AuditAwareImpl.java
Outdated
Show resolved
Hide resolved
...show/backend/java/bms-monolith/src/main/java/org/lbcc/bms/bms_monolith/entity/EventShow.java
Show resolved
Hide resolved
...show/backend/java/bms-monolith/src/main/java/org/lbcc/bms/bms_monolith/entity/EventShow.java
Outdated
Show resolved
Hide resolved
...show/backend/java/bms-monolith/src/main/java/org/lbcc/bms/bms_monolith/entity/EventShow.java
Show resolved
Hide resolved
| private Event event; | ||
|
|
||
| @OneToMany(mappedBy = "show", cascade = CascadeType.ALL, fetch = FetchType.LAZY) | ||
| private List<SeatInShow> seatInShows; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Builder.Default
private List seatInShows = new ArrayList<>();
...backend/java/bms-monolith/src/main/java/org/lbcc/bms/bms_monolith/entity/SeatTypeInShow.java
Outdated
Show resolved
Hide resolved
...backend/java/bms-monolith/src/main/java/org/lbcc/bms/bms_monolith/entity/SeatTypeInShow.java
Show resolved
Hide resolved
...my-show/backend/java/bms-monolith/src/main/java/org/lbcc/bms/bms_monolith/entity/Vendor.java
Show resolved
Hide resolved
...-my-show/backend/java/bms-monolith/src/main/java/org/lbcc/bms/bms_monolith/entity/Venue.java
Show resolved
Hide resolved
book-my-show/backend/java/bms-monolith/src/main/resources/application.yaml
Outdated
Show resolved
Hide resolved
...a/bms-monolith/src/main/java/org/lbcc/bms/bms_monolith/exception/GlobalExceptionHandler.java
Show resolved
Hide resolved
...java/bms-monolith/src/main/java/org/lbcc/bms/bms_monolith/service/impl/EventServiceImpl.java
Outdated
Show resolved
Hide resolved
...java/bms-monolith/src/main/java/org/lbcc/bms/bms_monolith/service/impl/EventServiceImpl.java
Outdated
Show resolved
Hide resolved
...nd/java/bms-monolith/src/main/java/org/lbcc/bms/bms_monolith/repository/EventRepository.java
Outdated
Show resolved
Hide resolved
| @Repository | ||
| public interface EventRepository extends JpaRepository<Event, UUID> { | ||
|
|
||
| @Query("SELECT e FROM Event e JOIN FETCH e.vendor JOIN FETCH e.venue JOIN FETCH e.eventType") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is not required. Bydefault JPA will use Joins. We can test it by running the code and checking hibernate logs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, it seems there is an issue with the entity mapping, resulting in an entity not found exception
...backend/java/bms-monolith/src/main/java/org/lbcc/bms/bms_monolith/service/IEventService.java
Outdated
Show resolved
Hide resolved
|
|
||
| public static final String STATUS_200 = "200"; | ||
| public static final String MESSAGE_200 = "Request processed successfully"; | ||
| public static final String EVENT_SUCCESS_MESSAGE = "Events fetched successfully"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could use interface for constants , I am not sure creating constant in class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nareshthecoder No, interface can be inherited and usually Interface in Java is used to define API not constants.
...nd/java/bms-monolith/src/main/java/org/lbcc/bms/bms_monolith/controller/EventController.java
Outdated
Show resolved
Hide resolved
| @Override | ||
| public ApiListResponse<Event> getAllEvents(int page, int size) { | ||
| try { | ||
| Page<Event> eventsPage = eventRepository.findAllWithDetails(PageRequest.of(page, size)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need default sorting for fetching data ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DTO is not required?
| @NotNull | ||
| private Instant startDate; | ||
|
|
||
| @NotNull |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NotNull will enforce a not null check from the application side, but it will not create a NOT NULL constraint on the database end. Bothe has to be added.
What is missing here is the Request, Response, and DTO layers.
@NotNull and similar spring validation should be in Request layer
Entity should have @column(nullable = false)
| public interface IEventRepository extends JpaRepository<Event, UUID> { | ||
|
|
||
| @Query("SELECT e FROM Event e JOIN FETCH e.vendor JOIN FETCH e.venue JOIN FETCH e.eventType") | ||
| @Query("SELECT e FROM Event e JOIN FETCH e.vendor JOIN FETCH e.venue JOIN FETCH e.eventType ORDER BY e.startDate DESC") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This query is still not required. Just passing the pageable will do the job. @manytoone annotation are FetchType.Eager by default hence JPA will use joins to fetch data.
* #8 Adds init spring-boot project * #8 Adds Instant type jackson converter * #8 Adds ApiErrorResponse * #8 Adds ApiResponse * #8 Adds ApiListResponse * #8 Adds TestBaseAuditingEntity * Feature/8 user portal part 1 (#17) * #8 Adds init spring-boot project * #8 Adds Instant type jackson converter * #8 Adds ApiErrorResponse * #8 Adds ApiResponse * #8 Adds ApiListResponse * #8 Adds TestBaseAuditingEntity * #8 Adds Event Endpoint, Auditing entity (#18) * #8 Adds AuditingEntityListener * #8 Adds BookingStatus, Genre, OperationalStatus, VendorStatus, VenueType enums * #8 Add entities Event, EventShow, EventType, Seat, SeatInShow, SeatType, SeatTypeInShow, Vendor, Venue * #8 Add getAllEvents endpoints * #8 Add test cases for getAllEvents endpoints * Resolved reviewed comments * Resolved reviewed comments * #8 Resolved reviewed comments * Refactor code to events package * Adds response layer, fix test cases. Removes sonar lints --------- Co-authored-by: damini1994 <55175815+damini1994@users.noreply.github.com>
No description provided.