import { Knex } from 'knex' import { z, ZodObject } from 'zod' export enum TableName { Users = 'users', Tenants = 'tenants', TenantUsers = 'tenant-users', Opts = 'opts', } export enum TablePK { Users = 'id', Tenants = 'id', TenantUsers = 'id', Opts = 'id', } export enum TableFK { Users = 'user_id', Tenants = 'tenant_id', } export const TableEntity = z.object({ id: z.number(), deleted_at: z.date(), created_at: z.date(), updated_at: z.date(), }) export type ITableEntity = z.infer export type IRepositoryConstructor = { db: Knex tableName: TableName pk: TablePK limit?: number maxLimit?: number } export type IWithDeletedAt = T & { deleted_at?: string | null } export type IUpdate = { id: number item: Partial> } export type IDbQueryOptions = ZodObject> = { select?: T trx?: Knex.Transaction includeDeleted?: boolean } export type InferZodSchema> = z.infer