import type { Connection, FilterQuery } from 'mongoose'; import { factory } from '../factory'; import { IEmailMessage } from './mongoose/schemas/message'; type IFindByIdentifierResult = Pick; interface ISearchConditions { limit?: number; page?: number; sort?: { datePublished?: factory.sortType; }; project?: { id?: { $eq?: string; }; }; provider?: { id?: { $eq?: string; }; }; mainEntity?: { orderNumber?: { $eq?: string; }; }; identifier?: { $eq?: string; }; about?: { identifier?: { $eq?: string; }; }; } type IKeyOfProjection = keyof IEmailMessage; /** * メッセージリポジトリ */ export declare class MessageRepo { private readonly messageModel; constructor(connection: Connection); static CREATE_MONGO_CONDITIONS(params: ISearchConditions): FilterQuery[]; /** * 検索 */ findMessages(params: ISearchConditions, inclusion: IKeyOfProjection[]): Promise<(IEmailMessage & { id: string; })[]>; /** * コードをキーにしてひとつ更新(なければ作成する) */ upsertOneByIdentifier(params: Pick): Promise; /** * コードで参照 */ findByIdentifier(params: { identifier: string; project: { id: string; }; }): Promise; unsetUnnecessaryFields(params: { filter: any; $unset: any; }): Promise; } export {};