@chevre/domain
Version:
Chevre Domain Library for Node.js
120 lines (119 loc) • 3.72 kB
TypeScript
import type { BulkWriteResult } from 'mongodb';
import { AnyExpression, Connection, Document, FilterQuery, PipelineStage } from 'mongoose';
import * as factory from '../factory';
import { IDocType as IAggregateOfferDocType } from './mongoose/schemas/aggregateOffer';
type IMatchStage = PipelineStage.Match;
type KeyOfUnitPriceOffer = keyof factory.unitPriceOffer.IUnitPriceOffer;
type IProjection = {
[key in KeyOfUnitPriceOffer]?: 0 | 1;
};
/**
* 集計オファーリポジトリ
*/
export declare class AggregateOfferRepo {
private readonly aggregateOfferModel;
constructor(connection: Connection);
static CREATE_MATCH_STAGE(params: Omit<factory.unitPriceOffer.ISearchConditions, 'limit' | 'page' | 'sort'>): IMatchStage[];
static CREATE_AGGREGATE_OFFERS_PROJECTION(params: IProjection): {
[field: string]: AnyExpression;
};
search(params: factory.unitPriceOffer.ISearchConditions, projection?: IProjection): Promise<factory.aggregateOffer.IAggregateOffer[]>;
pushIncludedInDataCatalog(params: {
project: {
id: string;
};
id: {
$in: string[];
};
$push: {
includedInDataCatalog: {
$each: {
id: string;
}[];
};
};
}): Promise<void>;
/**
* 記載カタログからカタログを除外する
*/
pullIncludedInDataCatalog(params: {
project: {
id: string;
};
id?: {
$nin?: string[];
};
$pull: {
includedInDataCatalog: {
$elemMatch: {
id: {
$eq: string;
};
};
};
};
}): Promise<void>;
deleteById(params: {
project: {
id: string;
};
id: string;
}): Promise<void>;
getCursor(conditions: any, projection: any): import("mongoose").Cursor<Document<unknown, {}, IAggregateOfferDocType> & IAggregateOfferDocType & Required<{
_id: string;
}>, import("mongoose").QueryOptions<Document<unknown, {}, IAggregateOfferDocType> & IAggregateOfferDocType & Required<{
_id: string;
}>>>;
unsetUnnecessaryFields(params: {
filter: FilterQuery<factory.aggregateOffer.IAggregateOffer>;
$unset: any;
}): Promise<import("mongoose").UpdateWriteOpResult>;
save(params: factory.unitPriceOffer.IUnitPriceOffer & {}): Promise<{
id: string;
}>;
/**
* コードをキーにして冪等置換(2023-12-13~)
*/
upsertByIdentifier(params: Omit<factory.unitPriceOffer.IUnitPriceOffer, 'id'>[]): Promise<{
bulkWriteResult: BulkWriteResult;
modifiedOffers: {
id: string;
}[];
} | void>;
/**
* sskts専用オファー保管
*/
saveManyByIdentifier4sskts(params: {
project: {
id: string;
};
attributes: factory.aggregateOffer.ISubOffer;
upsert?: boolean;
}[]): Promise<void>;
/**
* プロダクトIDからアドオンを除外する
*/
pullAddOns(params: {
project: {
id: string;
};
addOn: {
itemOffered: {
id: {
$in: string[];
};
};
};
}): Promise<import("mongoose").UpdateWriteOpResult | undefined>;
countIncludedInDataCatalog(params: {
id: {
$eq: string;
};
}): Promise<{
includedInDataCatalogCount: number;
}[]>;
maxIncludedInDataCatalogCount(): Promise<{
includedInDataCatalogCount: number;
}[]>;
}
export {};