// tslint:disable:no-console // import * as moment from 'moment'; import * as mongoose from 'mongoose'; import { chevre } from '../../../lib/index'; // const project = { id: String(process.env.PROJECT_ID) }; const ownershipInfoId = '40576fe8-5e6a-4caa-9622-0944d6d9cf7b'; const newOwnerId = '600ad33b-8ed1-4a8c-ad50-694bec02ff12'; async function main() { await mongoose.connect(process.env.MONGOLAB_URI); const ownershipInfoRepo = new chevre.repository.OwnershipInfo(mongoose.connection); await ownershipInfoRepo.addOwnerIfNotExist({ id: ownershipInfoId, ownedBy: { id: newOwnerId, typeOf: chevre.factory.personType.Person } }); console.log('added'); await ownershipInfoRepo.removeOwnerIfExist({ id: ownershipInfoId, ownedBy: { id: newOwnerId } }); console.log('removed'); } main() .then() .catch(console.error);