1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.HasOne = void 0;
|
4 | const has_association_1 = require("./has-association");
|
5 | const association_service_1 = require("../shared/association-service");
|
6 | const association_1 = require("../shared/association");
|
7 | function HasOne(associatedClassGetter, optionsOrForeignKey) {
|
8 | return (target, propertyName) => {
|
9 | const options = (0, association_service_1.getPreparedAssociationOptions)(optionsOrForeignKey);
|
10 | if (!options.as)
|
11 | options.as = propertyName;
|
12 | (0, association_service_1.addAssociation)(target, new has_association_1.HasAssociation(associatedClassGetter, options, association_1.Association.HasOne));
|
13 | };
|
14 | }
|
15 | exports.HasOne = HasOne;
|
16 |
|
\ | No newline at end of file |