261020_02_FIX: 짧은 비동기 작업 종료 시 리스트 및 배정 목록이 갱신되지 않는 오류 수정
This commit is contained in:
@@ -66,12 +66,18 @@ export type ListJobBlocker = {
|
||||
regDt: string
|
||||
}
|
||||
|
||||
export type ListMutationCompletion = {
|
||||
finishedCount: number
|
||||
lastFinishedAt: string | null
|
||||
}
|
||||
|
||||
export type ListJobAvailability = {
|
||||
requestedJobType: string
|
||||
allowed: boolean
|
||||
reasonCode: string | null
|
||||
blockerCount: number
|
||||
blockers: ListJobBlocker[]
|
||||
mutationCompletion?: ListMutationCompletion
|
||||
}
|
||||
|
||||
export const isActiveListJob = (status: ListJobStatus) =>
|
||||
@@ -146,11 +152,31 @@ export function parseListJobAvailability(value: unknown): ListJobAvailability {
|
||||
|| typeof body.blockerCount !== 'number' || !Array.isArray(body.blockers) || !body.blockers.every(isBlocker)) {
|
||||
throw new Error('작업 가능 여부 응답이 올바르지 않습니다.')
|
||||
}
|
||||
const completion = body.mutationCompletion
|
||||
let mutationCompletion: ListMutationCompletion | undefined
|
||||
if (completion !== undefined) {
|
||||
if (!completion || typeof completion !== 'object'
|
||||
|| !('finishedCount' in completion) || typeof completion.finishedCount !== 'number'
|
||||
|| !Number.isSafeInteger(completion.finishedCount) || completion.finishedCount < 0
|
||||
|| !('lastFinishedAt' in completion)
|
||||
|| !(completion.lastFinishedAt === null || typeof completion.lastFinishedAt === 'string')
|
||||
|| !(completion.finishedCount === 0 ? completion.lastFinishedAt === null
|
||||
: typeof completion.lastFinishedAt === 'string'
|
||||
&& /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(completion.lastFinishedAt)
|
||||
&& !Number.isNaN(Date.parse(completion.lastFinishedAt)))) {
|
||||
throw new Error('작업 종료 요약 응답이 올바르지 않습니다.')
|
||||
}
|
||||
mutationCompletion = {
|
||||
finishedCount: completion.finishedCount,
|
||||
lastFinishedAt: completion.lastFinishedAt,
|
||||
}
|
||||
}
|
||||
return {
|
||||
requestedJobType: body.requestedJobType,
|
||||
allowed: body.allowed,
|
||||
reasonCode: body.reasonCode,
|
||||
blockerCount: body.blockerCount,
|
||||
blockers: body.blockers,
|
||||
...(mutationCompletion === undefined ? {} : { mutationCompletion }),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user