framework-do-dede 5.4.10 → 5.4.11
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.
- package/README.md +1 -1
- package/dist/domain/entity.js +6 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -341,7 +341,7 @@ Regras principais:
|
|
|
341
341
|
|
|
342
342
|
- `Model` guarda metadados de coluna (via `@column`) e nome da tabela (via `@model`)
|
|
343
343
|
- a conversao entity -> model acontece no construtor do Model (ou em um factory)
|
|
344
|
-
- `generateGetters()` cria getters para campos (ex.: `getName`, `isActive`, `hasProfile`)
|
|
344
|
+
- `generateGetters()` cria getters para campos (ex.: `getName`, `isActive`, `hasProfile`), mesmo quando o valor não foi definido.
|
|
345
345
|
|
|
346
346
|
### Storage Gateway
|
|
347
347
|
|
package/dist/domain/entity.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
export class Entity {
|
|
2
2
|
generateGetters() {
|
|
3
|
-
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
const propertiesConfigs = (this.constructor.propertiesConfigs || {});
|
|
5
|
+
const properties = new Set([...Object.keys(this), ...Object.keys(propertiesConfigs)]);
|
|
6
|
+
for (const property of properties) {
|
|
4
7
|
if (typeof this[property] === 'function')
|
|
5
8
|
continue;
|
|
6
9
|
let prefixName = null;
|
|
7
10
|
// @ts-ignore
|
|
8
|
-
if (
|
|
9
|
-
|
|
10
|
-
prefixName = this.constructor.propertiesConfigs[property].prefix;
|
|
11
|
+
if (propertiesConfigs[property] && propertiesConfigs[property].prefix) {
|
|
12
|
+
prefixName = propertiesConfigs[property].prefix;
|
|
11
13
|
}
|
|
12
14
|
else {
|
|
13
15
|
const isBoolean = this[property] ? typeof this[property] === 'boolean' : false;
|