1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.BelongsToAssociation = void 0;
|
4 | const base_association_1 = require("../shared/base-association");
|
5 | const foreign_key_service_1 = require("../foreign-key/foreign-key-service");
|
6 | const association_1 = require("../shared/association");
|
7 | class 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 | }
|
21 | exports.BelongsToAssociation = BelongsToAssociation;
|
22 |
|
\ | No newline at end of file |