70 lines
1.6 KiB
TypeScript
70 lines
1.6 KiB
TypeScript
import type {ColumnType} from "kysely";
|
|
|
|
export type Generated<T> = T extends ColumnType<infer S, infer I, infer U>
|
|
? ColumnType<S, I | undefined, U>
|
|
: ColumnType<T, T | undefined, T>;
|
|
|
|
export type Int8 = ColumnType<string, bigint | number | string, bigint | number | string>;
|
|
|
|
export type Json = ColumnType<JsonValue, string, string>;
|
|
|
|
export type JsonArray = JsonValue[];
|
|
|
|
export type JsonObject = {
|
|
[K in string]?: JsonValue;
|
|
};
|
|
|
|
export type JsonPrimitive = boolean | number | string | null;
|
|
|
|
export type JsonValue = JsonArray | JsonObject | JsonPrimitive;
|
|
|
|
export type Timestamp = ColumnType<Date, Date | string, Date | string>;
|
|
|
|
export interface Client {
|
|
archived: boolean;
|
|
at: Timestamp;
|
|
id: number;
|
|
name: string;
|
|
server_deleted_at: Timestamp | null;
|
|
workspace_id: number;
|
|
}
|
|
|
|
export interface Project {
|
|
active: boolean;
|
|
client_id: number | null;
|
|
color: string;
|
|
id: Generated<number>;
|
|
name: string;
|
|
raw_json: Json;
|
|
server_created_at: Timestamp;
|
|
server_deleted_at: Timestamp | null;
|
|
server_updated_at: Timestamp;
|
|
toggl_id: Int8;
|
|
workspace_id: Int8;
|
|
}
|
|
|
|
export interface TimeEntry {
|
|
description: string;
|
|
id: Generated<number>;
|
|
project_id: Int8 | null;
|
|
raw_json: Json;
|
|
server_deleted_at: Timestamp | null;
|
|
server_updated_at: Timestamp;
|
|
start: Timestamp;
|
|
stop: Timestamp;
|
|
tags: Generated<Json>;
|
|
toggl_id: Int8;
|
|
}
|
|
|
|
export interface TogglPortalSeaqlMigrations {
|
|
applied_at: Int8;
|
|
version: string;
|
|
}
|
|
|
|
export interface DB {
|
|
client: Client;
|
|
project: Project;
|
|
time_entry: TimeEntry;
|
|
toggl_portal_seaql_migrations: TogglPortalSeaqlMigrations;
|
|
}
|