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