fix(firstleg): allow public sailing schedule dispatch fallback
This commit is contained in:
+3
-2
@@ -34,9 +34,10 @@ public interface PortScheduleMapper extends BaseMapper<PortScheduleEntity> {
|
||||
|
||||
@Select("""
|
||||
SELECT * FROM fl_port_schedule
|
||||
WHERE customer_id=#{customerId} AND ocean_booking_id=#{oceanBookingId}
|
||||
WHERE (customer_id=#{customerId} OR customer_id=0) AND ocean_booking_id=#{oceanBookingId}
|
||||
AND container_booking_id=#{containerBookingId}
|
||||
ORDER BY observed_at DESC,updated_at DESC,id DESC LIMIT 1
|
||||
ORDER BY CASE WHEN customer_id=#{customerId} THEN 0 ELSE 1 END,
|
||||
observed_at DESC,updated_at DESC,id DESC LIMIT 1
|
||||
""")
|
||||
PortScheduleEntity latestForDispatch(@Param("customerId") long customerId,
|
||||
@Param("oceanBookingId") long oceanBookingId,
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ public class PortScheduleDispatchGateContributor implements OutboundDispatchGate
|
||||
PortScheduleEntity schedule = repository.latestForDispatch(context.tenantId(), context.oceanBookingId(),
|
||||
context.containerBookingId());
|
||||
if (schedule == null) return gate(false, "MISSING");
|
||||
if (!java.util.Objects.equals(schedule.getCustomerId(), context.tenantId())
|
||||
if (!(java.util.Objects.equals(schedule.getCustomerId(), context.tenantId()) || schedule.getCustomerId() == 0L)
|
||||
|| !java.util.Objects.equals(schedule.getOceanBookingId(), context.oceanBookingId())
|
||||
|| !java.util.Objects.equals(schedule.getContainerBookingId(), context.containerBookingId())) {
|
||||
return gate(false, "ASSOCIATION_MISMATCH");
|
||||
|
||||
@@ -9,7 +9,7 @@ paths:
|
||||
summary: Query schedules by customer, ocean booking, allocated container or expiry
|
||||
x-permission: platform:firstleg:port-schedule:list
|
||||
parameters:
|
||||
- {name: customerId, in: query, schema: {type: string, pattern: '^[1-9][0-9]*$'}}
|
||||
- {name: customerId, in: query, schema: {type: string, pattern: '^(0|[1-9][0-9]*)$'}}
|
||||
- {name: oceanBookingId, in: query, schema: {type: string, pattern: '^[1-9][0-9]*$'}}
|
||||
- {name: containerBookingId, in: query, schema: {type: string, pattern: '^[1-9][0-9]*$'}}
|
||||
- {name: expired, in: query, schema: {type: boolean}}
|
||||
@@ -83,7 +83,7 @@ components:
|
||||
- observedAt
|
||||
- expiresAt
|
||||
properties:
|
||||
customerId: {type: string, pattern: '^[1-9][0-9]*$'}
|
||||
customerId: {type: string, pattern: '^(0|[1-9][0-9]*)$'}
|
||||
oceanBookingId: {type: string, pattern: '^[1-9][0-9]*$'}
|
||||
containerBookingId: {type: string, nullable: true, pattern: '^[1-9][0-9]*$'}
|
||||
sourceType: {type: string, enum: [MANUAL, CARRIER, TERMINAL, API]}
|
||||
|
||||
Reference in New Issue
Block a user