refactor(api): migrate snippet workspace endpoints to BaseModel (#37956)

Co-authored-by: Asuka Minato <i@asukaminato.eu.org>
This commit is contained in:
chariri
2026-07-09 04:21:27 +00:00
committed by GitHub
co-authored by Asuka Minato
parent 3cd8d850fa
commit 9bb3b1fa98
10 changed files with 28 additions and 99 deletions
@@ -1240,6 +1240,8 @@ export type PublishWorkflowPayload = {
knowledge_base_setting?: {
[key: string]: unknown
} | null
marked_comment?: string | null
marked_name?: string | null
}
export type WorkflowPublishResponse = {
@@ -767,6 +767,8 @@ export const zWorkflowDraftVariableUpdatePayload = z.object({
*/
export const zPublishWorkflowPayload = z.object({
knowledge_base_setting: z.record(z.string(), z.unknown()).nullish(),
marked_comment: z.string().max(100).nullish(),
marked_name: z.string().max(20).nullish(),
})
/**
@@ -201,6 +201,8 @@ export type PublishWorkflowPayload = {
knowledge_base_setting?: {
[key: string]: unknown
} | null
marked_comment?: string | null
marked_name?: string | null
}
export type WorkflowPublishResponse = {
@@ -123,6 +123,8 @@ export const zWorkflowDraftVariableUpdatePayload = z.object({
*/
export const zPublishWorkflowPayload = z.object({
knowledge_base_setting: z.record(z.string(), z.unknown()).nullish(),
marked_comment: z.string().max(100).nullish(),
marked_name: z.string().max(20).nullish(),
})
/**
@@ -52,7 +52,7 @@ export type CreateSnippetPayload = {
export type SnippetResponse = {
created_at: number
created_by: SnippetAccountResponse | null
created_by: SimpleAccountResponse | null
description: string | null
graph: {
[key: string]: unknown
@@ -69,7 +69,7 @@ export type SnippetResponse = {
tags: Array<SnippetTagResponse>
type: SnippetType
updated_at: number
updated_by: SnippetAccountResponse | null
updated_by: SimpleAccountResponse | null
use_count: number
version: number
}
@@ -1060,7 +1060,7 @@ export type InputFieldDefinition = {
type?: string | null
}
export type SnippetAccountResponse = {
export type SimpleAccountResponse = {
email: string
id: string
name: string
@@ -697,9 +697,9 @@ export const zCreateSnippetPayload = z.object({
})
/**
* SnippetAccountResponse
* SimpleAccountResponse
*/
export const zSnippetAccountResponse = z.object({
export const zSimpleAccountResponse = z.object({
email: z.string(),
id: z.string(),
name: z.string(),
@@ -726,7 +726,7 @@ export const zSnippetType = z.enum(['group', 'node'])
*/
export const zSnippetResponse = z.object({
created_at: z.int(),
created_by: zSnippetAccountResponse.nullable(),
created_by: zSimpleAccountResponse.nullable(),
description: z.string().nullable(),
graph: z.record(z.string(), z.unknown()),
icon_info: z.record(z.string(), z.unknown()).nullable(),
@@ -737,7 +737,7 @@ export const zSnippetResponse = z.object({
tags: z.array(zSnippetTagResponse),
type: zSnippetType,
updated_at: z.int(),
updated_by: zSnippetAccountResponse.nullable(),
updated_by: zSimpleAccountResponse.nullable(),
use_count: z.int(),
version: z.int(),
})