rl-core-api 0.9.0 → 0.10.1

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.
@@ -2,7 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolveCatalogOrder = void 0;
4
4
  const resolveCatalogOrder = (sortBy, sortDir, catalog, alias, fallback) => {
5
- const chosen = catalog.find((field) => field.field === sortBy && field.sortable && !field.relation);
5
+ const chosen = catalog.find((field) => field.field === sortBy &&
6
+ field.sortable &&
7
+ (field.sortColumn || !field.relation));
6
8
  if (chosen?.sortColumn) {
7
9
  return { column: chosen.sortColumn, direction: sortDir ?? "DESC" };
8
10
  }
@@ -228,7 +228,7 @@ let UsersService = class UsersService {
228
228
  Object.assign(user, {
229
229
  name: dto.name ?? user.name,
230
230
  lastName: dto.lastName ?? user.lastName,
231
- phone: dto.phone ?? user.phone,
231
+ phone: dto.phone !== undefined ? dto.phone : user.phone,
232
232
  });
233
233
  await this.userRepo.save(user);
234
234
  return this.findById(userId);
@@ -1,5 +1,5 @@
1
1
  export declare class UpdateProfileCommand {
2
2
  name?: string;
3
3
  lastName?: string;
4
- phone?: string;
4
+ phone?: string | null;
5
5
  }
@@ -11,28 +11,33 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.UpdateProfileCommand = void 0;
13
13
  const swagger_1 = require("@nestjs/swagger");
14
+ const class_transformer_1 = require("class-transformer");
14
15
  const class_validator_1 = require("class-validator");
16
+ const emptyToNull = ({ value }) => typeof value === "string" && value.trim() === "" ? null : value;
15
17
  class UpdateProfileCommand {
16
18
  }
17
19
  exports.UpdateProfileCommand = UpdateProfileCommand;
18
20
  __decorate([
19
21
  (0, swagger_1.ApiProperty)({ required: false }),
20
22
  (0, class_validator_1.IsOptional)(),
21
- (0, class_validator_1.IsString)(),
22
- (0, class_validator_1.Length)(2, 100),
23
+ (0, class_validator_1.IsString)({ message: "Nome inválido" }),
24
+ (0, class_validator_1.Length)(2, 100, { message: "O nome precisa ter entre 2 e 100 caracteres" }),
23
25
  __metadata("design:type", String)
24
26
  ], UpdateProfileCommand.prototype, "name", void 0);
25
27
  __decorate([
26
28
  (0, swagger_1.ApiProperty)({ required: false }),
27
29
  (0, class_validator_1.IsOptional)(),
28
- (0, class_validator_1.IsString)(),
29
- (0, class_validator_1.Length)(2, 100),
30
+ (0, class_validator_1.IsString)({ message: "Sobrenome inválido" }),
31
+ (0, class_validator_1.Length)(2, 100, {
32
+ message: "O sobrenome precisa ter entre 2 e 100 caracteres",
33
+ }),
30
34
  __metadata("design:type", String)
31
35
  ], UpdateProfileCommand.prototype, "lastName", void 0);
32
36
  __decorate([
33
- (0, swagger_1.ApiProperty)({ required: false }),
37
+ (0, swagger_1.ApiProperty)({ required: false, nullable: true }),
34
38
  (0, class_validator_1.IsOptional)(),
35
- (0, class_validator_1.IsString)(),
36
- (0, class_validator_1.Length)(8, 20),
37
- __metadata("design:type", String)
39
+ (0, class_transformer_1.Transform)(emptyToNull),
40
+ (0, class_validator_1.IsString)({ message: "Telefone inválido" }),
41
+ (0, class_validator_1.Length)(8, 20, { message: "O telefone precisa ter entre 8 e 20 caracteres" }),
42
+ __metadata("design:type", Object)
38
43
  ], UpdateProfileCommand.prototype, "phone", void 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rl-core-api",
3
- "version": "0.9.0",
3
+ "version": "0.10.1",
4
4
  "description": "Core NestJS: autenticação com 2FA, RBAC, auditoria, notificações e listagens com filtro dinâmico",
5
5
  "author": "Rodrigo Liberti",
6
6
  "license": "MIT",