feat: add shared dashboard API contracts
This commit is contained in:
1 parent
939cf408a0
commit
59c3a61a88
14 files changed
+648
No files matched your search
@@ -0,0 +1,32 @@
|
||||
import { z } from 'zod';
|
||||
import { RejectedActionResponseSchema, SuccessResponseSchema } from './common.js';
|
||||
|
||||
export const MediaItemSchema = z.strictObject({
|
||||
id: z.string(),
|
||||
chatUsername: z.string().nullable(),
|
||||
chatRoomId: z.string().nullable(),
|
||||
sender: z.string(),
|
||||
timestamp: z.number(),
|
||||
originalUrl: z.string(),
|
||||
fileName: z.string(),
|
||||
relativePath: z.string(),
|
||||
createdAt: z.number(),
|
||||
urlPath: z.string(),
|
||||
});
|
||||
export const MediaResponseSchema = z.array(MediaItemSchema);
|
||||
export const MediaSyncStatusSchema = z.strictObject({
|
||||
isSyncing: z.boolean(),
|
||||
lastSyncAt: z.number().nullable(),
|
||||
lastSyncDurationMs: z.number().nullable(),
|
||||
lastSyncChats: z.number().nullable(),
|
||||
lastError: z.string().nullable(),
|
||||
nextSyncAt: z.number().nullable(),
|
||||
});
|
||||
export const MediaSyncRequestSchema = z.strictObject({ full: z.boolean().optional() });
|
||||
export const MediaSyncTriggerResponseSchema = z.union([
|
||||
SuccessResponseSchema,
|
||||
RejectedActionResponseSchema,
|
||||
]);
|
||||
|
||||
export type MediaItem = z.infer<typeof MediaItemSchema>;
|
||||
export type MediaSyncStatus = z.infer<typeof MediaSyncStatusSchema>;
|
||||
Reference in new issue
Block a user