quaerateum
Version:
Simple typescript ORM for node.js based on data-mapper, unit-of-work and identity-map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JS.
33 lines (24 loc) • 752 B
text/typescript
import { Collection, Entity, ManyToMany, OneToMany, Property } from '../../lib';
import { Book2 } from './Book2';
import { Test2 } from './Test2';
import { BaseEntity2 } from './BaseEntity2';
()
export class Publisher2 extends BaseEntity2 {
()
name: string;
({ entity: () => Book2, fk: 'publisher' })
books: Collection<Book2>;
({ entity: () => Test2, owner: true })
tests: Collection<Test2>;
({ type: 'string', length: 10 })
type: PublisherType = PublisherType.LOCAL;
constructor(name: string = 'asd', type: PublisherType = PublisherType.LOCAL) {
super();
this.name = name;
this.type = type;
}
}
export enum PublisherType {
LOCAL = 'local',
GLOBAL = 'global',
}