UNPKG

786 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.HasOne = void 0;
4const has_association_1 = require("./has-association");
5const association_service_1 = require("../shared/association-service");
6const association_1 = require("../shared/association");
7function 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}
15exports.HasOne = HasOne;
16//# sourceMappingURL=has-one.js.map
\No newline at end of file