diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a9e112..2c03dd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Release Notes +## 1.9.8 + +* added method `.archiveCascade` to `ConstraintBuilder` +* added method `.finalCascade` to `ConstraintBuilder` +* added method `.decimalDigits` to `ColumnBuilder` +* added method `.showMemberColumns` to `ColumnBuilder` + ## 1.9.7 * added `AsyncApi` to implement the async version of the `.doCall` method diff --git a/src/index.js b/src/index.js index 1a95ea3..ae6b0f3 100644 --- a/src/index.js +++ b/src/index.js @@ -738,6 +738,25 @@ function grudStructorizer(baseUrl, options) { return this; } + /** + * + * @param decimalDigits {number} + * @returns {ColumnBuilder} + */ + decimalDigits(decimalDigits) { + if (this.column.kind !== "numeric") { + throw new Error("column " + this.column.name + " should be of type numeric to set 'decimalDigits(...)'"); + } + + if (!_.isInteger(decimalDigits) || decimalDigits < 0) { + throw new Error("parameter 'decimalDigits' should be a positive integer number"); + } + + this.column.decimalDigits = decimalDigits; + + return this; + } + /** * * @param toTable {Table|number} @@ -791,6 +810,19 @@ function grudStructorizer(baseUrl, options) { return this; } + /** + * + * @param showMemberColumns {boolean} + * @returns {ColumnBuilder} + */ + showMemberColumns(showMemberColumns) { + if (this.column.kind !== "group") { + throw new Error("column " + this.column.name + " should be of type 'group' to set 'showMemberColumns(...)'"); + } + + this.column.showMemberColumns = _.isBoolean(showMemberColumns) ? showMemberColumns : true; + } + /** * * @param formatPattern {string} @@ -911,6 +943,8 @@ function grudStructorizer(baseUrl, options) { /** * @typedef {{deleteCascade: boolean}} ConstraintDeleteCascade + * @typedef {{archiveCascade: boolean}} ConstraintArchiveCascade + * @typedef {{finalCascade: boolean}} ConstraintFinalCascade */ /** @@ -966,6 +1000,28 @@ function grudStructorizer(baseUrl, options) { deleteCascade: _.isBoolean(deleteCascade) ? deleteCascade : true }; } + + /** + * + * @param archiveCascade {boolean} + * @returns {ConstraintArchiveCascade} + */ + static archiveCascade(archiveCascade) { + return { + archiveCascade: _.isBoolean(archiveCascade) ? archiveCascade : true + }; + } + + /** + * + * @param finalCascade {boolean} + * @returns {ConstraintFinalCascade} + */ + static finalCascade(finalCascade) { + return { + finalCascade: _.isBoolean(finalCascade) ? finalCascade : true + }; + } } return {