@open-norantec/herbal 1.0.2-alpha.0 → 1.0.2-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
- import { BelongsToOptions } from 'sequelize';
1
+ import { BelongsToOptions, ModelAttributeColumnOptions } from 'sequelize';
2
2
  import { Model, TableOptions, ModelClassGetter } from 'sequelize-typescript';
3
3
  import { Constructor } from 'type-fest';
4
4
  export * from 'sequelize-typescript';
5
5
  export declare function Table<M extends Model = Model>(options: TableOptions<M>): (target: Constructor<M>) => void;
6
6
  export declare function BelongsTo(associatedClassGetter: ModelClassGetter<{}, {}>, options?: BelongsToOptions): Function;
7
+ export declare function DateColumn(options: Partial<ModelAttributeColumnOptions>): Function;
@@ -25,7 +25,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
25
25
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
26
26
  };
27
27
  Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.BelongsTo = exports.Table = void 0;
28
+ exports.DateColumn = exports.BelongsTo = exports.Table = void 0;
29
29
  var sequelize_typescript_1 = require("sequelize-typescript");
30
30
  __exportStar(require("sequelize-typescript"), exports);
31
31
  function Table(options) {
@@ -45,3 +45,12 @@ function BelongsTo(associatedClassGetter, options) {
45
45
  return (0, sequelize_typescript_1.BelongsTo)(associatedClassGetter, __assign({ onUpdate: 'CASCADE', onDelete: 'CASCADE' }, options));
46
46
  }
47
47
  exports.BelongsTo = BelongsTo;
48
+ function DateColumn(options) {
49
+ return function (target, propertyName, propertyDescriptor) {
50
+ (0, sequelize_typescript_1.Column)(__assign(__assign({}, options), { type: sequelize_typescript_1.DataType.DATE, get: function () {
51
+ var _a, _b, _c, _d;
52
+ return (_d = (_c = (_b = (_a = this.getDataValue) === null || _a === void 0 ? void 0 : _a.call(this, propertyName)) === null || _b === void 0 ? void 0 : _b.toISOString) === null || _c === void 0 ? void 0 : _c.call(_b)) !== null && _d !== void 0 ? _d : null;
53
+ } }))(target, propertyName, propertyDescriptor);
54
+ };
55
+ }
56
+ exports.DateColumn = DateColumn;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-norantec/herbal",
3
- "version": "1.0.2-alpha.0",
3
+ "version": "1.0.2-alpha.1",
4
4
  "description": "Herbal is a builder and toolchain for Nest.js applications",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {