Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3553329
D12029.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D12029.diff
View Options
diff --git a/keyserver/src/uploads/uploads.js b/keyserver/src/uploads/uploads.js
--- a/keyserver/src/uploads/uploads.js
+++ b/keyserver/src/uploads/uploads.js
@@ -9,10 +9,11 @@
import {
type UploadMediaMetadataRequest,
type UploadMultimediaResult,
- uploadMultimediaResultValidator,
type UploadDeletionRequest,
type Dimensions,
+ type MultimediaUploadResult,
} from 'lib/types/media-types.js';
+import { MultimediaUploadResultValidator } from 'lib/types/validators/upload-validators.js';
import { ServerError } from 'lib/utils/errors.js';
import { tShape, tID } from 'lib/utils/validation-utils.js';
@@ -32,13 +33,6 @@
const upload = multer();
const multerProcessor: Middleware<> = upload.array('multimedia');
-type MultimediaUploadResult = {
- results: UploadMultimediaResult[],
-};
-const MultimediaUploadResultValidator = tShape<MultimediaUploadResult>({
- results: t.list(uploadMultimediaResultValidator),
-});
-
async function multimediaUploadResponder(
viewer: Viewer,
req: MulterRequest,
diff --git a/lib/types/media-types.js b/lib/types/media-types.js
--- a/lib/types/media-types.js
+++ b/lib/types/media-types.js
@@ -817,3 +817,7 @@
encryptedImageValidator,
encryptedVideoValidator,
]);
+
+export type MultimediaUploadResult = {
+ results: UploadMultimediaResult[],
+};
diff --git a/lib/types/validators/upload-validators.js b/lib/types/validators/upload-validators.js
new file mode 100644
--- /dev/null
+++ b/lib/types/validators/upload-validators.js
@@ -0,0 +1,12 @@
+// @flow
+
+import t, { type TInterface } from 'tcomb';
+
+import { tShape } from '../../utils/validation-utils.js';
+import { uploadMultimediaResultValidator } from '../media-types.js';
+import { type MultimediaUploadResult } from '../media-types.js';
+
+export const MultimediaUploadResultValidator: TInterface<MultimediaUploadResult> =
+ tShape<MultimediaUploadResult>({
+ results: t.list(uploadMultimediaResultValidator),
+ });
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 27, 8:35 PM (8 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2719880
Default Alt Text
D12029.diff (1 KB)
Attached To
Mode
D12029: [lib][keyserver] Move upload output validators to lib
Attached
Detach File
Event Timeline
Log In to Comment