api-core
Version:
Model-based dynamic multi-level APIs for any provider, plus multiple consumption channels
18 lines • 798 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.OneToManyRelation = void 0;
const ApiEdgeRelation_1 = require("./ApiEdgeRelation");
const Api_1 = require("../Api");
class OneToManyRelation extends ApiEdgeRelation_1.ApiEdgeRelation {
constructor(from, to, options = {}) {
super(from, to);
this.name = options.name || to.pluralName;
this.relatedId = options.relatedId || from.name + Api_1.Api.defaultIdPostfix;
this.relationId = options.relationId || to.idField;
this.hasPair = options.hasPair || false;
}
getType() { return 'one-to-many'; }
}
exports.OneToManyRelation = OneToManyRelation;
ApiEdgeRelation_1.ApiEdgeRelationTypes['one-to-many'] = OneToManyRelation;
//# sourceMappingURL=OneToManyRelation.js.map