Skip to main content
zerotal

Documentation


Documentation / @zerotal/orm / index / InsertPayload

Type Alias: InsertPayload<T>

InsertPayload<T> = Omit<Pick<T, ColumnKeys<T>>, AutoManagedKeys>

Defined in: packages/orm/src/model/payload.ts:93

Data shape required to create a new model record.

  • Retains all writable column properties, including Carbon dates and JSON columns, while stripping relations, methods, computed getters, and the ORM-managed fields (id, createdAt, updatedAt, deletedAt).
  • Preserves required (name!: string) vs optional (role?: string) exactly as declared on the model — no manual DTO needed.

Type Parameters

T

T

Example

// In a controller:
const user = await User.create(await ctx.body<InsertPayload<User>>());

// Alias pattern (recommended — keeps controllers clean):
export type NewUser = InsertPayload<User>;
const user = await User.create({ name: "Alice", email: "alice@example.com", password: "…" });