Kaizen
Browse modulesBookingsbookings/serverClasses

Class: BookingCrudRepository

Defined in: server/bookings/booking-crud-repository.ts:72

Repository with full CRUD capabilities. Extend this for most repositories that need create, read, update, and delete.

Extends

  • CrudRepository<PrismaClient, Bookings, CreateInput, UpdateInput, string, Tx<PrismaClient>>

Constructors

Constructor

new BookingCrudRepository(prismaClient: PrismaClientLike<Tx<PrismaClient<PrismaClientOptions, never, DefaultArgs>>> & PrismaClient<PrismaClientOptions, never, DefaultArgs>, options?: RepositoryOptions): BookingCrudRepository;

Defined in: server/persistence/base-repository.ts:68

Parameters

ParameterType
prismaClientPrismaClientLike<Tx<PrismaClient<PrismaClientOptions, never, DefaultArgs>>> & PrismaClient<PrismaClientOptions, never, DefaultArgs>
optionsRepositoryOptions

Returns

BookingCrudRepository

Inherited from

CrudRepository.constructor

Properties

ENTITY_TYPE?

protected readonly optional ENTITY_TYPE?: string;

Defined in: server/persistence/base-repository.ts:61

Set ENTITY_TYPE in child repositories to enable automatic activity logging. When set, create/update/delete operations auto-log unless silenced with .silent. Requires an activity model on the consumer's Prisma schema.

Inherited from

CrudRepository.ENTITY_TYPE


logger?

protected readonly optional logger?: Logger;

Defined in: server/persistence/base-repository.ts:64

Inherited from

CrudRepository.logger


prismaClient

protected prismaClient: PrismaClientLike<Tx<PrismaClient<PrismaClientOptions, never, DefaultArgs>>> & PrismaClient<PrismaClientOptions, never, DefaultArgs>;

Defined in: server/persistence/base-repository.ts:69

Inherited from

CrudRepository.prismaClient

Accessors

actorId

Get Signature

get protected actorId(): string | null | undefined;

Defined in: server/persistence/base-repository.ts:76

Returns

string | null | undefined

Inherited from

CrudRepository.actorId


auditCreate

Get Signature

get protected auditCreate(): {
  createdBy: string | null | undefined;
  updatedBy: string | null | undefined;
};

Defined in: server/persistence/base-repository.ts:90

Returns
{
  createdBy: string | null | undefined;
  updatedBy: string | null | undefined;
}
createdBy
createdBy: string | null | undefined = actorId;
updatedBy
updatedBy: string | null | undefined = actorId;

Inherited from

CrudRepository.auditCreate


auditDelete

Get Signature

get protected auditDelete(): {
  deletedAt: Date;
  deletedBy: string | null | undefined;
};

Defined in: server/persistence/base-repository.ts:99

Returns
{
  deletedAt: Date;
  deletedBy: string | null | undefined;
}
deletedAt
deletedAt: Date;
deletedBy
deletedBy: string | null | undefined;

Inherited from

CrudRepository.auditDelete


auditUpdate

Get Signature

get protected auditUpdate(): {
  updatedBy: string | null | undefined;
};

Defined in: server/persistence/base-repository.ts:95

Returns
{
  updatedBy: string | null | undefined;
}
updatedBy
updatedBy: string | null | undefined;

Inherited from

CrudRepository.auditUpdate


silent

Get Signature

get silent(): this;

Defined in: server/persistence/base-repository.ts:115

Suppress activity logging for the next mutation call. One-shot: the flag is consumed by the next create/update/delete.

Example
await repo.silent.update(id, data);   // no activity logged
await repo.update(id, data);          // activity logged normally
Returns

this

Inherited from

CrudRepository.silent


tx

Get Signature

get protected tx(): TTx;

Defined in: server/persistence/base-repository.ts:86

The current Prisma handle: the active transaction if one is running on this async context, otherwise the raw client.

Returns

TTx

Inherited from

CrudRepository.tx

Methods

_count()

protected _count(): Promise<number>;

Defined in: server/bookings/booking-crud-repository.ts:95

Returns

Promise<number>

Overrides

CrudRepository._count


_create()

protected _create(input: CreateInput): Promise<{
  amountOwedCents: number | null;
  bookingTypeId: string;
  bookingTypeVersionId: string;
  capacityUnits: number;
  createdAt: Date;
  createdBy: string | null;
  currency: string | null;
  deletedAt: Date | null;
  deletedBy: string | null;
  groupId: string | null;
  holdExpiresAt: Date | null;
  id: string;
  organizationId: string;
  origin: BookingOrigin;
  paid: boolean;
  partyEmail: string | null;
  partyName: string | null;
  partyRef: string | null;
  payload: JsonValue;
  paymentRef: string | null;
  pendingExpiresAt: Date | null;
  status: BookingStatus;
  statusUpdatedAt: Date;
  statusUpdatedBy: string | null;
  supersededById: string | null;
  uid: string;
  updatedAt: Date;
  updatedBy: string | null;
  version: number;
}>;

Defined in: server/bookings/booking-crud-repository.ts:116

Parameters

ParameterType
inputCreateInput

Returns

Promise<{ amountOwedCents: number | null; bookingTypeId: string; bookingTypeVersionId: string; capacityUnits: number; createdAt: Date; createdBy: string | null; currency: string | null; deletedAt: Date | null; deletedBy: string | null; groupId: string | null; holdExpiresAt: Date | null; id: string; organizationId: string; origin: BookingOrigin; paid: boolean; partyEmail: string | null; partyName: string | null; partyRef: string | null; payload: JsonValue; paymentRef: string | null; pendingExpiresAt: Date | null; status: BookingStatus; statusUpdatedAt: Date; statusUpdatedBy: string | null; supersededById: string | null; uid: string; updatedAt: Date; updatedBy: string | null; version: number; }>

Overrides

CrudRepository._create


_exists()

protected _exists(id: string): Promise<boolean>;

Defined in: server/bookings/booking-crud-repository.ts:88

Parameters

ParameterType
idstring

Returns

Promise<boolean>

Overrides

CrudRepository._exists


_findById()

protected _findById(id: string): Promise<
  | {
  amountOwedCents: number | null;
  bookingTypeId: string;
  bookingTypeVersionId: string;
  capacityUnits: number;
  createdAt: Date;
  createdBy: string | null;
  currency: string | null;
  deletedAt: Date | null;
  deletedBy: string | null;
  groupId: string | null;
  holdExpiresAt: Date | null;
  id: string;
  organizationId: string;
  origin: BookingOrigin;
  paid: boolean;
  partyEmail: string | null;
  partyName: string | null;
  partyRef: string | null;
  payload: JsonValue;
  paymentRef: string | null;
  pendingExpiresAt: Date | null;
  status: BookingStatus;
  statusUpdatedAt: Date;
  statusUpdatedBy: string | null;
  supersededById: string | null;
  uid: string;
  updatedAt: Date;
  updatedBy: string | null;
  version: number;
}
| null>;

Defined in: server/bookings/booking-crud-repository.ts:84

Parameters

ParameterType
idstring

Returns

Promise< | { amountOwedCents: number | null; bookingTypeId: string; bookingTypeVersionId: string; capacityUnits: number; createdAt: Date; createdBy: string | null; currency: string | null; deletedAt: Date | null; deletedBy: string | null; groupId: string | null; holdExpiresAt: Date | null; id: string; organizationId: string; origin: BookingOrigin; paid: boolean; partyEmail: string | null; partyName: string | null; partyRef: string | null; payload: JsonValue; paymentRef: string | null; pendingExpiresAt: Date | null; status: BookingStatus; statusUpdatedAt: Date; statusUpdatedBy: string | null; supersededById: string | null; uid: string; updatedAt: Date; updatedBy: string | null; version: number; } | null>

Overrides

CrudRepository._findById


_findMany()

protected _findMany(pagination: {
  page: number;
  pageSize: number;
}): Promise<{
  items: {
     amountOwedCents: number | null;
     bookingTypeId: string;
     bookingTypeVersionId: string;
     capacityUnits: number;
     createdAt: Date;
     createdBy: string | null;
     currency: string | null;
     deletedAt: Date | null;
     deletedBy: string | null;
     groupId: string | null;
     holdExpiresAt: Date | null;
     id: string;
     organizationId: string;
     origin: BookingOrigin;
     paid: boolean;
     partyEmail: string | null;
     partyName: string | null;
     partyRef: string | null;
     payload: JsonValue;
     paymentRef: string | null;
     pendingExpiresAt: Date | null;
     status: BookingStatus;
     statusUpdatedAt: Date;
     statusUpdatedBy: string | null;
     supersededById: string | null;
     uid: string;
     updatedAt: Date;
     updatedBy: string | null;
     version: number;
  }[];
  total: number;
}>;

Defined in: server/bookings/booking-crud-repository.ts:99

Parameters

ParameterType
pagination{ page: number; pageSize: number; }
pagination.pagenumber
pagination.pageSizenumber

Returns

Promise<{ items: { amountOwedCents: number | null; bookingTypeId: string; bookingTypeVersionId: string; capacityUnits: number; createdAt: Date; createdBy: string | null; currency: string | null; deletedAt: Date | null; deletedBy: string | null; groupId: string | null; holdExpiresAt: Date | null; id: string; organizationId: string; origin: BookingOrigin; paid: boolean; partyEmail: string | null; partyName: string | null; partyRef: string | null; payload: JsonValue; paymentRef: string | null; pendingExpiresAt: Date | null; status: BookingStatus; statusUpdatedAt: Date; statusUpdatedBy: string | null; supersededById: string | null; uid: string; updatedAt: Date; updatedBy: string | null; version: number; }[]; total: number; }>

Overrides

CrudRepository._findMany


_hardDelete()

protected _hardDelete(id: string): Promise<{
  amountOwedCents: number | null;
  bookingTypeId: string;
  bookingTypeVersionId: string;
  capacityUnits: number;
  createdAt: Date;
  createdBy: string | null;
  currency: string | null;
  deletedAt: Date | null;
  deletedBy: string | null;
  groupId: string | null;
  holdExpiresAt: Date | null;
  id: string;
  organizationId: string;
  origin: BookingOrigin;
  paid: boolean;
  partyEmail: string | null;
  partyName: string | null;
  partyRef: string | null;
  payload: JsonValue;
  paymentRef: string | null;
  pendingExpiresAt: Date | null;
  status: BookingStatus;
  statusUpdatedAt: Date;
  statusUpdatedBy: string | null;
  supersededById: string | null;
  uid: string;
  updatedAt: Date;
  updatedBy: string | null;
  version: number;
}>;

Defined in: server/bookings/booking-crud-repository.ts:163

Parameters

ParameterType
idstring

Returns

Promise<{ amountOwedCents: number | null; bookingTypeId: string; bookingTypeVersionId: string; capacityUnits: number; createdAt: Date; createdBy: string | null; currency: string | null; deletedAt: Date | null; deletedBy: string | null; groupId: string | null; holdExpiresAt: Date | null; id: string; organizationId: string; origin: BookingOrigin; paid: boolean; partyEmail: string | null; partyName: string | null; partyRef: string | null; payload: JsonValue; paymentRef: string | null; pendingExpiresAt: Date | null; status: BookingStatus; statusUpdatedAt: Date; statusUpdatedBy: string | null; supersededById: string | null; uid: string; updatedAt: Date; updatedBy: string | null; version: number; }>

Overrides

CrudRepository._hardDelete


_softDelete()

protected _softDelete(id: string): Promise<{
  amountOwedCents: number | null;
  bookingTypeId: string;
  bookingTypeVersionId: string;
  capacityUnits: number;
  createdAt: Date;
  createdBy: string | null;
  currency: string | null;
  deletedAt: Date | null;
  deletedBy: string | null;
  groupId: string | null;
  holdExpiresAt: Date | null;
  id: string;
  organizationId: string;
  origin: BookingOrigin;
  paid: boolean;
  partyEmail: string | null;
  partyName: string | null;
  partyRef: string | null;
  payload: JsonValue;
  paymentRef: string | null;
  pendingExpiresAt: Date | null;
  status: BookingStatus;
  statusUpdatedAt: Date;
  statusUpdatedBy: string | null;
  supersededById: string | null;
  uid: string;
  updatedAt: Date;
  updatedBy: string | null;
  version: number;
}>;

Defined in: server/bookings/booking-crud-repository.ts:159

Parameters

ParameterType
idstring

Returns

Promise<{ amountOwedCents: number | null; bookingTypeId: string; bookingTypeVersionId: string; capacityUnits: number; createdAt: Date; createdBy: string | null; currency: string | null; deletedAt: Date | null; deletedBy: string | null; groupId: string | null; holdExpiresAt: Date | null; id: string; organizationId: string; origin: BookingOrigin; paid: boolean; partyEmail: string | null; partyName: string | null; partyRef: string | null; payload: JsonValue; paymentRef: string | null; pendingExpiresAt: Date | null; status: BookingStatus; statusUpdatedAt: Date; statusUpdatedBy: string | null; supersededById: string | null; uid: string; updatedAt: Date; updatedBy: string | null; version: number; }>

Overrides

CrudRepository._softDelete


_update()

protected _update(id: string, patch: UpdateInput): Promise<{
  amountOwedCents: number | null;
  bookingTypeId: string;
  bookingTypeVersionId: string;
  capacityUnits: number;
  createdAt: Date;
  createdBy: string | null;
  currency: string | null;
  deletedAt: Date | null;
  deletedBy: string | null;
  groupId: string | null;
  holdExpiresAt: Date | null;
  id: string;
  organizationId: string;
  origin: BookingOrigin;
  paid: boolean;
  partyEmail: string | null;
  partyName: string | null;
  partyRef: string | null;
  payload: JsonValue;
  paymentRef: string | null;
  pendingExpiresAt: Date | null;
  status: BookingStatus;
  statusUpdatedAt: Date;
  statusUpdatedBy: string | null;
  supersededById: string | null;
  uid: string;
  updatedAt: Date;
  updatedBy: string | null;
  version: number;
}>;

Defined in: server/bookings/booking-crud-repository.ts:155

Parameters

ParameterType
idstring
patchUpdateInput

Returns

Promise<{ amountOwedCents: number | null; bookingTypeId: string; bookingTypeVersionId: string; capacityUnits: number; createdAt: Date; createdBy: string | null; currency: string | null; deletedAt: Date | null; deletedBy: string | null; groupId: string | null; holdExpiresAt: Date | null; id: string; organizationId: string; origin: BookingOrigin; paid: boolean; partyEmail: string | null; partyName: string | null; partyRef: string | null; payload: JsonValue; paymentRef: string | null; pendingExpiresAt: Date | null; status: BookingStatus; statusUpdatedAt: Date; statusUpdatedBy: string | null; supersededById: string | null; uid: string; updatedAt: Date; updatedBy: string | null; version: number; }>

Overrides

CrudRepository._update


afterCreate()

protected afterCreate(entity: {
  amountOwedCents: number | null;
  bookingTypeId: string;
  bookingTypeVersionId: string;
  capacityUnits: number;
  createdAt: Date;
  createdBy: string | null;
  currency: string | null;
  deletedAt: Date | null;
  deletedBy: string | null;
  groupId: string | null;
  holdExpiresAt: Date | null;
  id: string;
  organizationId: string;
  origin: BookingOrigin;
  paid: boolean;
  partyEmail: string | null;
  partyName: string | null;
  partyRef: string | null;
  payload: JsonValue;
  paymentRef: string | null;
  pendingExpiresAt: Date | null;
  status: BookingStatus;
  statusUpdatedAt: Date;
  statusUpdatedBy: string | null;
  supersededById: string | null;
  uid: string;
  updatedAt: Date;
  updatedBy: string | null;
  version: number;
}, _input: CreateInput): Promise<void>;

Defined in: server/persistence/base-repository.ts:316

Parameters

ParameterTypeDescription
entity{ amountOwedCents: number | null; bookingTypeId: string; bookingTypeVersionId: string; capacityUnits: number; createdAt: Date; createdBy: string | null; currency: string | null; deletedAt: Date | null; deletedBy: string | null; groupId: string | null; holdExpiresAt: Date | null; id: string; organizationId: string; origin: BookingOrigin; paid: boolean; partyEmail: string | null; partyName: string | null; partyRef: string | null; payload: JsonValue; paymentRef: string | null; pendingExpiresAt: Date | null; status: BookingStatus; statusUpdatedAt: Date; statusUpdatedBy: string | null; supersededById: string | null; uid: string; updatedAt: Date; updatedBy: string | null; version: number; }-
entity.amountOwedCentsnumber | null-
entity.bookingTypeIdstring-
entity.bookingTypeVersionIdstring-
entity.capacityUnitsnumber-
entity.createdAtDate-
entity.createdBystring | null-
entity.currencystring | null-
entity.deletedAtDate | null-
entity.deletedBystring | null-
entity.groupIdstring | null-
entity.holdExpiresAtDate | null-
entity.idstring-
entity.organizationIdstring-
entity.originBookingOriginDiscriminator separating customer reservations from system/offering occupancy blocks (§6.7/§6.8). system bookings carry partyRef = null; CRM/report queries filter on this instead of inventing a sentinel partyRef string.
entity.paidboolean-
entity.partyEmailstring | null-
entity.partyNamestring | null-
entity.partyRefstring | null-
entity.payloadJsonValue-
entity.paymentRefstring | null-
entity.pendingExpiresAtDate | null-
entity.statusBookingStatus-
entity.statusUpdatedAtDate-
entity.statusUpdatedBystring | null-
entity.supersededByIdstring | null-
entity.uidstring-
entity.updatedAtDate-
entity.updatedBystring | null-
entity.versionnumber-
_inputCreateInput-

Returns

Promise<void>

Inherited from

CrudRepository.afterCreate


afterDelete()

protected afterDelete(_entity: {
  amountOwedCents: number | null;
  bookingTypeId: string;
  bookingTypeVersionId: string;
  capacityUnits: number;
  createdAt: Date;
  createdBy: string | null;
  currency: string | null;
  deletedAt: Date | null;
  deletedBy: string | null;
  groupId: string | null;
  holdExpiresAt: Date | null;
  id: string;
  organizationId: string;
  origin: BookingOrigin;
  paid: boolean;
  partyEmail: string | null;
  partyName: string | null;
  partyRef: string | null;
  payload: JsonValue;
  paymentRef: string | null;
  pendingExpiresAt: Date | null;
  status: BookingStatus;
  statusUpdatedAt: Date;
  statusUpdatedBy: string | null;
  supersededById: string | null;
  uid: string;
  updatedAt: Date;
  updatedBy: string | null;
  version: number;
}, id: string): Promise<void>;

Defined in: server/persistence/base-repository.ts:390

Parameters

ParameterTypeDescription
_entity{ amountOwedCents: number | null; bookingTypeId: string; bookingTypeVersionId: string; capacityUnits: number; createdAt: Date; createdBy: string | null; currency: string | null; deletedAt: Date | null; deletedBy: string | null; groupId: string | null; holdExpiresAt: Date | null; id: string; organizationId: string; origin: BookingOrigin; paid: boolean; partyEmail: string | null; partyName: string | null; partyRef: string | null; payload: JsonValue; paymentRef: string | null; pendingExpiresAt: Date | null; status: BookingStatus; statusUpdatedAt: Date; statusUpdatedBy: string | null; supersededById: string | null; uid: string; updatedAt: Date; updatedBy: string | null; version: number; }-
_entity.amountOwedCentsnumber | null-
_entity.bookingTypeIdstring-
_entity.bookingTypeVersionIdstring-
_entity.capacityUnitsnumber-
_entity.createdAtDate-
_entity.createdBystring | null-
_entity.currencystring | null-
_entity.deletedAtDate | null-
_entity.deletedBystring | null-
_entity.groupIdstring | null-
_entity.holdExpiresAtDate | null-
_entity.idstring-
_entity.organizationIdstring-
_entity.originBookingOriginDiscriminator separating customer reservations from system/offering occupancy blocks (§6.7/§6.8). system bookings carry partyRef = null; CRM/report queries filter on this instead of inventing a sentinel partyRef string.
_entity.paidboolean-
_entity.partyEmailstring | null-
_entity.partyNamestring | null-
_entity.partyRefstring | null-
_entity.payloadJsonValue-
_entity.paymentRefstring | null-
_entity.pendingExpiresAtDate | null-
_entity.statusBookingStatus-
_entity.statusUpdatedAtDate-
_entity.statusUpdatedBystring | null-
_entity.supersededByIdstring | null-
_entity.uidstring-
_entity.updatedAtDate-
_entity.updatedBystring | null-
_entity.versionnumber-
idstring-

Returns

Promise<void>

Inherited from

CrudRepository.afterDelete


afterUpdate()

protected afterUpdate(
   _entity: {
  amountOwedCents: number | null;
  bookingTypeId: string;
  bookingTypeVersionId: string;
  capacityUnits: number;
  createdAt: Date;
  createdBy: string | null;
  currency: string | null;
  deletedAt: Date | null;
  deletedBy: string | null;
  groupId: string | null;
  holdExpiresAt: Date | null;
  id: string;
  organizationId: string;
  origin: BookingOrigin;
  paid: boolean;
  partyEmail: string | null;
  partyName: string | null;
  partyRef: string | null;
  payload: JsonValue;
  paymentRef: string | null;
  pendingExpiresAt: Date | null;
  status: BookingStatus;
  statusUpdatedAt: Date;
  statusUpdatedBy: string | null;
  supersededById: string | null;
  uid: string;
  updatedAt: Date;
  updatedBy: string | null;
  version: number;
}, 
   id: string, 
   input: Partial<{
  groupId: string | null;
  partyEmail: string | null;
  partyName: string | null;
  partyRef: string | null;
}>
): Promise<void>;

Defined in: server/persistence/base-repository.ts:328

Parameters

ParameterTypeDescription
_entity{ amountOwedCents: number | null; bookingTypeId: string; bookingTypeVersionId: string; capacityUnits: number; createdAt: Date; createdBy: string | null; currency: string | null; deletedAt: Date | null; deletedBy: string | null; groupId: string | null; holdExpiresAt: Date | null; id: string; organizationId: string; origin: BookingOrigin; paid: boolean; partyEmail: string | null; partyName: string | null; partyRef: string | null; payload: JsonValue; paymentRef: string | null; pendingExpiresAt: Date | null; status: BookingStatus; statusUpdatedAt: Date; statusUpdatedBy: string | null; supersededById: string | null; uid: string; updatedAt: Date; updatedBy: string | null; version: number; }-
_entity.amountOwedCentsnumber | null-
_entity.bookingTypeIdstring-
_entity.bookingTypeVersionIdstring-
_entity.capacityUnitsnumber-
_entity.createdAtDate-
_entity.createdBystring | null-
_entity.currencystring | null-
_entity.deletedAtDate | null-
_entity.deletedBystring | null-
_entity.groupIdstring | null-
_entity.holdExpiresAtDate | null-
_entity.idstring-
_entity.organizationIdstring-
_entity.originBookingOriginDiscriminator separating customer reservations from system/offering occupancy blocks (§6.7/§6.8). system bookings carry partyRef = null; CRM/report queries filter on this instead of inventing a sentinel partyRef string.
_entity.paidboolean-
_entity.partyEmailstring | null-
_entity.partyNamestring | null-
_entity.partyRefstring | null-
_entity.payloadJsonValue-
_entity.paymentRefstring | null-
_entity.pendingExpiresAtDate | null-
_entity.statusBookingStatus-
_entity.statusUpdatedAtDate-
_entity.statusUpdatedBystring | null-
_entity.supersededByIdstring | null-
_entity.uidstring-
_entity.updatedAtDate-
_entity.updatedBystring | null-
_entity.versionnumber-
idstring-
inputPartial<{ groupId: string | null; partyEmail: string | null; partyName: string | null; partyRef: string | null; }>-

Returns

Promise<void>

Inherited from

CrudRepository.afterUpdate


beforeCreate()

protected beforeCreate(_input: CreateInput): Promise<void>;

Defined in: server/persistence/base-repository.ts:315

Parameters

ParameterType
_inputCreateInput

Returns

Promise<void>

Inherited from

CrudRepository.beforeCreate


beforeDelete()

protected beforeDelete(_id: string, _existing: {
  amountOwedCents: number | null;
  bookingTypeId: string;
  bookingTypeVersionId: string;
  capacityUnits: number;
  createdAt: Date;
  createdBy: string | null;
  currency: string | null;
  deletedAt: Date | null;
  deletedBy: string | null;
  groupId: string | null;
  holdExpiresAt: Date | null;
  id: string;
  organizationId: string;
  origin: BookingOrigin;
  paid: boolean;
  partyEmail: string | null;
  partyName: string | null;
  partyRef: string | null;
  payload: JsonValue;
  paymentRef: string | null;
  pendingExpiresAt: Date | null;
  status: BookingStatus;
  statusUpdatedAt: Date;
  statusUpdatedBy: string | null;
  supersededById: string | null;
  uid: string;
  updatedAt: Date;
  updatedBy: string | null;
  version: number;
}): Promise<void>;

Defined in: server/persistence/base-repository.ts:388

Parameters

ParameterTypeDescription
_idstring-
_existing{ amountOwedCents: number | null; bookingTypeId: string; bookingTypeVersionId: string; capacityUnits: number; createdAt: Date; createdBy: string | null; currency: string | null; deletedAt: Date | null; deletedBy: string | null; groupId: string | null; holdExpiresAt: Date | null; id: string; organizationId: string; origin: BookingOrigin; paid: boolean; partyEmail: string | null; partyName: string | null; partyRef: string | null; payload: JsonValue; paymentRef: string | null; pendingExpiresAt: Date | null; status: BookingStatus; statusUpdatedAt: Date; statusUpdatedBy: string | null; supersededById: string | null; uid: string; updatedAt: Date; updatedBy: string | null; version: number; }-
_existing.amountOwedCentsnumber | null-
_existing.bookingTypeIdstring-
_existing.bookingTypeVersionIdstring-
_existing.capacityUnitsnumber-
_existing.createdAtDate-
_existing.createdBystring | null-
_existing.currencystring | null-
_existing.deletedAtDate | null-
_existing.deletedBystring | null-
_existing.groupIdstring | null-
_existing.holdExpiresAtDate | null-
_existing.idstring-
_existing.organizationIdstring-
_existing.originBookingOriginDiscriminator separating customer reservations from system/offering occupancy blocks (§6.7/§6.8). system bookings carry partyRef = null; CRM/report queries filter on this instead of inventing a sentinel partyRef string.
_existing.paidboolean-
_existing.partyEmailstring | null-
_existing.partyNamestring | null-
_existing.partyRefstring | null-
_existing.payloadJsonValue-
_existing.paymentRefstring | null-
_existing.pendingExpiresAtDate | null-
_existing.statusBookingStatus-
_existing.statusUpdatedAtDate-
_existing.statusUpdatedBystring | null-
_existing.supersededByIdstring | null-
_existing.uidstring-
_existing.updatedAtDate-
_existing.updatedBystring | null-
_existing.versionnumber-

Returns

Promise<void>

Inherited from

CrudRepository.beforeDelete


beforeUpdate()

protected beforeUpdate(
   _id: string, 
   _input: Partial<{
  groupId: string | null;
  partyEmail: string | null;
  partyName: string | null;
  partyRef: string | null;
}>, 
   _existing: {
  amountOwedCents: number | null;
  bookingTypeId: string;
  bookingTypeVersionId: string;
  capacityUnits: number;
  createdAt: Date;
  createdBy: string | null;
  currency: string | null;
  deletedAt: Date | null;
  deletedBy: string | null;
  groupId: string | null;
  holdExpiresAt: Date | null;
  id: string;
  organizationId: string;
  origin: BookingOrigin;
  paid: boolean;
  partyEmail: string | null;
  partyName: string | null;
  partyRef: string | null;
  payload: JsonValue;
  paymentRef: string | null;
  pendingExpiresAt: Date | null;
  status: BookingStatus;
  statusUpdatedAt: Date;
  statusUpdatedBy: string | null;
  supersededById: string | null;
  uid: string;
  updatedAt: Date;
  updatedBy: string | null;
  version: number;
}
): Promise<void>;

Defined in: server/persistence/base-repository.ts:323

Parameters

ParameterTypeDescription
_idstring-
_inputPartial<{ groupId: string | null; partyEmail: string | null; partyName: string | null; partyRef: string | null; }>-
_existing{ amountOwedCents: number | null; bookingTypeId: string; bookingTypeVersionId: string; capacityUnits: number; createdAt: Date; createdBy: string | null; currency: string | null; deletedAt: Date | null; deletedBy: string | null; groupId: string | null; holdExpiresAt: Date | null; id: string; organizationId: string; origin: BookingOrigin; paid: boolean; partyEmail: string | null; partyName: string | null; partyRef: string | null; payload: JsonValue; paymentRef: string | null; pendingExpiresAt: Date | null; status: BookingStatus; statusUpdatedAt: Date; statusUpdatedBy: string | null; supersededById: string | null; uid: string; updatedAt: Date; updatedBy: string | null; version: number; }-
_existing.amountOwedCentsnumber | null-
_existing.bookingTypeIdstring-
_existing.bookingTypeVersionIdstring-
_existing.capacityUnitsnumber-
_existing.createdAtDate-
_existing.createdBystring | null-
_existing.currencystring | null-
_existing.deletedAtDate | null-
_existing.deletedBystring | null-
_existing.groupIdstring | null-
_existing.holdExpiresAtDate | null-
_existing.idstring-
_existing.organizationIdstring-
_existing.originBookingOriginDiscriminator separating customer reservations from system/offering occupancy blocks (§6.7/§6.8). system bookings carry partyRef = null; CRM/report queries filter on this instead of inventing a sentinel partyRef string.
_existing.paidboolean-
_existing.partyEmailstring | null-
_existing.partyNamestring | null-
_existing.partyRefstring | null-
_existing.payloadJsonValue-
_existing.paymentRefstring | null-
_existing.pendingExpiresAtDate | null-
_existing.statusBookingStatus-
_existing.statusUpdatedAtDate-
_existing.statusUpdatedBystring | null-
_existing.supersededByIdstring | null-
_existing.uidstring-
_existing.updatedAtDate-
_existing.updatedBystring | null-
_existing.versionnumber-

Returns

Promise<void>

Inherited from

CrudRepository.beforeUpdate


consumeSilent()

protected consumeSilent(): boolean;

Defined in: server/persistence/base-repository.ts:128

Consume and reset the silent flag. Called by template methods.

Returns

boolean

Inherited from

CrudRepository.consumeSilent


count()

count(): Promise<number>;

Defined in: server/persistence/base-repository.ts:191

Returns

Promise<number>

Inherited from

CrudRepository.count


create()

create(input: CreateInput): Promise<{
  amountOwedCents: number | null;
  bookingTypeId: string;
  bookingTypeVersionId: string;
  capacityUnits: number;
  createdAt: Date;
  createdBy: string | null;
  currency: string | null;
  deletedAt: Date | null;
  deletedBy: string | null;
  groupId: string | null;
  holdExpiresAt: Date | null;
  id: string;
  organizationId: string;
  origin: BookingOrigin;
  paid: boolean;
  partyEmail: string | null;
  partyName: string | null;
  partyRef: string | null;
  payload: JsonValue;
  paymentRef: string | null;
  pendingExpiresAt: Date | null;
  status: BookingStatus;
  statusUpdatedAt: Date;
  statusUpdatedBy: string | null;
  supersededById: string | null;
  uid: string;
  updatedAt: Date;
  updatedBy: string | null;
  version: number;
}>;

Defined in: server/persistence/base-repository.ts:292

Parameters

ParameterType
inputCreateInput

Returns

Promise<{ amountOwedCents: number | null; bookingTypeId: string; bookingTypeVersionId: string; capacityUnits: number; createdAt: Date; createdBy: string | null; currency: string | null; deletedAt: Date | null; deletedBy: string | null; groupId: string | null; holdExpiresAt: Date | null; id: string; organizationId: string; origin: BookingOrigin; paid: boolean; partyEmail: string | null; partyName: string | null; partyRef: string | null; payload: JsonValue; paymentRef: string | null; pendingExpiresAt: Date | null; status: BookingStatus; statusUpdatedAt: Date; statusUpdatedBy: string | null; supersededById: string | null; uid: string; updatedAt: Date; updatedBy: string | null; version: number; }>

Inherited from

CrudRepository.create


exists()

exists(id: string): Promise<boolean>;

Defined in: server/persistence/base-repository.ts:187

Parameters

ParameterType
idstring

Returns

Promise<boolean>

Inherited from

CrudRepository.exists


findActiveOnResourceWindow()

findActiveOnResourceWindow(query: {
  from: Date;
  resourceId: string;
  to: Date;
}): Promise<{
  id: string;
  status: BookingStatus;
  version: number;
}[]>;

Defined in: server/bookings/booking-crud-repository.ts:408

All non-terminal bookings (confirmed/offered/waitlisted/held/ pending) on a resource's window — the set a run-decision cancels when an offering is under-enrolled (§6.10). Returns id + status + version for the cancel loop.

Parameters

ParameterType
query{ from: Date; resourceId: string; to: Date; }
query.fromDate
query.resourceIdstring
query.toDate

Returns

Promise<{ id: string; status: BookingStatus; version: number; }[]>


findById()

findById(id: string): Promise<
  | {
  amountOwedCents: number | null;
  bookingTypeId: string;
  bookingTypeVersionId: string;
  capacityUnits: number;
  createdAt: Date;
  createdBy: string | null;
  currency: string | null;
  deletedAt: Date | null;
  deletedBy: string | null;
  groupId: string | null;
  holdExpiresAt: Date | null;
  id: string;
  organizationId: string;
  origin: BookingOrigin;
  paid: boolean;
  partyEmail: string | null;
  partyName: string | null;
  partyRef: string | null;
  payload: JsonValue;
  paymentRef: string | null;
  pendingExpiresAt: Date | null;
  status: BookingStatus;
  statusUpdatedAt: Date;
  statusUpdatedBy: string | null;
  supersededById: string | null;
  uid: string;
  updatedAt: Date;
  updatedBy: string | null;
  version: number;
}
| null>;

Defined in: server/persistence/base-repository.ts:177

Parameters

ParameterType
idstring

Returns

Promise< | { amountOwedCents: number | null; bookingTypeId: string; bookingTypeVersionId: string; capacityUnits: number; createdAt: Date; createdBy: string | null; currency: string | null; deletedAt: Date | null; deletedBy: string | null; groupId: string | null; holdExpiresAt: Date | null; id: string; organizationId: string; origin: BookingOrigin; paid: boolean; partyEmail: string | null; partyName: string | null; partyRef: string | null; payload: JsonValue; paymentRef: string | null; pendingExpiresAt: Date | null; status: BookingStatus; statusUpdatedAt: Date; statusUpdatedBy: string | null; supersededById: string | null; uid: string; updatedAt: Date; updatedBy: string | null; version: number; } | null>

Inherited from

CrudRepository.findById


findByIdOrThrow()

findByIdOrThrow(id: string): Promise<{
  amountOwedCents: number | null;
  bookingTypeId: string;
  bookingTypeVersionId: string;
  capacityUnits: number;
  createdAt: Date;
  createdBy: string | null;
  currency: string | null;
  deletedAt: Date | null;
  deletedBy: string | null;
  groupId: string | null;
  holdExpiresAt: Date | null;
  id: string;
  organizationId: string;
  origin: BookingOrigin;
  paid: boolean;
  partyEmail: string | null;
  partyName: string | null;
  partyRef: string | null;
  payload: JsonValue;
  paymentRef: string | null;
  pendingExpiresAt: Date | null;
  status: BookingStatus;
  statusUpdatedAt: Date;
  statusUpdatedBy: string | null;
  supersededById: string | null;
  uid: string;
  updatedAt: Date;
  updatedBy: string | null;
  version: number;
}>;

Defined in: server/persistence/base-repository.ts:181

Parameters

ParameterType
idstring

Returns

Promise<{ amountOwedCents: number | null; bookingTypeId: string; bookingTypeVersionId: string; capacityUnits: number; createdAt: Date; createdBy: string | null; currency: string | null; deletedAt: Date | null; deletedBy: string | null; groupId: string | null; holdExpiresAt: Date | null; id: string; organizationId: string; origin: BookingOrigin; paid: boolean; partyEmail: string | null; partyName: string | null; partyRef: string | null; payload: JsonValue; paymentRef: string | null; pendingExpiresAt: Date | null; status: BookingStatus; statusUpdatedAt: Date; statusUpdatedBy: string | null; supersededById: string | null; uid: string; updatedAt: Date; updatedBy: string | null; version: number; }>

Inherited from

CrudRepository.findByIdOrThrow


findCompletable()

findCompletable(now: Date): Promise<{
  id: string;
  version: number;
}[]>;

Defined in: server/bookings/booking-crud-repository.ts:298

Find all confirmed bookings whose schedule endsAt <= now — the completion sweeper's hot-path query. Joins the schedule row so the structural endsAt <= now guard can pass inside applyTransition. Returns only the minimal columns the sweeper needs.

Parameters

ParameterType
nowDate

Returns

Promise<{ id: string; version: number; }[]>


findComposedOrThrow()

findComposedOrThrow(id: string): Promise<ComposedBookingRow>;

Defined in: server/bookings/booking-crud-repository.ts:213

Hydrated composed host: bookings ⋈ component rows + the type row. Component includes grow as later PRs add tables (seats in PR 14).

The offers include is filtered to the ACTIVE rows (queued/offered) so toHost can surface the live offerExpiresAt onto the host for the §5.2 offered→confirmed structural guard — a terminalized offer must never shadow the active one.

NB: bookingTypeId is a LOGICAL pointer (deliberately no Prisma relation on the schema — see the model comment), so the type is fetched with a second query here rather than an include. Folding it into hydration keeps the transition core's lock-holding section free of extra reads (Stage 0 carry-forward).

Parameters

ParameterType
idstring

Returns

Promise<ComposedBookingRow>


findDistinctSlotsInGroup()

findDistinctSlotsInGroup(groupId: string): Promise<string[]>;

Defined in: server/bookings/booking-crud-repository.ts:448

The distinct SLOTS — (resourceId, startsAt, endsAt) — across a group's live (non-deleted) bookings (§6.10). The scope guard for joinWaitlist.

A slot is the resource AND the window, not the resource alone: the waitlist cascade fits a whole party against ONE freeCapacity read, which is only meaningful when every member wants the same slot. Two members on the same resource at different times are exactly as un-fittable in a single read as two on different resources — fitting the party against one member's window and then offering the rest regardless would overbook the members whose own window has no room. Stage 2 therefore waitlists single-slot parties only (PLA-111 tracks full multi-slot support); schedule-less members contribute no slot.

Returned as opaque resource|start|end keys — callers only count them.

Parameters

ParameterType
groupIdstring

Returns

Promise<string[]>


findExpiredHolds()

findExpiredHolds(now: Date): Promise<{
  groupId: string | null;
  holdExpiresAt: Date | null;
  id: string;
  version: number;
}[]>;

Defined in: server/bookings/booking-crud-repository.ts:235

Find all held bookings whose holdExpiresAt <= now — the hold sweeper's hot-path query (hits the [status, holdExpiresAt] composite index). Returns only the columns the sweeper needs (id, groupId, holdExpiresAt, version).

Parameters

ParameterType
nowDate

Returns

Promise<{ groupId: string | null; holdExpiresAt: Date | null; id: string; version: number; }[]>


findExpiredPending()

findExpiredPending(now: Date): Promise<{
  id: string;
  pendingExpiresAt: Date | null;
  version: number;
}[]>;

Defined in: server/bookings/booking-crud-repository.ts:275

Find all pending bookings whose pendingExpiresAt <= now — the approval-expiry sweeper's hot-path query.

Parameters

ParameterType
nowDate

Returns

Promise<{ id: string; pendingExpiresAt: Date | null; version: number; }[]>


findHeldGroupSiblings()

findHeldGroupSiblings(groupId: string): Promise<{
  holdExpiresAt: Date | null;
  id: string;
  version: number;
}[]>;

Defined in: server/bookings/booking-crud-repository.ts:258

Find all held siblings sharing a group_id — used by the hold sweeper for group-unit expiry (§6.10). Returns the same minimal shape as findExpiredHolds.

Parameters

ParameterType
groupIdstring

Returns

Promise<{ holdExpiresAt: Date | null; id: string; version: number; }[]>


findMany()

findMany(pagination: {
  page: number;
  pageSize: number;
}): Promise<OffsetPaginatedResult<{
  amountOwedCents: number | null;
  bookingTypeId: string;
  bookingTypeVersionId: string;
  capacityUnits: number;
  createdAt: Date;
  createdBy: string | null;
  currency: string | null;
  deletedAt: Date | null;
  deletedBy: string | null;
  groupId: string | null;
  holdExpiresAt: Date | null;
  id: string;
  organizationId: string;
  origin: BookingOrigin;
  paid: boolean;
  partyEmail: string | null;
  partyName: string | null;
  partyRef: string | null;
  payload: JsonValue;
  paymentRef: string | null;
  pendingExpiresAt: Date | null;
  status: BookingStatus;
  statusUpdatedAt: Date;
  statusUpdatedBy: string | null;
  supersededById: string | null;
  uid: string;
  updatedAt: Date;
  updatedBy: string | null;
  version: number;
}>>;

Defined in: server/persistence/base-repository.ts:195

Parameters

ParameterType
pagination{ page: number; pageSize: number; }
pagination.pagenumber
pagination.pageSizenumber

Returns

Promise<OffsetPaginatedResult<{ amountOwedCents: number | null; bookingTypeId: string; bookingTypeVersionId: string; capacityUnits: number; createdAt: Date; createdBy: string | null; currency: string | null; deletedAt: Date | null; deletedBy: string | null; groupId: string | null; holdExpiresAt: Date | null; id: string; organizationId: string; origin: BookingOrigin; paid: boolean; partyEmail: string | null; partyName: string | null; partyRef: string | null; payload: JsonValue; paymentRef: string | null; pendingExpiresAt: Date | null; status: BookingStatus; statusUpdatedAt: Date; statusUpdatedBy: string | null; supersededById: string | null; uid: string; updatedAt: Date; updatedBy: string | null; version: number; }>>

Inherited from

CrudRepository.findMany


findNoShowable()

findNoShowable(cutoff: Date): Promise<{
  bookingTypeId: string;
  bookingTypeVersionId: string;
  id: string;
  scheduleStartsAt: Date;
  version: number;
}[]>;

Defined in: server/bookings/booking-crud-repository.ts:336

Find all confirmed bookings whose schedule startsAt + graceMs <= now AND whose slot has NOT yet ended (endsAt > now) — the no-show sweeper's query for bookings past the grace window but still in progress. Returns only the minimal columns the sweeper needs (including the pinned policy version for per-booking grace lookup).

The endsAt > now bound partitions the timeline against findCompletable (endsAt <= now): an ended confirmed booking is ONLY completable, never no-showable. Without it the two sweeps overlap on ended slots and a lagging/absent completion tick could leave an ended booking marked no_show instead of completed (whichever sweep ran first won). markNoShow itself carries no structural endsAt guard (an operator may mark no-show manually after a slot ends), so this bound lives in the sweeper query, not the transition.

Parameters

ParameterType
cutoffDate

Returns

Promise<{ bookingTypeId: string; bookingTypeVersionId: string; id: string; scheduleStartsAt: Date; version: number; }[]>


findOfferedInGroupSlot()

findOfferedInGroupSlot(groupId: string, slot: {
  endsAt: Date;
  resourceId: string;
  startsAt: Date;
}): Promise<{
  id: string;
  version: number;
}[]>;

Defined in: server/bookings/booking-crud-repository.ts:488

The offered bookings sharing a group_id AND a slot — the party a waitlist accept/decline acts on as a UNIT (§6.10).

Scoped to the slot, not the group alone, so this agrees with how the cascade builds parties (findQueuedPartiesForResource keys on group + resource + window). A group whose members were regrouped across windows is offered as separate parties, one per window; resolving the party by group alone here would then let accepting one window's offer confirm a sibling on another, and let declining one terminalize a sibling's still-live offer.

Ordered by id for a stable batch order. Returns the minimal shape (id + version) the party operations need.

Parameters

ParameterType
groupIdstring
slot{ endsAt: Date; resourceId: string; startsAt: Date; }
slot.endsAtDate
slot.resourceIdstring
slot.startsAtDate

Returns

Promise<{ id: string; version: number; }[]>


hardDelete()

hardDelete(id: string): Promise<{
  amountOwedCents: number | null;
  bookingTypeId: string;
  bookingTypeVersionId: string;
  capacityUnits: number;
  createdAt: Date;
  createdBy: string | null;
  currency: string | null;
  deletedAt: Date | null;
  deletedBy: string | null;
  groupId: string | null;
  holdExpiresAt: Date | null;
  id: string;
  organizationId: string;
  origin: BookingOrigin;
  paid: boolean;
  partyEmail: string | null;
  partyName: string | null;
  partyRef: string | null;
  payload: JsonValue;
  paymentRef: string | null;
  pendingExpiresAt: Date | null;
  status: BookingStatus;
  statusUpdatedAt: Date;
  statusUpdatedBy: string | null;
  supersededById: string | null;
  uid: string;
  updatedAt: Date;
  updatedBy: string | null;
  version: number;
}>;

Defined in: server/persistence/base-repository.ts:377

Parameters

ParameterType
idstring

Returns

Promise<{ amountOwedCents: number | null; bookingTypeId: string; bookingTypeVersionId: string; capacityUnits: number; createdAt: Date; createdBy: string | null; currency: string | null; deletedAt: Date | null; deletedBy: string | null; groupId: string | null; holdExpiresAt: Date | null; id: string; organizationId: string; origin: BookingOrigin; paid: boolean; partyEmail: string | null; partyName: string | null; partyRef: string | null; payload: JsonValue; paymentRef: string | null; pendingExpiresAt: Date | null; status: BookingStatus; statusUpdatedAt: Date; statusUpdatedBy: string | null; supersededById: string | null; uid: string; updatedAt: Date; updatedBy: string | null; version: number; }>

Inherited from

CrudRepository.hardDelete


logActivity()

protected logActivity(
   _entityId: string, 
   _action: string, 
   _metadata?: Record<string, unknown>
): Promise<void>;

Defined in: server/persistence/base-repository.ts:140

Log an activity entry.

NOTE: This is not implemented because there's no activity model implemented in taproot yet! https://linear.app/kaizenlabs/issue/ENG-7846/add-activity-log-tables

Parameters

ParameterType
_entityIdstring
_actionstring
_metadata?Record<string, unknown>

Returns

Promise<void>

Inherited from

CrudRepository.logActivity


notFoundError()

protected notFoundError(id: string): Error;

Defined in: server/bookings/booking-crud-repository.ts:80

Create a not-found error. Override to provide custom error types.

Parameters

ParameterType
idstring

Returns

Error

Overrides

CrudRepository.notFoundError


softDelete()

softDelete(id: string): Promise<{
  amountOwedCents: number | null;
  bookingTypeId: string;
  bookingTypeVersionId: string;
  capacityUnits: number;
  createdAt: Date;
  createdBy: string | null;
  currency: string | null;
  deletedAt: Date | null;
  deletedBy: string | null;
  groupId: string | null;
  holdExpiresAt: Date | null;
  id: string;
  organizationId: string;
  origin: BookingOrigin;
  paid: boolean;
  partyEmail: string | null;
  partyName: string | null;
  partyRef: string | null;
  payload: JsonValue;
  paymentRef: string | null;
  pendingExpiresAt: Date | null;
  status: BookingStatus;
  statusUpdatedAt: Date;
  statusUpdatedBy: string | null;
  supersededById: string | null;
  uid: string;
  updatedAt: Date;
  updatedBy: string | null;
  version: number;
}>;

Defined in: server/persistence/base-repository.ts:366

Parameters

ParameterType
idstring

Returns

Promise<{ amountOwedCents: number | null; bookingTypeId: string; bookingTypeVersionId: string; capacityUnits: number; createdAt: Date; createdBy: string | null; currency: string | null; deletedAt: Date | null; deletedBy: string | null; groupId: string | null; holdExpiresAt: Date | null; id: string; organizationId: string; origin: BookingOrigin; paid: boolean; partyEmail: string | null; partyName: string | null; partyRef: string | null; payload: JsonValue; paymentRef: string | null; pendingExpiresAt: Date | null; status: BookingStatus; statusUpdatedAt: Date; statusUpdatedBy: string | null; supersededById: string | null; uid: string; updatedAt: Date; updatedBy: string | null; version: number; }>

Inherited from

CrudRepository.softDelete


sumConfirmedEnrollment()

sumConfirmedEnrollment(query: {
  from: Date;
  resourceId: string;
  to: Date;
}): Promise<number>;

Defined in: server/bookings/booking-crud-repository.ts:382

Confirmed enrollment on a resource's window (§6.10 run-decision): the SUM(capacity_units) of confirmed bookings whose schedule overlaps [from, to) on resourceId. Used by WaitlistService.decideRun to compare against the pinned minEnrollment.

Parameters

ParameterType
query{ from: Date; resourceId: string; to: Date; }
query.fromDate
query.resourceIdstring
query.toDate

Returns

Promise<number>


uidTaken()

uidTaken(organizationId: string, uid: string): Promise<boolean>;

Defined in: server/bookings/booking-crud-repository.ts:516

True if ANY booking in the org — live or soft-deleted — already carries this external uid. Deliberately no deletedAt: null filter: the @@unique([organizationId, uid]) constraint covers soft-deleted rows too, and create() probes-then-inserts without a P2002 retry (a failed INSERT would abort the surrounding transaction), so the probe must see everything the constraint sees.

Parameters

ParameterType
organizationIdstring
uidstring

Returns

Promise<boolean>


update()

update(id: string, input: Partial<{
  groupId: string | null;
  partyEmail: string | null;
  partyName: string | null;
  partyRef: string | null;
}>): Promise<{
  amountOwedCents: number | null;
  bookingTypeId: string;
  bookingTypeVersionId: string;
  capacityUnits: number;
  createdAt: Date;
  createdBy: string | null;
  currency: string | null;
  deletedAt: Date | null;
  deletedBy: string | null;
  groupId: string | null;
  holdExpiresAt: Date | null;
  id: string;
  organizationId: string;
  origin: BookingOrigin;
  paid: boolean;
  partyEmail: string | null;
  partyName: string | null;
  partyRef: string | null;
  payload: JsonValue;
  paymentRef: string | null;
  pendingExpiresAt: Date | null;
  status: BookingStatus;
  statusUpdatedAt: Date;
  statusUpdatedBy: string | null;
  supersededById: string | null;
  uid: string;
  updatedAt: Date;
  updatedBy: string | null;
  version: number;
}>;

Defined in: server/persistence/base-repository.ts:301

Parameters

ParameterType
idstring
inputPartial<{ groupId: string | null; partyEmail: string | null; partyName: string | null; partyRef: string | null; }>

Returns

Promise<{ amountOwedCents: number | null; bookingTypeId: string; bookingTypeVersionId: string; capacityUnits: number; createdAt: Date; createdBy: string | null; currency: string | null; deletedAt: Date | null; deletedBy: string | null; groupId: string | null; holdExpiresAt: Date | null; id: string; organizationId: string; origin: BookingOrigin; paid: boolean; partyEmail: string | null; partyName: string | null; partyRef: string | null; payload: JsonValue; paymentRef: string | null; pendingExpiresAt: Date | null; status: BookingStatus; statusUpdatedAt: Date; statusUpdatedBy: string | null; supersededById: string | null; uid: string; updatedAt: Date; updatedBy: string | null; version: number; }>

Inherited from

CrudRepository.update


updateIfVersion()

updateIfVersion(
   id: string, 
   data: 
  | BookingsUpdateManyMutationInput
  | BookingsUpdateManyMutationInput & {
  supersededById?: string | null;
}, 
   expectedVersion: number
): Promise<{
  amountOwedCents: number | null;
  bookingTypeId: string;
  bookingTypeVersionId: string;
  capacityUnits: number;
  createdAt: Date;
  createdBy: string | null;
  currency: string | null;
  deletedAt: Date | null;
  deletedBy: string | null;
  groupId: string | null;
  holdExpiresAt: Date | null;
  id: string;
  organizationId: string;
  origin: BookingOrigin;
  paid: boolean;
  partyEmail: string | null;
  partyName: string | null;
  partyRef: string | null;
  payload: JsonValue;
  paymentRef: string | null;
  pendingExpiresAt: Date | null;
  status: BookingStatus;
  statusUpdatedAt: Date;
  statusUpdatedBy: string | null;
  supersededById: string | null;
  uid: string;
  updatedAt: Date;
  updatedBy: string | null;
  version: number;
}>;

Defined in: server/bookings/booking-crud-repository.ts:173

Version-CAS update: zero rows ⇒ concurrent transition ⇒ StaleBookingError. Accepts the checked input plus an optional supersededById FK scalar (§7.1) so the FK escape hatch is scoped to that one field rather than allowing the full unchecked union.

Parameters

ParameterType
idstring
data| BookingsUpdateManyMutationInput | BookingsUpdateManyMutationInput & { supersededById?: string | null; }
expectedVersionnumber

Returns

Promise<{ amountOwedCents: number | null; bookingTypeId: string; bookingTypeVersionId: string; capacityUnits: number; createdAt: Date; createdBy: string | null; currency: string | null; deletedAt: Date | null; deletedBy: string | null; groupId: string | null; holdExpiresAt: Date | null; id: string; organizationId: string; origin: BookingOrigin; paid: boolean; partyEmail: string | null; partyName: string | null; partyRef: string | null; payload: JsonValue; paymentRef: string | null; pendingExpiresAt: Date | null; status: BookingStatus; statusUpdatedAt: Date; statusUpdatedBy: string | null; supersededById: string | null; uid: string; updatedAt: Date; updatedBy: string | null; version: number; }>

On this page

ExtendsConstructorsConstructorParametersReturnsInherited fromPropertiesENTITY_TYPE?Inherited fromlogger?Inherited fromprismaClientInherited fromAccessorsactorIdGet SignatureReturnsInherited fromauditCreateGet SignatureReturnscreatedByupdatedByInherited fromauditDeleteGet SignatureReturnsdeletedAtdeletedByInherited fromauditUpdateGet SignatureReturnsupdatedByInherited fromsilentGet SignatureExampleReturnsInherited fromtxGet SignatureReturnsInherited fromMethods_count()ReturnsOverrides_create()ParametersReturnsOverrides_exists()ParametersReturnsOverrides_findById()ParametersReturnsOverrides_findMany()ParametersReturnsOverrides_hardDelete()ParametersReturnsOverrides_softDelete()ParametersReturnsOverrides_update()ParametersReturnsOverridesafterCreate()ParametersReturnsInherited fromafterDelete()ParametersReturnsInherited fromafterUpdate()ParametersReturnsInherited frombeforeCreate()ParametersReturnsInherited frombeforeDelete()ParametersReturnsInherited frombeforeUpdate()ParametersReturnsInherited fromconsumeSilent()ReturnsInherited fromcount()ReturnsInherited fromcreate()ParametersReturnsInherited fromexists()ParametersReturnsInherited fromfindActiveOnResourceWindow()ParametersReturnsfindById()ParametersReturnsInherited fromfindByIdOrThrow()ParametersReturnsInherited fromfindCompletable()ParametersReturnsfindComposedOrThrow()ParametersReturnsfindDistinctSlotsInGroup()ParametersReturnsfindExpiredHolds()ParametersReturnsfindExpiredPending()ParametersReturnsfindHeldGroupSiblings()ParametersReturnsfindMany()ParametersReturnsInherited fromfindNoShowable()ParametersReturnsfindOfferedInGroupSlot()ParametersReturnshardDelete()ParametersReturnsInherited fromlogActivity()ParametersReturnsInherited fromnotFoundError()ParametersReturnsOverridessoftDelete()ParametersReturnsInherited fromsumConfirmedEnrollment()ParametersReturnsuidTaken()ParametersReturnsupdate()ParametersReturnsInherited fromupdateIfVersion()ParametersReturns