feat(api-water): 支持上传水印图片
This commit is contained in:
@@ -2,3 +2,4 @@ export * from './collection';
|
||||
export * from './auth';
|
||||
export * from './stores';
|
||||
export * from './watermarks';
|
||||
export * from './media';
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
const checksum = z
|
||||
.string()
|
||||
.regex(/^[a-f0-9]{64}$/, '必须是 SHA-256 十六进制摘要');
|
||||
export const createMediaUploadIntentRequestSchema = z
|
||||
.object({
|
||||
purpose: z.literal('watermark_image'),
|
||||
filename: z.string().trim().min(1).max(255),
|
||||
content_type: z.enum(['image/png', 'image/jpeg', 'image/webp']),
|
||||
byte_size: z
|
||||
.number()
|
||||
.int()
|
||||
.min(1)
|
||||
.max(5 * 1024 * 1024),
|
||||
checksum_sha256: checksum,
|
||||
})
|
||||
.strict();
|
||||
export const completeMediaUploadIntentRequestSchema = z
|
||||
.object({
|
||||
checksum_sha256: checksum,
|
||||
})
|
||||
.strict();
|
||||
export const createMediaAccessUrlRequestSchema = z
|
||||
.object({
|
||||
purpose: z.literal('preview'),
|
||||
})
|
||||
.strict();
|
||||
|
||||
export type CreateMediaUploadIntentRequest = z.infer<
|
||||
typeof createMediaUploadIntentRequestSchema
|
||||
>;
|
||||
export type CompleteMediaUploadIntentRequest = z.infer<
|
||||
typeof completeMediaUploadIntentRequestSchema
|
||||
>;
|
||||
Reference in New Issue
Block a user