36 lines
1.3 KiB
TypeScript
36 lines
1.3 KiB
TypeScript
|
import { ColumnType, Insertable, Selectable, Updateable } from "npm:kysely";
|
||
|
import { UserID } from "../core/entities.ts";
|
||
|
|
||
|
type DateOrStr = Date | string
|
||
|
type WrittableOnce<type> = ColumnType<type, type, never>
|
||
|
|
||
|
export interface TableUsers extends UserID {
|
||
|
tg_id: number | null
|
||
|
joined_byreferal_from_user_id: WrittableOnce<string | null>
|
||
|
is_chat_participant: boolean
|
||
|
is_captcha_passed: boolean
|
||
|
is_timeout: boolean
|
||
|
is_banned: boolean
|
||
|
created_at: ColumnType<Date, DateOrStr, never>
|
||
|
joined_chat_at: ColumnType<Date | null, DateOrStr | null, DateOrStr>
|
||
|
timeout_until: ColumnType<Date | null, DateOrStr | null, DateOrStr | null>
|
||
|
}
|
||
|
|
||
|
export interface TableInviteLinks {
|
||
|
link: WrittableOnce<string>
|
||
|
expect_user_tg_id: WrittableOnce<number>
|
||
|
}
|
||
|
|
||
|
|
||
|
export interface Database {
|
||
|
users: TableUsers
|
||
|
inviteLinks: TableInviteLinks
|
||
|
}
|
||
|
|
||
|
export type SelectUser = Selectable<TableUsers>
|
||
|
export type InsertUser = Insertable<TableUsers>
|
||
|
export type UpdateUser = Updateable<TableUsers>
|
||
|
export type SelectInviteLinks = Selectable<TableInviteLinks>
|
||
|
export type InsertInviteLinks = Insertable<TableInviteLinks>
|
||
|
export type UpdateInviteLinks = Updateable<TableInviteLinks>
|