UNPKG

@deepkit/framework

Version:

59 lines (58 loc) 1.81 kB
import { ClassType } from '@deepkit/core'; import { AppModule } from '@deepkit/app'; import { ReflectionClass } from '@deepkit/type'; interface AutoCrudOptions { /** * To limit the route generation to a subset of operations, specify an array of * 'create' | 'read' | 'readMany' | 'update' | 'updateMany' | 'delete' | 'deleteMany'. * * ```typescript * {limitOperations: ['create', 'read', 'readMany']} * ``` */ limitOperations?: ('create' | 'read' | 'readMany' | 'update' | 'updateMany' | 'delete' | 'deleteMany')[]; /** * Defaults to the primary key. * If you have an additional unique field, you can specify here its name. */ identifier?: string; /** * Per default all fields are selectable in list/get routes. * * Specify each field to limit the selection. */ selectableFields?: string[]; /** * Per default all fields are sortable in list/get routes. * * Specify each field to limit the selection. */ sortFields?: string[]; /** * Per default the identifier/primary key can not be changed. * * Set this to true to allow it. */ identifierChangeable?: true; /** * Per default all joins are selectable in list/get routes. * * Specify each field to limit the selection. */ joins?: string[]; /** * Per default max is 1000. */ maxLimit?: number; /** * Per default limit is 30. */ defaultLimit?: number; } export declare class CrudAppModule<T extends {}> extends AppModule<T> { } /** * Create a module that provides CRUD routes for given entities. */ export declare function createCrudRoutes(schemas: (ClassType | ReflectionClass<any>)[], options?: AutoCrudOptions): CrudAppModule<{}>; export {};