UNPKG

@chevre/domain

Version:

Chevre Domain Library for Node.js

137 lines (136 loc) 5.95 kB
import { AnyExpression, Connection, FilterQuery, QueryOptions, Types } from 'mongoose'; import * as factory from '../factory'; export type ISellerWithId = Pick<factory.seller.ISeller, 'additionalProperty' | 'branchCode' | 'hasMerchantReturnPolicy' | 'id' | 'makesOffer' | 'name' | 'project' | 'telephone' | 'typeOf' | 'url'> & { id: string; }; type ISavingSeller = Pick<factory.seller.ISeller, 'additionalProperty' | 'branchCode' | 'hasMerchantReturnPolicy' | 'id' | 'makesOffer' | 'name' | 'project' | 'telephone' | 'typeOf' | 'url'>; interface IUnset { $unset?: { [key: string]: 1; }; } type ISellerByAggregate = Pick<ISellerWithId, 'additionalProperty' | 'branchCode' | 'id' | 'name' | 'project' | 'telephone' | 'typeOf' | 'url'> & { hasMerchantReturnPolicy?: Pick<factory.seller.IEachReturnPolicy, 'url'>[]; }; interface IMemberSearchConditions { /** * 販売者メンバーで絞る場合 */ member?: { memberOf?: { id?: { $in?: string[]; }; }; }; } type IKeyOfProjection = keyof ISellerWithId; /** * 販売者リポジトリ * 対応決済方法については * see SellerPaymentAcceptedRepo */ export declare class SellerRepo { private readonly sellerModel; constructor(connection: Connection); static CREATE_MONGO_CONDITIONS(params: factory.seller.ISearchConditions & IMemberSearchConditions): FilterQuery<factory.seller.ISeller>[]; static CREATE_AGGREGATE_SELLERS_PROJECTION(exclusion: (keyof ISellerByAggregate)[]): { [field: string]: AnyExpression; }; /** * 販売者を保管する */ save(params: { id?: string; attributes: ISavingSeller & IUnset; }): Promise<{ id: string; }>; /** * 集計検索(publicな属性検索が目的) */ searchByAggregate(conditions: factory.seller.ISearchConditions & IMemberSearchConditions, exclusion: (keyof ISellerByAggregate)[]): Promise<ISellerByAggregate[]>; /** * 販売者検索 */ projectFields(conditions: factory.seller.ISearchConditions & IMemberSearchConditions, inclusion: IKeyOfProjection[]): Promise<ISellerWithId[]>; /** * 販売者を削除する */ deleteById(params: { project: { id: string; }; id: string; }): Promise<void>; /** * プロジェクト指定で削除する */ deleteByProject(params: { project: { id: string; }; }): Promise<void>; addAvailableAtOrFrom(params: { id: string; makesOffer: factory.seller.IMakesOffer; }): Promise<void>; getCursor(conditions: FilterQuery<factory.seller.ISeller>, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, {}, { url?: string | undefined; project: Pick<factory.project.IProject, "id" | "typeOf">; name: import("@chevre/factory/lib/multilingualString").IMultilingualString; typeOf: factory.organizationType.Corporation; location?: factory.organization.ILocation | undefined; additionalProperty?: import("@chevre/factory/lib/propertyValue").IPropertyValue<string>[] | undefined; branchCode: string; telephone?: string | undefined; hasMerchantReturnPolicy?: factory.seller.IHasMerchantReturnPolicy | undefined; makesOffer?: factory.seller.IMakesOffer[] | undefined; paymentAccepted?: factory.seller.IPaymentAccepted[] | undefined; }> & { url?: string | undefined; project: Pick<factory.project.IProject, "id" | "typeOf">; name: import("@chevre/factory/lib/multilingualString").IMultilingualString; typeOf: factory.organizationType.Corporation; location?: factory.organization.ILocation | undefined; additionalProperty?: import("@chevre/factory/lib/propertyValue").IPropertyValue<string>[] | undefined; branchCode: string; telephone?: string | undefined; hasMerchantReturnPolicy?: factory.seller.IHasMerchantReturnPolicy | undefined; makesOffer?: factory.seller.IMakesOffer[] | undefined; paymentAccepted?: factory.seller.IPaymentAccepted[] | undefined; } & { _id: Types.ObjectId; }, QueryOptions<import("mongoose").Document<unknown, {}, { url?: string | undefined; project: Pick<factory.project.IProject, "id" | "typeOf">; name: import("@chevre/factory/lib/multilingualString").IMultilingualString; typeOf: factory.organizationType.Corporation; location?: factory.organization.ILocation | undefined; additionalProperty?: import("@chevre/factory/lib/propertyValue").IPropertyValue<string>[] | undefined; branchCode: string; telephone?: string | undefined; hasMerchantReturnPolicy?: factory.seller.IHasMerchantReturnPolicy | undefined; makesOffer?: factory.seller.IMakesOffer[] | undefined; paymentAccepted?: factory.seller.IPaymentAccepted[] | undefined; }> & { url?: string | undefined; project: Pick<factory.project.IProject, "id" | "typeOf">; name: import("@chevre/factory/lib/multilingualString").IMultilingualString; typeOf: factory.organizationType.Corporation; location?: factory.organization.ILocation | undefined; additionalProperty?: import("@chevre/factory/lib/propertyValue").IPropertyValue<string>[] | undefined; branchCode: string; telephone?: string | undefined; hasMerchantReturnPolicy?: factory.seller.IHasMerchantReturnPolicy | undefined; makesOffer?: factory.seller.IMakesOffer[] | undefined; paymentAccepted?: factory.seller.IPaymentAccepted[] | undefined; } & { _id: Types.ObjectId; }>>; unsetUnnecessaryFields(params: { filter: any; $unset: any; }): Promise<import("mongoose").UpdateWriteOpResult>; } export {};