@chevre/domain
Version:
Chevre Domain Library for Node.js
39 lines (38 loc) • 1.2 kB
TypeScript
import { Connection, FilterQuery } from 'mongoose';
import * as factory from '../../factory';
import { IDocType } from '../mongoose/schemas/offer/event';
type ISearchConditions = factory.eventOffer.ISearchConditions;
export type ISavingOffer = Pick<IDocType, 'availableAtOrFrom' | 'identifier' | 'itemOffered' | 'project' | 'seller' | 'typeOf' | 'validForMemberTier' | 'validFrom' | 'validThrough'> & {
id?: never;
};
interface IUnset {
$unset?: {
[key: string]: 1;
};
}
type IDocWithId = IDocType & {
id: string;
};
type IKeyOfProjection = keyof IDocType;
/**
* イベントオファーリポジトリ
*/
export declare class EventOfferRepo {
private readonly eventOfferModel;
constructor(connection: Connection);
static CREATE_FILTER_QUERY(params: ISearchConditions): FilterQuery<IDocType>[];
save(params: {
id?: string;
attributes: ISavingOffer & IUnset;
}): Promise<{
id: string;
}>;
projectFields(conditions: ISearchConditions, inclusion: IKeyOfProjection[]): Promise<IDocWithId[]>;
deleteById(params: {
id: string;
project: {
id: string;
};
}): Promise<void>;
}
export {};