Skip to content
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

Updated booking entity. #361

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

@Mapper(componentModel = "spring")
public interface BookingMapper {
@Mapping(source = "invoicePayableAt", target = "invoicePayableAt.id")
@Mapping(source = "placeOfIssueID", target = "placeOfIssue.id")
@Mapping(source = "invoicePayableAtId", target = "invoicePayableAt.id")
@Mapping(source = "placeOfIssueId", target = "placeOfIssue.id")
@Mapping(source = "communicationChannelCode", target = "communicationChannelCode")
@Mapping(source = "updatedDateTime", target = "bookingRequestUpdatedDateTime")
@Mapping(source = "bookingRequestDateTime", target = "bookingRequestCreatedDateTime")
BookingTO bookingToDTO(Booking booking);

@Mapping(source = "invoicePayableAt", target = "invoicePayableAt", ignore = true)
@Mapping(source = "invoicePayableAt", target = "invoicePayableAtId", ignore = true)
@Mapping(source = "communicationChannelCode", target = "communicationChannelCode")
@Mapping(source = "bookingRequestUpdatedDateTime", target = "updatedDateTime")
@Mapping(source = "bookingRequestCreatedDateTime", target = "bookingRequestDateTime")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ public Mono<BookingTO> fetchByBookingID(UUID bookingID) {
BookingTO bookingTO = bookingMapper.bookingToDTO(booking);
return Mono.when(
locationService
.fetchLocationByID(booking.getInvoicePayableAt())
.fetchLocationByID(booking.getInvoicePayableAtId())
.doOnNext(bookingTO::setInvoicePayableAt),
locationService
.fetchLocationByID(booking.getPlaceOfIssueID())
.fetchLocationByID(booking.getPlaceOfIssueId())
.doOnNext(bookingTO::setPlaceOfIssue),
fetchCommoditiesByBookingID(booking.getId())
.doOnNext(bookingTO::setCommodities),
Expand Down
17 changes: 6 additions & 11 deletions src/main/java/org/dcsa/core/events/model/Booking.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import java.time.OffsetDateTime;
import java.util.EnumSet;
import java.util.UUID;
import java.util.function.UnaryOperator;

import static org.dcsa.core.events.model.enums.ShipmentEventTypeCode.BOOKING_DOCUMENT_STATUSES;

Expand Down Expand Up @@ -92,9 +91,9 @@ public class Booking implements Persistable<UUID> {
@Column("incoterms")
private IncoTerms incoTerms;

@Column("invoice_payable_at")
@Column("invoice_payable_at_id")
@Size(max = 100)
private UUID invoicePayableAt;
private UUID invoicePayableAtId;

@Column("expected_departure_date")
private LocalDate expectedDepartureDate;
Expand Down Expand Up @@ -124,20 +123,16 @@ public class Booking implements Persistable<UUID> {
@Column("vessel_id")
private UUID vesselId;

@Column("export_voyage_number")
@Size(max = 50)
private String exportVoyageNumber;

@Column("declared_value_currency")
@Column("declared_value_currency_code")
@Size(max = 3)
private String declaredValueCurrency;
private String declaredValueCurrencyCode;

@Column("declared_value")
private Float declaredValue;

@Column("place_of_issue")
@Column("place_of_issue_id")
@Size(max = 100)
private UUID placeOfIssueID;
private UUID placeOfIssueId;

@JsonIgnore
@Column("pre_carriage_mode_of_transport_code")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ Mono<Booking> findByCarrierBookingRequestReferenceAndValidUntilIsNull(
Mono<Boolean> setVesselIDFor(UUID vesselId, UUID id);

@Modifying
@Query("UPDATE booking SET invoice_payable_at = :invoicePayableAt where id = :id")
Mono<Boolean> setInvoicePayableAtFor(UUID invoicePayableAt, UUID id);
@Query("UPDATE booking SET invoice_payable_at_id = :invoicePayableAtId where id = :id")
Mono<Boolean> setInvoicePayableAtFor(UUID invoicePayableAtId, UUID id);

@Modifying
@Query("UPDATE booking SET place_of_issue = :placeOfIssue where id = :id")
Mono<Boolean> setPlaceOfIssueIDFor(UUID placeOfIssue, UUID id);
@Query("UPDATE booking SET place_of_issue_id = :placeOfIssueId where id = :id")
Mono<Boolean> setPlaceOfIssueIDFor(UUID placeOfIssueId, UUID id);

@Modifying
@Query(
Expand Down