UNPKG

1.01 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.BelongsToAssociation = void 0;
4const base_association_1 = require("../shared/base-association");
5const foreign_key_service_1 = require("../foreign-key/foreign-key-service");
6const association_1 = require("../shared/association");
7class BelongsToAssociation extends base_association_1.BaseAssociation {
8 constructor(associatedClassGetter, options) {
9 super(associatedClassGetter, options);
10 this.options = options;
11 }
12 getAssociation() {
13 return association_1.Association.BelongsTo;
14 }
15 getSequelizeOptions(model) {
16 const associatedClass = this.getAssociatedClass();
17 const foreignKey = (0, foreign_key_service_1.getForeignKeyOptions)(associatedClass, model, this.options.foreignKey);
18 return Object.assign(Object.assign({}, this.options), { foreignKey });
19 }
20}
21exports.BelongsToAssociation = BelongsToAssociation;
22//# sourceMappingURL=belongs-to-association.js.map
\No newline at end of file