grm-shared-library 1.0.11 → 1.0.12
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/decorators/case-decorators.d.ts +3 -0
- package/dist/decorators/case-decorators.js +28 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/modules/organization/dtos/contact-person.dto.js +2 -2
- package/dist/modules/organization/interfaces/organization.d.ts +1 -1
- package/dist/modules/user/dtos/create-user.dto.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SentenceCase = SentenceCase;
|
|
4
|
+
exports.UpperCase = UpperCase;
|
|
5
|
+
exports.LowerCase = LowerCase;
|
|
6
|
+
const class_transformer_1 = require("class-transformer");
|
|
7
|
+
function SentenceCase() {
|
|
8
|
+
return (0, class_transformer_1.Transform)(({ value }) => {
|
|
9
|
+
if (typeof value !== 'string') {
|
|
10
|
+
return value;
|
|
11
|
+
}
|
|
12
|
+
return value
|
|
13
|
+
.split(' ')
|
|
14
|
+
.map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
|
|
15
|
+
.join(' ');
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function UpperCase() {
|
|
19
|
+
return (0, class_transformer_1.Transform)(({ value }) => {
|
|
20
|
+
if (typeof value !== 'string') {
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
return value.toUpperCase();
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function LowerCase() {
|
|
27
|
+
return (0, class_transformer_1.Transform)(({ value }) => typeof value === "string" ? value.toLowerCase() : value);
|
|
28
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -11,13 +11,13 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.ContactPersonDto = void 0;
|
|
13
13
|
const class_validator_1 = require("class-validator");
|
|
14
|
-
const
|
|
14
|
+
const case_decorators_1 = require("../../../decorators/case-decorators");
|
|
15
15
|
class ContactPersonDto {
|
|
16
16
|
}
|
|
17
17
|
exports.ContactPersonDto = ContactPersonDto;
|
|
18
18
|
__decorate([
|
|
19
19
|
(0, class_validator_1.IsString)(),
|
|
20
|
-
(0,
|
|
20
|
+
(0, case_decorators_1.SentenceCase)(),
|
|
21
21
|
(0, class_validator_1.IsNotEmpty)(),
|
|
22
22
|
__metadata("design:type", String)
|
|
23
23
|
], ContactPersonDto.prototype, "name", void 0);
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.CreateUserDto = void 0;
|
|
13
13
|
const class_validator_1 = require("class-validator");
|
|
14
14
|
const user_role_enum_1 = require("../enums/user-role.enum");
|
|
15
|
+
const case_decorators_1 = require("../../../decorators/case-decorators");
|
|
15
16
|
class CreateUserDto {
|
|
16
17
|
constructor() {
|
|
17
18
|
this.role = user_role_enum_1.UserRole.USER;
|
|
@@ -22,6 +23,7 @@ __decorate([
|
|
|
22
23
|
(0, class_validator_1.IsString)(),
|
|
23
24
|
(0, class_validator_1.IsNotEmpty)(),
|
|
24
25
|
(0, class_validator_1.MinLength)(2),
|
|
26
|
+
(0, case_decorators_1.SentenceCase)(),
|
|
25
27
|
__metadata("design:type", String)
|
|
26
28
|
], CreateUserDto.prototype, "name", void 0);
|
|
27
29
|
__decorate([
|