@chevre/domain
Version:
Chevre Domain Library for Node.js
45 lines (37 loc) • 1.21 kB
text/typescript
// tslint:disable:no-console
// import * as redis from 'redis';
import * as mongoose from 'mongoose';
import { chevre } from '../../../../lib/index';
const project = { typeOf: chevre.factory.organizationType.Project, id: String(process.env.PROJECT_ID) };
async function main() {
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
const posRepo = await chevre.repository.place.HasPOS.createInstance(mongoose.connection, { id: '5bfb841d5a78d7948369979a' });
const poses = await posRepo.search({
limit: 10,
page: 1,
project: { id: { $eq: project.id } },
branchCode: {
// $eq: '002',
$regex: '^0'
}
});
console.log(poses);
console.log(poses.length);
// await posRepo.create({
// project: { id: project.id },
// id: '004',
// name: 'test'
// });
// await posRepo.update({
// project: { id: project.id },
// id: '004',
// name: 'test2'
// });
// await posRepo.deleteByBranchCode({
// project: { id: project.id },
// branchCode: '004'
// });
}
main()
.then(console.log)
.catch(console.error);