1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.BelongsToMany = void 0;
|
4 | const belongs_to_many_association_1 = require("./belongs-to-many-association");
|
5 | const association_service_1 = require("../shared/association-service");
|
6 | function BelongsToMany(associatedClassGetter, throughOrOptions, foreignKey, otherKey) {
|
7 | return (target, propertyName) => {
|
8 | let options = { foreignKey, otherKey };
|
9 | if (typeof throughOrOptions === 'string' || typeof throughOrOptions === 'function') {
|
10 | options.through = throughOrOptions;
|
11 | }
|
12 | else {
|
13 | options = Object.assign({}, throughOrOptions);
|
14 | }
|
15 | if (!options.as)
|
16 | options.as = propertyName;
|
17 | (0, association_service_1.addAssociation)(target, new belongs_to_many_association_1.BelongsToManyAssociation(associatedClassGetter, options));
|
18 | };
|
19 | }
|
20 | exports.BelongsToMany = BelongsToMany;
|
21 |
|
\ | No newline at end of file |