|
@ -14,7 +14,7 @@ import { MEDIA_PARTITION_KEY } from '../../constants' |
|
|
import { errorSchema } from '../../schemas' |
|
|
import { errorSchema } from '../../schemas' |
|
|
import { containerFor, getItem } from '../../lib/database' |
|
|
import { containerFor, getItem } from '../../lib/database' |
|
|
import { badRequestError, serverError } from '../../lib/errors' |
|
|
import { badRequestError, serverError } from '../../lib/errors' |
|
|
import { deleteMedia, generateSAS } from '../../lib/media' |
|
|
|
|
|
|
|
|
import { deleteMedia, generateSAS, getBlobUrl } from '../../lib/media' |
|
|
import { createId } from '../../lib/utils' |
|
|
import { createId } from '../../lib/utils' |
|
|
|
|
|
|
|
|
import { Media } from '../../types/collections' |
|
|
import { Media } from '../../types/collections' |
|
@ -30,6 +30,7 @@ function getSASRoute(server: FastifyInstance<Server, IncomingMessage, ServerResp |
|
|
type: 'object', |
|
|
type: 'object', |
|
|
properties: { |
|
|
properties: { |
|
|
sas: { type: 'string' }, |
|
|
sas: { type: 'string' }, |
|
|
|
|
|
blobUrl: { type: 'string' }, |
|
|
id: { type: 'string' }, |
|
|
id: { type: 'string' }, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
@ -40,6 +41,7 @@ function getSASRoute(server: FastifyInstance<Server, IncomingMessage, ServerResp |
|
|
server.get<DefaultQuery, DefaultParams, DefaultHeaders, DefaultBody>('/v1/sas', options, async () => { |
|
|
server.get<DefaultQuery, DefaultParams, DefaultHeaders, DefaultBody>('/v1/sas', options, async () => { |
|
|
return { |
|
|
return { |
|
|
sas: generateSAS('arcw', 5), |
|
|
sas: generateSAS('arcw', 5), |
|
|
|
|
|
blobUrl: getBlobUrl(), |
|
|
id: createId(), |
|
|
id: createId(), |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|