This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { z } from "zod"
|
||||
|
||||
export const allowedImageContentTypes = ["image/jpeg", "image/png", "image/webp"] as const
|
||||
export const maxUploadSizeBytes = 10 * 1024 * 1024
|
||||
|
||||
export const presignUploadSchema = z.object({
|
||||
token: z.string().min(1),
|
||||
filename: z.string().trim().min(1).max(255),
|
||||
contentType: z.enum(allowedImageContentTypes),
|
||||
sizeBytes: z.number().int().positive().max(maxUploadSizeBytes),
|
||||
})
|
||||
|
||||
export const completeUploadSchema = presignUploadSchema.extend({
|
||||
objectKey: z.string().min(1),
|
||||
})
|
||||
|
||||
export type PresignUploadInput = z.infer<typeof presignUploadSchema>
|
||||
export type CompleteUploadInput = z.infer<typeof completeUploadSchema>
|
||||
Reference in New Issue
Block a user