mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-04 15:14:10 +00:00
refactor(dtos): use @shumai/db/enums across DTO definitions
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
import { AgentType } from '@shumai/db/enums'
|
||||||
|
|
||||||
export const agentTypeSchema = z.enum(['chat', 'autofill', 'embedding'])
|
export { AgentType }
|
||||||
export type AgentType = z.infer<typeof agentTypeSchema>
|
export const agentTypeSchema = z.nativeEnum(AgentType)
|
||||||
|
|
||||||
export const thinkingLevelSchema = z.enum(['off', 'minimal', 'low', 'medium', 'high', 'xhigh'])
|
export const thinkingLevelSchema = z.enum(['off', 'minimal', 'low', 'medium', 'high', 'xhigh'])
|
||||||
export type ThinkingLevel = z.infer<typeof thinkingLevelSchema>
|
export type ThinkingLevel = z.infer<typeof thinkingLevelSchema>
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
import { InviteRole } from '@shumai/db/enums'
|
||||||
|
|
||||||
|
export { InviteRole }
|
||||||
|
|
||||||
export const inviteInfoSchema = z.object({
|
export const inviteInfoSchema = z.object({
|
||||||
code: z.string(),
|
code: z.string(),
|
||||||
role: z.enum(['editor', 'reviewer', 'owner']),
|
role: z.string(),
|
||||||
teamId: z.string(),
|
teamId: z.string(),
|
||||||
teamName: z.string(),
|
teamName: z.string(),
|
||||||
projectId: z.string().optional(),
|
projectId: z.string().optional(),
|
||||||
@@ -14,13 +17,13 @@ export const inviteInfoSchema = z.object({
|
|||||||
export type InviteInfo = z.infer<typeof inviteInfoSchema>
|
export type InviteInfo = z.infer<typeof inviteInfoSchema>
|
||||||
|
|
||||||
export const createTeamInviteRequestSchema = z.object({
|
export const createTeamInviteRequestSchema = z.object({
|
||||||
role: z.enum(['editor', 'reviewer']),
|
role: z.nativeEnum(InviteRole),
|
||||||
})
|
})
|
||||||
|
|
||||||
export type CreateTeamInviteRequest = z.infer<typeof createTeamInviteRequestSchema>
|
export type CreateTeamInviteRequest = z.infer<typeof createTeamInviteRequestSchema>
|
||||||
|
|
||||||
export const createProjectInviteRequestSchema = z.object({
|
export const createProjectInviteRequestSchema = z.object({
|
||||||
role: z.enum(['editor', 'reviewer']),
|
role: z.nativeEnum(InviteRole),
|
||||||
})
|
})
|
||||||
|
|
||||||
export type CreateProjectInviteRequest = z.infer<typeof createProjectInviteRequestSchema>
|
export type CreateProjectInviteRequest = z.infer<typeof createProjectInviteRequestSchema>
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
import { MetadataFieldScope } from '@shumai/db/enums'
|
||||||
|
|
||||||
|
export { MetadataFieldScope }
|
||||||
|
|
||||||
export const FieldType = {
|
export const FieldType = {
|
||||||
text: 'text',
|
text: 'text',
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
import type { NotificationType } from '@shumai/db'
|
import type { NotificationType } from '@shumai/db/enums'
|
||||||
|
|
||||||
export const teamUserInfoSchema = z.object({
|
export const teamUserInfoSchema = z.object({
|
||||||
id: z.string().optional(),
|
id: z.string().optional(),
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
import { UserType, TeamMemberScope } from '@shumai/db/enums'
|
||||||
import { paginationPageInfoSchema, paginationParamsSchema } from './pagination'
|
import { paginationPageInfoSchema, paginationParamsSchema } from './pagination'
|
||||||
|
|
||||||
|
export { UserType, TeamMemberScope }
|
||||||
|
|
||||||
export const createTeamRequestSchema = z.object({
|
export const createTeamRequestSchema = z.object({
|
||||||
name: z.string(),
|
name: z.string(),
|
||||||
})
|
})
|
||||||
@@ -50,9 +53,9 @@ export const userInfoSchema = z.object({
|
|||||||
name: z.string(),
|
name: z.string(),
|
||||||
role: z.enum(['owner', 'editor', 'reviewer', 'bot', 'unknown']),
|
role: z.enum(['owner', 'editor', 'reviewer', 'bot', 'unknown']),
|
||||||
email: z.string().optional(),
|
email: z.string().optional(),
|
||||||
type: z.enum(['human', 'agent']).optional(),
|
type: z.nativeEnum(UserType).optional(),
|
||||||
image: z.string().optional(),
|
image: z.string().optional(),
|
||||||
scope: z.enum(['team', 'project']).optional(),
|
scope: z.nativeEnum(TeamMemberScope).optional(),
|
||||||
})
|
})
|
||||||
export type UserInfo = z.infer<typeof userInfoSchema>
|
export type UserInfo = z.infer<typeof userInfoSchema>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user