// tslint:disable:no-console
import * as mongoose from 'mongoose';
import { chevre } from '../../../lib/index';

const PROJECT_ID = String(process.env.PROJECT_ID);

async function main() {
    await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });

    const eventRepo: chevre.repository.Event = await chevre.repository.Event.createInstance(mongoose.connection);

    const result = await eventRepo.updatePartiallyById<chevre.factory.eventType.ScreeningEvent>({
        project: { id: PROJECT_ID },
        id: 'blxd1grxw',
        attributes: { typeOf: chevre.factory.eventType.ScreeningEvent, eventStatus: chevre.factory.eventStatusType.EventScheduled }
    });
    console.log(result);
}

main()
    .then(console.log)
    .catch(console.error);
