UNPKG

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.

48 lines (42 loc) 897 B
const { Collection } = require('../../lib'); const { BaseEntity4 } = require('./index').BaseEntity4; /** * @property {number} id * @property {string} name * @property {string} type * @property {Collection<Book3>} books * @property {Collection<Test3>} tests */ class Publisher3 extends BaseEntity4 { constructor(name = 'asd', type = 'local') { super(); this.name = name; this.type = type; } } const schema = { name: 'Publisher3', extends: 'BaseEntity4', properties: { name: { type: 'string', }, books: { reference: '1:m', fk: 'publisher', type: 'Book3', }, tests: { reference: 'm:n', owner: true, type: 'Test3', }, type: { type: 'PublisherType', }, }, path: __filename, }; module.exports.Publisher3 = Publisher3; module.exports.entity = Publisher3; module.exports.schema = schema;