// The database handle + barrel. Imports every entity + exports // `databaseHandle({...})`. Tables are auto-discovered by the CLI from the // `*.entity.ts` files; the handle is what server code queries through // (`database.books.matching(...)`, `database.authors.with({ books: true })`). // // Importing the `*.relations.ts` files here is what registers the relations // at boot so the eager-load `.with(...)` walker can resolve them. import { databaseHandle, type InferRow } from '@voltro/database' import { actors } from './actors.entity' import { tenants } from './tenants.entity' import { authors } from './authors.entity' import { books } from './books.entity' // Register relations (side-effecting imports). import './authors.relations' import './books.relations' export { actors, tenants, authors, books } export type Author = InferRow export type Book = InferRow export const database = databaseHandle({ actors, tenants, authors, books })