feat(pages): add /application/[guildId]/[channelId] (#4)

This commit is contained in:
Divlo
2022-01-01 20:42:25 +01:00
committed by GitHub
parent 91e246b759
commit fdc2a2d1de
118 changed files with 6040 additions and 2094 deletions

View File

@ -1,9 +1,7 @@
import { Type } from '@sinclair/typebox'
import { Type, Static } from '@sinclair/typebox'
import { date, id } from './utils'
export const types = [Type.Literal('text')]
export const channelSchema = {
id,
name: Type.String({ minLength: 1, maxLength: 20 }),
@ -11,3 +9,5 @@ export const channelSchema = {
updatedAt: date.updatedAt,
guildId: id
}
const channelObjectSchema = Type.Object(channelSchema)
export type Channel = Static<typeof channelObjectSchema>

View File

@ -12,20 +12,30 @@ export const guildSchema = {
createdAt: date.createdAt,
updatedAt: date.updatedAt
}
export const guildObjectSchema = Type.Object(guildSchema)
export type Guild = Static<typeof guildObjectSchema>
export const guildWithDefaultChannelIdSchema = {
...guildSchema,
defaultChannelId: id
}
export const guildWithDefaultChannelObjectSchema = Type.Object(
guildWithDefaultChannelIdSchema
)
export type GuildWithDefaultChannelId = Static<
typeof guildWithDefaultChannelObjectSchema
>
export const guildCompleteSchema = {
...guildSchema,
channels: Type.Array(Type.Object(channelSchema)),
members: Type.Array(Type.Object(memberSchema))
}
export const guildCompleteObjectSchema = Type.Object(guildCompleteSchema)
export type GuildComplete = Static<typeof guildCompleteObjectSchema>
export const guildPublicObjectSchema = Type.Object({
...guildSchema,
membersCount: Type.Integer({ min: 1 })
})
export const guildCompleteObjectSchema = Type.Object(guildCompleteSchema)
export type GuildComplete = Static<typeof guildCompleteObjectSchema>
export type GuildPublic = Static<typeof guildPublicObjectSchema>

View File

@ -1,6 +1,7 @@
import { Type } from '@sinclair/typebox'
import { Type, Static } from '@sinclair/typebox'
import { date, id } from './utils'
import { UserPublicWithoutSettings } from './User'
export const memberSchema = {
id,
@ -10,3 +11,9 @@ export const memberSchema = {
userId: id,
guildId: id
}
const memberObjectSchema = Type.Object(memberSchema)
export type Member = Static<typeof memberObjectSchema>
export interface MemberWithPublicUser extends Member {
user: UserPublicWithoutSettings
}

View File

@ -1,6 +1,7 @@
import { Type } from '@sinclair/typebox'
import { Type, Static } from '@sinclair/typebox'
import { date, id } from './utils'
import { MemberWithPublicUser } from './Member'
export const types = [Type.Literal('text'), Type.Literal('file')]
@ -21,3 +22,9 @@ export const messageSchema = {
memberId: id,
channelId: id
}
const messageObjectSchema = Type.Object(messageSchema)
export type Message = Static<typeof messageObjectSchema>
export interface MessageWithMember extends Message {
member: MemberWithPublicUser
}

View File

@ -50,6 +50,9 @@ export const userPublicWithoutSettingsSchema = {
createdAt: date.createdAt,
updatedAt: date.updatedAt
}
export const userPublicWithoutSettingsObjectSchema = Type.Object(
userPublicWithoutSettingsSchema
)
export const userPublicSchema = {
...userPublicWithoutSettingsSchema,
@ -66,4 +69,7 @@ export const userCurrentSchema = Type.Object({
export type User = Static<typeof userObjectSchema>
export type UserPublic = Static<typeof userPublicObjectSchema>
export type UserPublicWithoutSettings = Static<
typeof userPublicWithoutSettingsObjectSchema
>
export type UserCurrent = Static<typeof userCurrentSchema>