// tslint:disable:no-console // import * as redis from 'redis'; import * as moment from 'moment'; import * as mongoose from 'mongoose'; import { chevre } from '../../../lib/index'; const project = { id: String(process.env.PROJECT_ID) }; async function main() { await mongoose.connect(process.env.MONGOLAB_URI); const actionRepo = new chevre.repository.Action(mongoose.connection); const categoryCodeRepo = new chevre.repository.CategoryCode(mongoose.connection); const eventRepo = new chevre.repository.Event(mongoose.connection); const placeRepo = new chevre.repository.Place(mongoose.connection); await chevre.service.event.importFromCOA({ project: { id: project.id, typeOf: chevre.factory.organizationType.Project }, locationBranchCode: '120', importFrom: moment() .toDate(), importThrough: moment() .add(1, 'day') .toDate(), saveMovieTheater: false, saveScreeningEventSeries: false })({ action: actionRepo, categoryCode: categoryCodeRepo, event: eventRepo, place: placeRepo }); console.log('imported'); } main() .then(console.log) .catch(console.error);