работаем бля работаем

This commit is contained in:
2026-05-09 03:21:44 +06:00
parent f845777bac
commit 0b148c6a7d
169 changed files with 15816 additions and 1005 deletions

View File

@@ -0,0 +1,13 @@
import { Type } from 'typebox'
export const AttachmentSchema = Type.Object({
id: Type.String(),
name: Type.String(),
mimetype: Type.String(),
size: Type.Number({ minimum: 0 }),
createdAt: Type.String({ format: 'date-time' }),
}, { $id: 'Attachment' })
export const GetAttachmentParamsSchema = Type.Object({
id: Type.String({ format: 'uuid' }),
}, { $id: 'GetAttachmentParams' })

View File

@@ -0,0 +1,18 @@
import { Type } from 'typebox'
export const UserSchema = Type.Object({
id: Type.String(),
username: Type.String(),
displayName: Type.String(),
createdAt: Type.String({ format: 'date-time' }),
}, { $id: 'User' })
export const CreateUserPayloadSchema = Type.Object({
username: Type.String({ minLength: 1 }),
password: Type.String({ minLength: 6 }),
}, { $id: 'CreateUser' })
export const LoginPayloadSchema = Type.Object({
username: Type.String({ minLength: 1 }),
password: Type.String({ minLength: 1 }),
}, { $id: 'Login' })

View File

@@ -0,0 +1,13 @@
import { Type } from 'typebox'
export const ChannelSchema = Type.Object({
id: Type.String(),
ownerId: Type.Union([Type.String(), Type.Null()]),
name: Type.String(),
persistent: Type.Boolean(),
}, { $id: 'Channel' })
export const CreateChannelPayloadSchema = Type.Object({
name: Type.String(),
persistent: Type.Boolean(),
}, { $id: 'CreateChannelPayload' })

View File

@@ -0,0 +1,25 @@
import { Type } from 'typebox'
export const ReplySchema = Type.Object({
messageId: Type.String({ format: 'uuid' }),
senderId: Type.String({ format: 'uuid' }),
text: Type.String(),
}, { $id: 'Reply' })
export const ChatMessageSchema = Type.Object({
id: Type.String({ format: 'uuid' }),
senderId: Type.String({ format: 'uuid' }),
text: Type.String({ minLength: 1 }),
createdAt: Type.String({ format: 'date-time' }),
updatedAt: Type.String({ format: 'date-time' }),
attachments: Type.Array(Type.String({ format: 'uuid' })),
}, { $id: 'ChatMessage' })
export const NewChatMessagePayloadSchema = Type.Object({
text: Type.String({ minLength: 1 }),
attachments: Type.Optional(Type.Array(Type.String({ format: 'uuid' }))),
// replyTo: Type.Object({
// messageId: Type.String({ format: 'uuid' }),
// }),
}, { $id: 'NewChatMessagePayload' })

View File

@@ -0,0 +1,7 @@
import { Type } from 'typebox'
export const ResponseErrorSchema = Type.Object({
statusCode: Type.Number(),
error: Type.String(),
message: Type.String(),
}, { $id: 'ResponseError' })

View File

@@ -0,0 +1,6 @@
export * from './attachment.ts'
export * from './auth.ts'
export * from './channel.ts'
export * from './chat.ts'
export * from './common.ts'
export * from './user.ts'

View File

@@ -0,0 +1,19 @@
import { Type } from 'typebox'
export const GetUserQuerySchema = Type.Partial(Type.Object({
username: Type.String(),
}), { $id: 'GetUserQuery' })
export const UserPreferencesSchema = Type.Object({
toggleInputHotkey: Type.String(),
toggleOutputHotkey: Type.String(),
}, { $id: 'UserPreferences' })
export const UpdateUserPreferencesPayloadSchema = Type.Partial(
UserPreferencesSchema,
{ $id: 'UpdateUserPreferencesPayload' },
)
export const UpdateUserPayloadSchema = Type.Object({
displayName: Type.String(),
}, { $id: 'UpdateUserPayload' })