UNPKG

1.15 kBJavaScriptView Raw
1"use strict";
2var __assign = (this && this.__assign) || function () {
3 __assign = Object.assign || function(t) {
4 for (var s, i = 1, n = arguments.length; i < n; i++) {
5 s = arguments[i];
6 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7 t[p] = s[p];
8 }
9 return t;
10 };
11 return __assign.apply(this, arguments);
12};
13Object.defineProperty(exports, "__esModule", { value: true });
14exports.IdField = void 0;
15var utils_1 = require("../utils");
16var getCombinedDecorator_1 = require("./getCombinedDecorator");
17function IdField(options) {
18 if (options === void 0) { options = {}; }
19 var nullableOption = options.nullable === true ? { nullable: true } : {};
20 var uniqueOption = options.unique ? { unique: true } : {};
21 var factories = getCombinedDecorator_1.getCombinedDecorator({
22 fieldType: 'id',
23 warthogColumnMeta: options,
24 dbColumnOptions: __assign(__assign({}, nullableOption), uniqueOption)
25 });
26 return utils_1.composeMethodDecorators.apply(void 0, factories);
27}
28exports.IdField = IdField;
29//# sourceMappingURL=IdField.js.map
\No newline at end of file