вложения, канальчики, бим-бим + бам-бам
This commit is contained in:
11
server/schemas/attachment.ts
Normal file
11
server/schemas/attachment.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
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' }),
|
||||
|
||||
// message: Type.MessageAttachment(),
|
||||
}, { title: 'Attachment', description: 'Attachment' })
|
||||
13
server/schemas/auth.ts
Normal file
13
server/schemas/auth.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { Type } from 'typebox'
|
||||
|
||||
export const UserSchema = Type.Object({
|
||||
id: Type.String(),
|
||||
username: Type.String(),
|
||||
displayName: Type.String(),
|
||||
createdAt: Type.String({ format: 'date-time' }),
|
||||
}, { title: 'User', description: 'User' })
|
||||
|
||||
export const CreateUserSchema = Type.Object({
|
||||
username: Type.String({ minLength: 1 }),
|
||||
password: Type.String({ minLength: 6 }),
|
||||
}, { title: 'CreateUser' })
|
||||
26
server/schemas/chat.ts
Normal file
26
server/schemas/chat.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { Type } from 'typebox'
|
||||
|
||||
export const ReplySchema = Type.Object({
|
||||
messageId: Type.String({ format: 'uuid' }),
|
||||
senderId: Type.String({ format: 'uuid' }),
|
||||
text: Type.String(),
|
||||
}, { title: 'Reply', description: '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' })),
|
||||
// replyTo: ReplySchema,
|
||||
}, { title: 'ChatMessage', description: 'ChatMessage' })
|
||||
|
||||
export const NewChatMessageSchema = Type.Object({
|
||||
text: Type.String({ minLength: 1 }),
|
||||
attachments: Type.Optional(Type.Array(Type.String({ format: 'uuid' }))),
|
||||
// replyTo: Type.Object({
|
||||
// messageId: Type.String({ format: 'uuid' }),
|
||||
// }),
|
||||
}, { title: 'NewChatMessage', description: 'NewChatMessage' })
|
||||
7
server/schemas/common.ts
Normal file
7
server/schemas/common.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { Type } from 'typebox'
|
||||
|
||||
export const ErrorReplySchema = Type.Object({
|
||||
statusCode: Type.Number(),
|
||||
error: Type.String(),
|
||||
message: Type.String(),
|
||||
}, { title: 'ResponseError', description: 'Response Error' })
|
||||
11
server/schemas/user.ts
Normal file
11
server/schemas/user.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { Type } from 'typebox'
|
||||
|
||||
export const UserPreferencesSchema = Type.Object({
|
||||
toggleInputHotkey: Type.String(),
|
||||
toggleOutputHotkey: Type.String(),
|
||||
}, { title: 'UserPreferences', description: 'UserPreferences' })
|
||||
|
||||
export const UpdateUserPreferencesSchema = Type.Partial(
|
||||
UserPreferencesSchema,
|
||||
{ title: 'UpdateUserPreferences', description: 'UpdateUserPreferences' },
|
||||
)
|
||||
Reference in New Issue
Block a user