1 | require('reflect-metadata/reflect');
|
2 | import * as models from './models/testModels';
|
3 | import {Decorators} from '../core/constants';
|
4 | import {DecoratorType} from '../core/enums';
|
5 | import {Strict} from '../mongoose/enums';
|
6 | import {MetaUtils} from "../core/metadata/utils";
|
7 |
|
8 | export function initializeModels1() {
|
9 | var obj1 = new models.student();
|
10 | var obj2 = new models.subject();
|
11 | var obj3 = new models.teacher();
|
12 | var obj4 = new models.division();
|
13 | }
|
14 |
|
15 | export function initializeModels() {
|
16 | //MetaUtils.addMetaData(models.student.prototype, Decorators.DOCUMENT, DecoratorType.CLASS, { name: models.student.name, strict: Strict.true });
|
17 | //MetaUtils.addMetaData(models.student.prototype, Decorators.FIELD, DecoratorType.PROPERTY, { primary: true, autogenerated: true }, '_id');
|
18 | //MetaUtils.addMetaData(models.student.prototype, Decorators.FIELD, DecoratorType.PROPERTY, null, 'name');
|
19 | //MetaUtils.addMetaData(models.student.prototype, Decorators.ONETOMANY, DecoratorType.PROPERTY, { rel: models.subject.name, itemType: models.subject, embedded: true }, 'subjects');
|
20 | //MetaUtils.addMetaData(models.student.prototype, Decorators.FIELD, DecoratorType.PROPERTY, null, 'addresses');
|
21 |
|
22 | //MetaUtils.addMetaData(models.subject, Decorators.DOCUMENT, DecoratorType.CLASS, { name: models.subject.name, strict: Strict.true });
|
23 | //MetaUtils.addMetaData(models.subject, Decorators.FIELD, DecoratorType.PROPERTY, { primary: true, autogenerated: true }, '_id');
|
24 | //MetaUtils.addMetaData(models.subject, Decorators.FIELD, DecoratorType.PROPERTY, null, 'name');
|
25 |
|
26 | //MetaUtils.addMetaData(models.teacher, Decorators.DOCUMENT, DecoratorType.CLASS, { name: models.teacher.name, strict: Strict.true });
|
27 | //MetaUtils.addMetaData(models.teacher, Decorators.FIELD, DecoratorType.PROPERTY, { primary: true, autogenerated: true }, '_id');
|
28 | //MetaUtils.addMetaData(models.teacher, Decorators.FIELD, DecoratorType.PROPERTY, null, 'name');
|
29 |
|
30 | //MetaUtils.addMetaData(models.division, Decorators.DOCUMENT, DecoratorType.CLASS, { name: models.division.name, strict: Strict.true });
|
31 | //MetaUtils.addMetaData(models.division, Decorators.FIELD, DecoratorType.PROPERTY, { primary: true, autogenerated: true }, '_id');
|
32 | //MetaUtils.addMetaData(models.division, Decorators.FIELD, DecoratorType.PROPERTY, null, 'name');
|
33 | //MetaUtils.addMetaData(models.division, Decorators.ONETOMANY, DecoratorType.PROPERTY, { rel: models.student.name, itemType: models.student, embedded: true }, 'students');
|
34 | }; |
\ | No newline at end of file |