@natrave/shared-entities 8.28.0 → 8.29.0
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/dist/common/utils/decimal-transformer.utils.d.ts +4 -0
- package/dist/common/utils/decimal-transformer.utils.d.ts.map +1 -1
- package/dist/common/utils/decimal-transformer.utils.js +15 -1
- package/dist/facilities/addresses/address.entity.d.ts +3 -4
- package/dist/facilities/addresses/address.entity.d.ts.map +1 -1
- package/dist/facilities/addresses/address.entity.js +7 -5
- package/package.json +1 -1
|
@@ -2,4 +2,8 @@ export declare const DecimalTransformer: {
|
|
|
2
2
|
to: (value: number) => number;
|
|
3
3
|
from: (value: string) => number;
|
|
4
4
|
};
|
|
5
|
+
export declare const NullableDecimalTransformer: {
|
|
6
|
+
to: (value: number | null | undefined) => number | null;
|
|
7
|
+
from: (value: string | null) => number | null;
|
|
8
|
+
};
|
|
5
9
|
//# sourceMappingURL=decimal-transformer.utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decimal-transformer.utils.d.ts","sourceRoot":"","sources":["../../../src/common/utils/decimal-transformer.utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB;gBACjB,MAAM,KAAG,MAAM;kBAMb,MAAM,KAAG,MAAM;CAK9B,CAAC"}
|
|
1
|
+
{"version":3,"file":"decimal-transformer.utils.d.ts","sourceRoot":"","sources":["../../../src/common/utils/decimal-transformer.utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB;gBACjB,MAAM,KAAG,MAAM;kBAMb,MAAM,KAAG,MAAM;CAK9B,CAAC;AAMF,eAAO,MAAM,0BAA0B;gBACzB,MAAM,GAAG,IAAI,GAAG,SAAS,KAAG,MAAM,GAAG,IAAI;kBAMvC,MAAM,GAAG,IAAI,KAAG,MAAM,GAAG,IAAI;CAK5C,CAAC"}
|
|
@@ -11,6 +11,20 @@ const DecimalTransformer = {
|
|
|
11
11
|
return isNaN(parsed) ? NaN : parsed;
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
|
+
const NullableDecimalTransformer = {
|
|
15
|
+
to: (value) => {
|
|
16
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return value;
|
|
20
|
+
},
|
|
21
|
+
from: (value) => {
|
|
22
|
+
if (value === null || value === void 0) return null;
|
|
23
|
+
const parsed = parseFloat(value.trim());
|
|
24
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
14
27
|
export {
|
|
15
|
-
DecimalTransformer
|
|
28
|
+
DecimalTransformer,
|
|
29
|
+
NullableDecimalTransformer
|
|
16
30
|
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { IAddress } from '@natrave/facility-service-types';
|
|
2
1
|
import { OrganizationUserBillingInfo } from '../../central-auth';
|
|
3
2
|
import { BrazilianState } from '../../common/enums/brazilian-state.enum';
|
|
4
3
|
import { Facility } from '../../facilities/facilities';
|
|
5
|
-
export declare class Address
|
|
4
|
+
export declare class Address {
|
|
6
5
|
id: number;
|
|
7
6
|
createdAt: Date;
|
|
8
7
|
updatedAt: Date;
|
|
@@ -14,8 +13,8 @@ export declare class Address implements IAddress {
|
|
|
14
13
|
state: BrazilianState;
|
|
15
14
|
postalCode: string;
|
|
16
15
|
country: string;
|
|
17
|
-
latitude: number;
|
|
18
|
-
longitude: number;
|
|
16
|
+
latitude: number | null;
|
|
17
|
+
longitude: number | null;
|
|
19
18
|
facilities: Facility[];
|
|
20
19
|
organizationUserBillingInfos: OrganizationUserBillingInfo[];
|
|
21
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address.entity.d.ts","sourceRoot":"","sources":["../../../src/facilities/addresses/address.entity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"address.entity.d.ts","sourceRoot":"","sources":["../../../src/facilities/addresses/address.entity.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAWvD,qBAEa,OAAO;IAIlB,EAAE,EAAE,MAAM,CAAC;IAOX,SAAS,EAAE,IAAI,CAAC;IAOhB,SAAS,EAAE,IAAI,CAAC;IAQhB,aAAa,EAAE,MAAM,CAAC;IAQtB,MAAM,EAAE,MAAM,CAAC;IAQf,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAO1B,YAAY,EAAE,MAAM,CAAC;IAOrB,IAAI,EAAE,MAAM,CAAC;IAOb,KAAK,EAAE,cAAc,CAAC;IAQtB,UAAU,EAAE,MAAM,CAAC;IAOnB,OAAO,EAAE,MAAM,CAAC;IAWhB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAWxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAUzB,UAAU,EAAE,QAAQ,EAAE,CAAC;IAMvB,4BAA4B,EAAE,2BAA2B,EAAE,CAAC;CAC7D"}
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
} from "typeorm";
|
|
20
20
|
import { OrganizationUserBillingInfo } from "../../central-auth/index.js";
|
|
21
21
|
import { BrazilianState } from "../../common/enums/brazilian-state.enum.js";
|
|
22
|
-
import {
|
|
22
|
+
import { NullableDecimalTransformer } from "../../common/utils/decimal-transformer.utils.js";
|
|
23
23
|
import { Facility } from "../../facilities/facilities/index.js";
|
|
24
24
|
let Address = class {
|
|
25
25
|
};
|
|
@@ -107,8 +107,9 @@ __decorateClass([
|
|
|
107
107
|
type: "decimal",
|
|
108
108
|
precision: 10,
|
|
109
109
|
scale: 8,
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
nullable: true,
|
|
111
|
+
transformer: NullableDecimalTransformer,
|
|
112
|
+
comment: "Coordenada geogr\xE1fica de latitude. Nulo quando o local n\xE3o tem localiza\xE7\xE3o conhecida."
|
|
112
113
|
})
|
|
113
114
|
], Address.prototype, "latitude", 2);
|
|
114
115
|
__decorateClass([
|
|
@@ -116,8 +117,9 @@ __decorateClass([
|
|
|
116
117
|
type: "decimal",
|
|
117
118
|
precision: 11,
|
|
118
119
|
scale: 8,
|
|
119
|
-
|
|
120
|
-
|
|
120
|
+
nullable: true,
|
|
121
|
+
transformer: NullableDecimalTransformer,
|
|
122
|
+
comment: "Coordenada geogr\xE1fica de longitude. Nulo quando o local n\xE3o tem localiza\xE7\xE3o conhecida."
|
|
121
123
|
})
|
|
122
124
|
], Address.prototype, "longitude", 2);
|
|
123
125
|
__decorateClass([
|