UNPKG

@chevre/domain

Version:

Chevre Domain Library for Node.js

167 lines (166 loc) 6.72 kB
import type { BulkWriteResult } from 'mongodb'; import type { Connection, FilterQuery, UpdateWriteOpResult } from 'mongoose'; import * as factory from '../factory'; export interface IUpdatePartiallyParams { additionalTicketText?: string; } export type ICancelResult = UpdateWriteOpResult; export type ICheckedInResult = UpdateWriteOpResult; export type ICreatingReservation<T extends factory.reservationType> = T extends factory.reservationType.BusReservation ? (Omit<factory.reservation.busReservation.IReservation, 'id'>) & { _id: string; } : T extends factory.reservationType.EventReservation ? (Omit<factory.reservation.eventReservation.IReservation, 'id'>) & { _id: string; } : never; type IKeyOfProjection = keyof factory.reservation.IReservation<factory.reservationType.BusReservation | factory.reservationType.EventReservation> | 'reservedTicket.dateUsed' | 'reservationFor.id' | 'reservationFor.typeOf'; export type IAttendedReservation = Pick<factory.reservation.IReservation<factory.reservationType.EventReservation>, 'id' | 'typeOf' | 'project' | 'modifiedTime'> & { reservationFor: Pick<factory.reservation.IReservationFor<factory.reservationType.EventReservation>, 'id' | 'typeOf'>; reservedTicket: Pick<factory.reservation.ITicket, 'dateUsed'>; }; /** * 予約リポジトリ */ export declare class ReservationRepo { private readonly reservationModel; constructor(connection: Connection); static CREATE_MONGO_CONDITIONS(params: factory.reservation.ISearchConditions<factory.reservationType>): FilterQuery<import("@chevre/factory/lib/reservation/busReservation").IReservation | import("@chevre/factory/lib/reservation/event").IReservation | import("@chevre/factory/lib/reservation/reservationPackage").IReservation>[]; /** * 汎用予約カウント */ count<T extends factory.reservationType>(params: factory.reservation.ISearchConditions<T>): Promise<number>; /** * 予約検索 * migrate from search(2024-08-08~) */ projectFields<T extends factory.reservationType>(params: factory.reservation.ISearchConditions<T>, inclusion?: { [key in IKeyOfProjection]?: 1; }): Promise<factory.reservation.IReservation<factory.reservationType.EventReservation>[]>; projectFieldsById<T extends factory.reservationType>(params: { id: string; inclusion?: IKeyOfProjection[]; }): Promise<factory.reservation.IReservation<T>>; confirmManyIfNotExist(params: { bookingTime: Date; project: { id: string; }; provider: factory.reservation.IProvider; subReservation: factory.assetTransaction.reserve.IObjectSubReservation[]; issuedThrough: factory.assetTransaction.reserve.IIssuedThrough; reservationFor: factory.assetTransaction.reserve.IReservationFor; reservationNumber: string; underName?: factory.reservation.IUnderName<factory.reservationType.EventReservation>; broker?: factory.reservation.IBroker<factory.reservationType>; }): Promise<BulkWriteResult | void>; /** * 予約取消 */ cancelById<T extends factory.reservationType>(params: { id: string; previousReservationStatus?: factory.reservationStatusType; modifiedTime: Date; }): Promise<void>; /** * 予約取消 */ cancelByReservationNumber(params: { reservationNumber: string; previousReservationStatus?: factory.reservationStatusType; modifiedTime: Date; }): Promise<ICancelResult>; /** * 発券する */ checkInIfNot(params: { id?: string | { $in?: string[]; }; reservationNumber?: string | { $in?: string[]; }; /** * modifiedTime */ now: Date; }): Promise<ICheckedInResult | undefined>; /** * 入場する */ attendIfNotAttended(params: { id: string; /** * modifiedTime */ now: Date; }): Promise<IAttendedReservation>; /** * 予約部分更新 */ updatePartiallyById(params: { id: string; update: IUpdatePartiallyParams; }): Promise<void>; deleteByIds(params: { project: { id: string; }; ids: string[]; }): Promise<void>; deleteByReservationNumbers(params: { project: { id: string; }; reservationNumbers: string[]; }): Promise<{ n?: number; ok?: number; deletedCount?: number; } | null>; deleteByProject(params: { project: { id: string; }; }): Promise<void>; searchIdsByReservationNumber(params: { reservationNumber: { $in: string[]; }; }): Promise<string[]>; getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, {}, (Omit<import("@chevre/factory/lib/reservation/busReservation").IReservation, "id"> | Omit<import("@chevre/factory/lib/reservation/event").IReservation, "id">) & { _id: string; bookingAgent?: any; previousReservationStatus?: factory.reservationStatusType; }> & ((Omit<import("@chevre/factory/lib/reservation/busReservation").IReservation, "id"> & { _id: string; bookingAgent?: any; previousReservationStatus?: factory.reservationStatusType; } & Required<{ _id: string; }>) | (Omit<import("@chevre/factory/lib/reservation/event").IReservation, "id"> & { _id: string; bookingAgent?: any; previousReservationStatus?: factory.reservationStatusType; } & Required<{ _id: string; }>)), import("mongoose").QueryOptions<import("mongoose").Document<unknown, {}, (Omit<import("@chevre/factory/lib/reservation/busReservation").IReservation, "id"> | Omit<import("@chevre/factory/lib/reservation/event").IReservation, "id">) & { _id: string; bookingAgent?: any; previousReservationStatus?: factory.reservationStatusType; }> & ((Omit<import("@chevre/factory/lib/reservation/busReservation").IReservation, "id"> & { _id: string; bookingAgent?: any; previousReservationStatus?: factory.reservationStatusType; } & Required<{ _id: string; }>) | (Omit<import("@chevre/factory/lib/reservation/event").IReservation, "id"> & { _id: string; bookingAgent?: any; previousReservationStatus?: factory.reservationStatusType; } & Required<{ _id: string; }>))>>; unsetUnnecessaryFields(params: { filter: any; $unset: any; }): Promise<UpdateWriteOpResult>; } export {};