优化
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { portScheduleFieldGaps } from './fulfillment-list-field-contract.mjs'
|
||||
|
||||
const MODULE = 'phase3-port-schedules'
|
||||
const OPTIONS = { scenario: 'port-schedule-source-lifecycle', deploymentBlocker: true }
|
||||
const BASE = '/api/platform/v1/port-schedules'
|
||||
@@ -135,6 +137,7 @@ export async function run(context) {
|
||||
const createResponse = await request(context, 'POST', BASE, payload, { 'Idempotency-Key': createKey })
|
||||
const created = context.apiSuccess(MODULE, '新增独立港务船期观测', createResponse, '', OPTIONS)
|
||||
const scheduleId = id(created?.portSchedule?.schedule?.id)
|
||||
const scheduleFieldGaps = portScheduleFieldGaps(created)
|
||||
context.assert(MODULE, '船期来源、时效、截单截关截港和关联字段完整', createResponse,
|
||||
Boolean(scheduleId) && created?.portSchedule?.expired === false
|
||||
&& created?.portSchedule?.schedule?.sourceType === 'CARRIER'
|
||||
@@ -146,6 +149,8 @@ export async function run(context) {
|
||||
&& Boolean(created?.portSchedule?.schedule?.customsCutoffAt)
|
||||
&& Boolean(created?.portSchedule?.schedule?.portCutoffAt),
|
||||
`scheduleId=${scheduleId || 'missing'}, expired=${created?.portSchedule?.expired ?? 'missing'}`, OPTIONS)
|
||||
context.assert(MODULE, '船期列表来源、船名航次、港口与关键时间字段格式完整', createResponse,
|
||||
scheduleFieldGaps.length === 0, `missing=${scheduleFieldGaps.join(',') || 'none'}`, OPTIONS)
|
||||
if (!scheduleId) return
|
||||
|
||||
const replay = await request(context, 'POST', BASE, payload, { 'Idempotency-Key': createKey })
|
||||
|
||||
Reference in New Issue
Block a user