返回 presentation-ai
uploaded-image-actions.ts
根目录 / src / app / _actions / presentation / uploaded-image-actions.ts
1 "use server";
2
3 import { z } from "zod";
4
5 import { auth } from "@/server/auth";
6
7 const uploadedImagesInputSchema = z.object({
8 limit: z.number().int().min(1).max(60).default(30),
9 page: z.number().int().min(1).default(1),
10 });
11
12 export type UploadedPresentationImage = {
13 createdAt: string;
14 id: string;
15 mimeType: string;
16 name: string;
17 url: string;
18 };
19
20 export async function getUploadedImages(input?: {
21 limit?: number;
22 page?: number;
23 }): Promise<UploadedPresentationImage[]> {
24 const session = await auth();
25 const userId = session?.user?.id;
26 if (!userId) {
27 throw new Error("Unauthorized");
28 }
29
30 uploadedImagesInputSchema.parse(input ?? {});
31
32 return [];
33 }
34
34 lines TYPESCRIPT