mirror of https://github.com/TZGyn/shortener
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.1 KiB
TypeScript
51 lines
1.1 KiB
TypeScript
import {
|
|
ColumnType,
|
|
Generated,
|
|
Insertable,
|
|
Selectable,
|
|
Updateable,
|
|
} from 'kysely'
|
|
|
|
export type Timestamp = ColumnType<Date, Date | string, Date | string>
|
|
|
|
export interface Database {
|
|
shortener: ShortenerTable
|
|
visitor: VisitorTable
|
|
user: UserTable
|
|
}
|
|
|
|
export interface ShortenerTable {
|
|
id: Generated<number>
|
|
link: string
|
|
code: string
|
|
created_at: ColumnType<Date, string | undefined, never>
|
|
}
|
|
|
|
export type Shortener = Selectable<ShortenerTable>
|
|
export type NewShortener = Insertable<ShortenerTable>
|
|
export type ShortenerUpdate = Updateable<ShortenerTable>
|
|
|
|
export interface VisitorTable {
|
|
id: Generated<number>
|
|
shortener_id: number
|
|
country: string
|
|
country_code: string
|
|
created_at: ColumnType<Date, string | undefined, never>
|
|
}
|
|
|
|
export type Visitor = Selectable<VisitorTable>
|
|
export type NewVisitor = Insertable<VisitorTable>
|
|
|
|
export interface UserTable {
|
|
created_at: Generated<Timestamp>
|
|
email: string
|
|
id: Generated<number>
|
|
password: string
|
|
username: string
|
|
uuid: string
|
|
}
|
|
|
|
export type User = Selectable<UserTable>
|
|
export type NewUser = Insertable<UserTable>
|
|
export type UserUpdate = Updateable<UserTable>
|