import type { Connection, FilterQuery } from 'mongoose'; import { factory } from '../factory'; import { IDocType } from './mongoose/schemas/order'; type IOrderWithoutAcceptedOffers = factory.order.IOrder; type IKeyOfProjection = Extract | 'paymentMethods.accountId' | 'paymentMethods.name' | 'paymentMethods.paymentMethod' | 'paymentMethods.paymentMethodId' | 'paymentMethods.totalPaymentDue' | 'paymentMethods.additionalProperty' | 'paymentMethods.issuedThrough' | 'customer.id' | 'customer.typeOf'; export type IReturnedOrder = Pick & { id: string; }; interface IAggregation { orderCount: number; totalNumAcceptedOffer: number; avgNumAcceptedOffer: number; maxNumAcceptedOffer: number; minNumAcceptedOffer: number; totalPrice: number; avgPrice: number; maxPrice: number; minPrice: number; } interface IAggregateOrder { aggregation: IAggregation; } /** * ステータス変更後注文 */ export type IOrderOnStatusChanged = Pick; type ISearchConditions = Pick; /** * 注文リポジトリ */ export declare class OrderRepo { private readonly orderModel; constructor(connection: Connection); static CREATE_MONGO_CONDITIONS(params: ISearchConditions): FilterQuery[]; /** * 注文ステータスを変更する */ changeStatus(params: { project: { id: string; }; orderNumber: string; orderStatus: factory.orderStatus; previousOrderStatus: factory.orderStatus; }): Promise; /** * 注文を返品する */ returnOrder(params: { project: { id: string; }; orderNumber: string; dateReturned: Date; returner: factory.order.IReturner; }): Promise; /** * 変更可能な属性を更新する */ updateChangeableAttributes(params: Pick & { project: { id: string; }; orderNumber: string; }): Promise<{ updatedAt: Date; }>; /** * 注文後に決済方法区分を確定する */ fixPaymentMethodIdentifier(params: { project: { id: string; }; orderNumber: string; invoice: { paymentMethodId: string; paymentMethod: { identifier: string; }; }; }): Promise; projectFieldsById(params: { id: string; inclusion: IKeyOfProjection[]; }): Promise; /** * 注文番号から注文を取得する */ projectFieldsByOrderNumber(params: { orderNumber: string; project: { id: string; }; seller?: { id?: string; }; inclusion: IKeyOfProjection[]; }): Promise; findByOrderNumberAndReservationId(params: { project: { id: string; }; seller?: { id?: string; }; orderNumber: string; reservationId: string; }): Promise>; /** * 注文番号で削除する */ deleteByOrderNumber(params: { orderNumber: string; }): Promise; count(params: factory.order.ISearchConditions): Promise; /** * 注文を検索する(inclusion projection) * redefine from search(2024-07-31~) */ projectFields(params: factory.order.ISearchConditions & { limit: number; page: number; }, options: { inclusion: IKeyOfProjection[]; }): Promise<(IOrderWithoutAcceptedOffers & { id: string; })[]>; getCursor(conditions: any, projection: any): import("mongoose").Cursor, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit & { acceptedOffers?: import("./mongoose/schemas/order").IAcceptedOfferInDoc[]; identifier?: string; paymentMethodId?: string; } & { _id: import("mongoose").Types.ObjectId; } & { __v: number; }, import("mongoose").QueryOptions, (import("mongoose").Document, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit & { acceptedOffers?: import("./mongoose/schemas/order").IAcceptedOfferInDoc[]; identifier?: string; paymentMethodId?: string; } & { _id: import("mongoose").Types.ObjectId; } & { __v: number; }) | null>; unsetUnnecessaryFields(params: { filter: FilterQuery; $unset: any; arrayFilters?: any[]; }): Promise; aggregateOrder(params: { project?: { id?: { $ne?: string; }; }; orderDate: { $gte: Date; $lte: Date; }; }): Promise; } export {};