@chevre/domain
Version:
Chevre Domain Library for Node.js
44 lines (36 loc) • 1.47 kB
text/typescript
// tslint:disable:no-console
import * as mongoose from 'mongoose';
import { chevre } from '../../../lib/index';
async function main() {
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
const scheduleRepo = await chevre.repository.Schedule.createInstance(mongoose.connection);
const findOneIdResult = await scheduleRepo.findOneId();
// tslint:disable-next-line:no-null-keyword
console.dir(findOneIdResult, { depth: null });
const result = await scheduleRepo.findOne({ id: { $eq: '672bf38b5d6d3f5642d658fc' } });
// tslint:disable-next-line:no-null-keyword
console.dir(result, { depth: null });
if (result === null) {
// await scheduleRepo.saveOne({
// project: { id: 'ttts-test', typeOf: chevre.factory.organizationType.Project },
// film: '001',
// theater: '001',
// eventServiceProductID: 'EventService8k7nv3w4b',
// duration: 15,
// noPerformanceTimes: [
// '2215',
// '2230',
// '2245'
// ],
// hours: ['9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22'],
// minutes: ['00', '15', '30', '45'],
// tours: ['1', '2', '3', '4'],
// start: 91,
// days: 1
// });
// console.log('saved');
}
}
main()
.then(console.log)
.catch(console.error);