refactor: tighten upload and viewer contracts
This commit is contained in:
@@ -25,7 +25,7 @@ export function uploadLockConflictResponse() {
|
||||
return uploadErrorMessageResponse(UPLOAD_LOCK_ERROR, 409)
|
||||
}
|
||||
|
||||
export function parseStagingRequestBody(value: unknown): StagingRequestBody {
|
||||
function parseStagingRequestBody(value: unknown): StagingRequestBody {
|
||||
if (!isRecord(value) || typeof value.stagingId !== 'string' || value.stagingId.trim() === '') {
|
||||
throw new Error('stagingId manquant')
|
||||
}
|
||||
@@ -38,7 +38,7 @@ export async function readStagingRequestBody(req: Request): Promise<StagingReque
|
||||
return parseStagingRequestBody(body)
|
||||
}
|
||||
|
||||
export function parseDriveRequestBody(value: unknown): DriveRequestBody {
|
||||
function parseDriveRequestBody(value: unknown): DriveRequestBody {
|
||||
const { stagingId } = parseStagingRequestBody(value)
|
||||
|
||||
if (!isRecord(value) || (value.action !== 'new' && value.action !== 'replace')) {
|
||||
|
||||
Reference in New Issue
Block a user