Skip to content

Commit 8b2b631

Browse files
Merge pull request #380 from 4lessandrodev/develop
Develop
2 parents eb7c55b + cae2ba5 commit 8b2b631

31 files changed

+381
-426
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@ All notable changes to this project will be documented in this file.
88

99
## Released
1010

11+
### [3.9.0] - 2024-04-28
12+
13+
### Update (Break Change)
14+
15+
- Update core to v1.23.0
16+
- check [Core Changelog](https://github.com/4lessandrodev/rich-domain/blob/main/CHANGELOG.md)
17+
18+
---
19+
20+
## Released
21+
1122
### [3.8.3] - 2024-04-13
1223

1324
### Update

lib/types/types.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
ICommand,
2626
} from 'rich-domain/types';
2727
import { IProxy, IIterator, IHistory, IEntityHistory } from 'rich-domain/types';
28-
import { IGettersAndSetters, IParentName } from 'rich-domain/types';
28+
import { IParentName } from 'rich-domain/types';
2929

3030
export interface CloneProps {
3131
isNew: boolean;
@@ -155,7 +155,6 @@ export {
155155
IIterator,
156156
IHistory,
157157
IEntityHistory,
158-
IGettersAndSetters,
159158
IParentName,
160159
IUseCase,
161160
IPropsValidation,

lib/utils/birthday.value-object.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ interface Prop {
88
export class BirthdayValueObject extends ValueObject<Prop> {
99
private readonly ONE_YEAR: number = 31536000902;
1010
protected static readonly MAX_HUMAN_AGE: number = 121;
11-
protected static readonly DISABLE_SETTER: boolean = true;
1211
protected static readonly MESSAGE: string = `Invalid age for a human. Must has less than ${BirthdayValueObject.MAX_HUMAN_AGE} years old and birth not in future`;
1312

1413
private constructor(prop: Prop) {
15-
super(prop, { disableSetters: BirthdayValueObject.DISABLE_SETTER });
14+
super(prop);
1615
}
1716

1817
/**

lib/utils/cnpj.value-object.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@ interface Prop {
1313

1414
export class CNPJValueObject extends ValueObject<Prop> {
1515
protected static readonly REGEX = regexCnpj;
16-
protected static readonly DISABLE_SETTER: boolean = true;
1716
protected static readonly MESSAGE: string = 'Invalid value for cnpj';
1817

1918
private constructor(props: Prop) {
20-
super(props, { disableSetters: CNPJValueObject.DISABLE_SETTER });
19+
super(props);
2120
this.removeSpecialChars();
2221
}
2322

lib/utils/color-converter.util.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { HEXColorValueObject, RGBColorValueObject } from '..';
2-
31
const colorConverter = {
42
/**
53
*
@@ -8,8 +6,8 @@ const colorConverter = {
86
* @example #ffffff
97
* @returns rgb(255, 255, 255)
108
*/
11-
HEXToRGB(color: string) {
12-
const isValid = HEXColorValueObject.isValidProps(color);
9+
HEXToRGB(color: string, validate?: (color: string) => boolean) {
10+
const isValid = validate?.(color) ?? true;
1311

1412
if (!isValid) {
1513
return color;
@@ -32,8 +30,8 @@ const colorConverter = {
3230
* @example rgb(255, 255, 255)
3331
* @returns hex color #ffffff
3432
*/
35-
RGBToHEX(color: string) {
36-
const isValid = RGBColorValueObject.isValidProps(color);
33+
RGBToHEX(color: string, validate?: (color: string) => boolean) {
34+
const isValid = validate?.(color) ?? true;
3735

3836
if (!isValid) {
3937
return color;

lib/utils/color-generator.util.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const colorGenerator = {
2929
const color = randomRGBColor();
3030
let hexColor = colorConverter.RGBToHEX(
3131
`rgb(${color.R}, ${color.G}, ${color.B})`,
32+
() => true,
3233
);
3334
hexColor += '000';
3435
return hexColor.slice(0, 7);

lib/utils/cpf.value-object.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ interface Prop {
1111

1212
export class CPFValueObject extends ValueObject<Prop> {
1313
protected static readonly REGEX = regexCpf;
14-
protected static readonly DISABLE_SETTER: boolean = true;
1514
protected static readonly MESSAGE: string = 'Invalid value for cpf';
1615

1716
private constructor(props: Prop) {
18-
super(props, { disableSetters: CPFValueObject.DISABLE_SETTER });
17+
super(props);
1918
this.removeSpecialChars();
2019
}
2120

lib/utils/currency.value-object.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,10 @@ interface Prop {
5656
*/
5757
class CurrencyValueObject extends ValueObject<Prop> {
5858
private cents: number;
59-
protected static readonly DISABLE_SETTER: boolean = true;
6059
protected static readonly MESSAGE: string = `Value is not a safe number, must be between ${minSafeValue} and ${maxSafeValue}`;
6160

6261
private constructor(props: Prop) {
63-
super(props, { disableSetters: CurrencyValueObject.DISABLE_SETTER });
62+
super(props);
6463
this.cents = convertValueToCent(props.value);
6564
}
6665

lib/utils/custom-number.value-object.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,11 @@ export class CustomNumberValueObject extends ValueObject<Prop> {
2121
};
2222
protected static readonly MAX: number = Number.MAX_SAFE_INTEGER;
2323
protected static readonly MIN: number = Number.MIN_SAFE_INTEGER;
24-
protected static readonly DISABLE_SETTER: boolean = true;
2524
protected static readonly MESSAGE: string =
2625
'Invalid value for a custom number';
2726

2827
private constructor(props: Prop) {
29-
super(props, {
30-
disableSetters: CustomNumberValueObject.DISABLE_SETTER,
31-
});
28+
super(props);
3229
}
3330

3431
/**

lib/utils/custom-string.value-object.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,11 @@ export class CustomStringValueObject extends ValueObject<Prop> {
2121
};
2222
protected static readonly MAX_LENGTH: number = 255;
2323
protected static readonly MIN_LENGTH: number = 1;
24-
protected static readonly DISABLE_SETTER: boolean = true;
2524
protected static readonly MESSAGE: string =
2625
'Invalid value for a custom string';
2726

2827
private constructor(props: Prop) {
29-
super(props, {
30-
disableSetters: CustomStringValueObject.DISABLE_SETTER,
31-
});
28+
super(props);
3229
}
3330

3431
/**

0 commit comments

Comments
 (0)