@chevre/domain
Version:
Chevre Domain Library for Node.js
34 lines (28 loc) • 1.05 kB
text/typescript
// tslint:disable:no-console
import * as mongoose from 'mongoose';
import { chevre } from '../../../../lib/index';
const project = { id: <string>process.env.PROJECT_ID };
const EVENT_ID = String(process.env.EVENT_ID);
// tslint:disable-next-line:max-func-body-length
async function main() {
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
const aggregateReservationRepo = await chevre.repository.AggregateReservation.createInstance(mongoose.connection);
const aggregateReservations = await aggregateReservationRepo.searchWithReservationForId(
{
limit: 100,
page: 1,
project: { id: { $eq: project.id } },
reservationFor: {
id: { $eq: EVENT_ID },
typeOf: chevre.factory.eventType.ScreeningEvent
}
},
['aggregateOffer']
);
console.log('aggregateReservations:', aggregateReservations);
}
main()
.then(() => {
console.log('success!');
})
.catch(console.error);