1 |
|
2 |
|
3 |
|
4 | const moment = require('moment');
|
5 | const mongoose = require('mongoose');
|
6 | const domain = require('../');
|
7 |
|
8 | async function main() {
|
9 | await mongoose.connect(process.env.MONGOLAB_URI);
|
10 |
|
11 | const offers = await domain.service.offer.searchEventOffers({
|
12 | project: { id: 'sskts-development' },
|
13 | event: {
|
14 | id: '12116221020200121901710'
|
15 | }
|
16 | })({
|
17 | project: new domain.repository.Project(mongoose.connection),
|
18 | });
|
19 |
|
20 | console.log(offers);
|
21 | console.log(offers[0].containsPlace);
|
22 | console.log(offers[0].containsPlace.map((seat => `${seat.branchCode} ${seat.offers[0].availability} ${seat.additionalProperty.map((p) => `${p.name}:${p.value}`).join(',')}`)));
|
23 | console.log(offers.length, 'offers found.');
|
24 |
|
25 | // await mongoose.disconnect();
|
26 | }
|
27 |
|
28 | main().then(() => {
|
29 | console.log('success!');
|
30 | }).catch((error) => {
|
31 | console.error(error);
|
32 | process.exit(1);
|
33 | });
|