UNPKG

alepha

Version:

Easy-to-use modern TypeScript framework for building many kind of applications.

48 lines (47 loc) 1.54 kB
import { z } from "alepha"; import { $entity, db, pageQuerySchema } from "alepha/orm"; //#region ../../src/api/organizations/entities/organizations.ts const organizations = $entity({ name: "organizations", schema: z.object({ id: db.primaryKey(z.uuid()), version: db.version(), createdAt: db.createdAt(), updatedAt: db.updatedAt(), name: z.text(), slug: z.text({ minLength: 2, maxLength: 100 }), enabled: db.default(z.boolean(), true) }), indexes: [{ columns: ["slug"], unique: true }] }); //#endregion //#region ../../src/api/organizations/schemas/createOrganizationSchema.ts const createOrganizationSchema = z.object({ name: z.text(), slug: z.text({ minLength: 2, maxLength: 100 }), enabled: z.boolean().optional() }); //#endregion //#region ../../src/api/organizations/schemas/organizationQuerySchema.ts const organizationQuerySchema = pageQuerySchema.extend({ name: z.text({ description: "Filter by name (partial match)" }).optional(), enabled: z.boolean().describe("Filter by enabled status").optional() }); //#endregion //#region ../../src/api/organizations/schemas/organizationResourceSchema.ts const organizationResourceSchema = organizations.schema; //#endregion //#region ../../src/api/organizations/schemas/updateOrganizationSchema.ts const updateOrganizationSchema = createOrganizationSchema.partial(); //#endregion export { createOrganizationSchema, organizationQuerySchema, organizationResourceSchema, organizations, updateOrganizationSchema }; //# sourceMappingURL=index.browser.js.map