fix: 移除项目入库接口标签数量限制
This commit is contained in:
@@ -4,9 +4,9 @@ import type { ProjectStatus, LinkType } from '@prisma/client'
|
||||
import { isValidApiKey } from '@/lib/auth'
|
||||
import {
|
||||
WebhookPayloadSchema,
|
||||
ProjectInputSchema,
|
||||
ProjectIngestionInputSchema,
|
||||
type WebhookPayload,
|
||||
type ProjectInput,
|
||||
type ProjectIngestionInput,
|
||||
} from '@/lib/validations'
|
||||
import {
|
||||
findExistingProject,
|
||||
@@ -67,7 +67,7 @@ export async function POST(request: NextRequest) {
|
||||
const projectData = payload.projects[i]
|
||||
|
||||
// Validate individual project
|
||||
const projectValidation = ProjectInputSchema.safeParse(projectData)
|
||||
const projectValidation = ProjectIngestionInputSchema.safeParse(projectData)
|
||||
|
||||
if (!projectValidation.success) {
|
||||
results.failed++
|
||||
@@ -82,7 +82,7 @@ export async function POST(request: NextRequest) {
|
||||
}
|
||||
|
||||
try {
|
||||
const validProject = projectValidation.data as ProjectInput
|
||||
const validProject = projectValidation.data as ProjectIngestionInput
|
||||
|
||||
// 多级去重:查找已存在的项目
|
||||
const existingProject = await findExistingProject(validProject)
|
||||
|
||||
@@ -53,6 +53,11 @@ export const ProjectInputSchema = ProjectBaseSchema.extend({
|
||||
links: z.array(ExternalLinkSchema).min(1, "At least one link is required").max(10),
|
||||
});
|
||||
|
||||
export const ProjectIngestionInputSchema = ProjectBaseSchema.extend({
|
||||
tags: z.array(TagSchema).min(1, "At least one tag is required"),
|
||||
links: z.array(ExternalLinkSchema).min(1, "At least one link is required").max(10),
|
||||
});
|
||||
|
||||
// ================================
|
||||
// Webhook Schemas
|
||||
// ================================
|
||||
@@ -62,7 +67,7 @@ export const WebhookAuthSchema = z.object({
|
||||
});
|
||||
|
||||
export const WebhookPayloadSchema = WebhookAuthSchema.extend({
|
||||
projects: z.array(ProjectInputSchema).min(1).max(100),
|
||||
projects: z.array(ProjectIngestionInputSchema).min(1).max(100),
|
||||
});
|
||||
|
||||
// ================================
|
||||
@@ -299,6 +304,7 @@ export const N8NChatJobResponseSchema = z.object({
|
||||
export type ExternalLink = z.infer<typeof ExternalLinkSchema>;
|
||||
export type Tag = z.infer<typeof TagSchema>;
|
||||
export type ProjectInput = z.infer<typeof ProjectInputSchema>;
|
||||
export type ProjectIngestionInput = z.infer<typeof ProjectIngestionInputSchema>;
|
||||
export type WebhookPayload = z.infer<typeof WebhookPayloadSchema>;
|
||||
export type ProjectQuery = z.infer<typeof ProjectQuerySchema>;
|
||||
export type TaskStatus = z.infer<typeof TaskStatusEnum>;
|
||||
|
||||
Reference in New Issue
Block a user