@chevre/domain
Version:
Chevre Domain Library for Node.js
127 lines (126 loc) • 3.9 kB
TypeScript
import type { BulkWriteResult } from 'mongodb';
import { Connection, FilterQuery } from 'mongoose';
import * as factory from '../factory';
export type IAggregatedOfferCatalog = Pick<factory.offerCatalog.IOfferCatalog, 'id' | 'name' | 'description' | 'project' | 'typeOf' | 'identifier' | 'itemOffered' | 'additionalProperty' | 'relatedOffer'> & {
numberOfItems?: number;
itemListElementTypeOf: factory.offerType.Offer;
};
type IKeyOfProjection = 'name' | 'description' | 'project' | 'typeOf' | 'id' | 'identifier' | 'itemOffered' | 'additionalProperty' | 'numberOfItems' | 'itemListElementTypeOf' | 'dateSynced' | 'relatedOffer';
/**
* サブカタログリポジトリ
*/
export declare class OfferCatalogItemRepo {
private readonly offerCatalogItemModel;
constructor(connection: Connection);
static CREATE_MONGO_CONDITIONS(params: factory.offerCatalog.ISearchConditions): any[];
save(params: factory.offerCatalog.IOfferCatalog & {
$unset?: any;
}): Promise<{
id: string;
}>;
/**
* プロジェクトとコードから冪等保管
*/
saveByIdentifier(params: factory.offerCatalog.IOfferCatalog): Promise<{
id: string;
}>;
/**
* コードをキーにして冪等置換(2023-12-14~)
*/
upsertManyByIdentifier(params: {
$set: factory.offerCatalog.IOfferCatalog;
$unset?: {
[key in keyof factory.offerCatalog.IOfferCatalog]?: 1;
};
}[]): Promise<{
bulkWriteResult: BulkWriteResult;
modifiedCatalogs: {
id: string;
}[];
} | void>;
/**
* 同期日時を更新する
*/
updateDateSynced(params: {
id: string;
dateSynced: Date;
}): Promise<void>;
updateManyById(params: {
id: {
$in: string[];
};
$push: {
itemListElement: {
$each: factory.offerCatalog.IItemListElement[];
$slice: number;
};
};
$pull: {
itemListElement: {
$elemMatch: {
id: {
$in: string[];
};
};
};
};
}): Promise<void>;
count(params: Omit<factory.offerCatalog.ISearchConditions, 'limit' | 'page' | 'sort'>): Promise<number>;
projectFields(params: factory.offerCatalog.ISearchConditions, inclusion: IKeyOfProjection[]): Promise<IAggregatedOfferCatalog[]>;
findItemListElementById(params: {
id: string;
project: {
id: string;
};
}): Promise<{
itemListElement: {
id: string;
}[];
}>;
/**
* カタログのitemListElementをpaging有で検索する
* reimplement using $slice(2025-05-06=)
*/
sliceItemListElementById(params: {
/**
* カタログID
*/
id: string;
limit: number;
page: number;
}): Promise<{
id: string;
elementIndex: number;
}[]>;
deleteById(params: {
id: string;
}): Promise<void>;
pullItemListElement(params: {
project: {
id: string;
};
$pull: {
itemListElement: {
$elemMatch: {
id: {
$in: string[];
};
};
};
};
}): Promise<import("mongoose").UpdateWriteOpResult | undefined>;
unsetUnnecessaryFields(params: {
filter: FilterQuery<factory.offerCatalog.IOfferCatalog>;
$unset: any;
}): Promise<import("mongoose").UpdateWriteOpResult>;
aggregateItemList(params: {
itemListElement: {
typeOf: {
$eq: factory.offerType.Offer | 'OfferCatalog';
};
};
}): Promise<{
aggregation: any;
}>;
}
export {};