tychat-contracts 1.0.47 → 1.0.49
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 +2 -1
- package/dist/auth/auth-kafka.payloads.d.ts +11 -2
- package/dist/auth/auth-kafka.payloads.d.ts.map +1 -1
- package/dist/auth/auth-kafka.payloads.js +48 -2
- package/dist/auth/auth-login-response.dto.d.ts +6 -0
- package/dist/auth/auth-login-response.dto.d.ts.map +1 -0
- package/dist/auth/auth-login-response.dto.js +34 -0
- package/dist/auth/confirm-password-reset.dto.d.ts +6 -0
- package/dist/auth/confirm-password-reset.dto.d.ts.map +1 -0
- package/dist/auth/confirm-password-reset.dto.js +52 -0
- package/dist/auth/index.d.ts +4 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +13 -1
- package/dist/auth/match-field.decorator.d.ts +3 -0
- package/dist/auth/match-field.decorator.d.ts.map +1 -0
- package/dist/auth/match-field.decorator.js +25 -0
- package/dist/auth/request-password-reset.dto.d.ts +4 -0
- package/dist/auth/request-password-reset.dto.d.ts.map +1 -0
- package/dist/auth/request-password-reset.dto.js +25 -0
- package/dist/users/at-least-one-of.decorator.d.ts +7 -0
- package/dist/users/at-least-one-of.decorator.d.ts.map +1 -0
- package/dist/users/at-least-one-of.decorator.js +37 -0
- package/dist/users/index.d.ts +4 -0
- package/dist/users/index.d.ts.map +1 -1
- package/dist/users/index.js +8 -1
- package/dist/users/update-self-user.dto.d.ts +8 -0
- package/dist/users/update-self-user.dto.d.ts.map +1 -0
- package/dist/users/update-self-user.dto.js +63 -0
- package/dist/users/update-user-by-admin.dto.d.ts +11 -0
- package/dist/users/update-user-by-admin.dto.d.ts.map +1 -0
- package/dist/users/update-user-by-admin.dto.js +82 -0
- package/dist/users/updated-user.dto.d.ts +10 -0
- package/dist/users/updated-user.dto.d.ts.map +1 -0
- package/dist/users/updated-user.dto.js +55 -0
- package/dist/users/user-update-kafka-payloads.d.ts +24 -0
- package/dist/users/user-update-kafka-payloads.d.ts.map +1 -0
- package/dist/users/user-update-kafka-payloads.js +2 -0
- package/package.json +1 -1
- package/src/auth/auth-kafka.payloads.ts +38 -4
- package/src/auth/auth-login-response.dto.ts +15 -0
- package/src/auth/confirm-password-reset.dto.ts +33 -0
- package/src/auth/index.ts +6 -1
- package/src/auth/match-field.decorator.ts +30 -0
- package/src/auth/request-password-reset.dto.ts +10 -0
- package/src/users/at-least-one-of.decorator.ts +40 -0
- package/src/users/index.ts +11 -0
- package/src/users/update-self-user.dto.ts +42 -0
- package/src/users/update-user-by-admin.dto.ts +61 -0
- package/src/users/updated-user.dto.ts +30 -0
- package/src/users/user-update-kafka-payloads.ts +24 -0
- package/tychat-contracts-1.0.48.tgz +0 -0
package/README.md
CHANGED
|
@@ -4,7 +4,8 @@ DTOs compartilhados com **class-validator** usados pela **tychat-api** e pelos m
|
|
|
4
4
|
|
|
5
5
|
## Estrutura
|
|
6
6
|
|
|
7
|
-
- **auth**: `LoginDto`
|
|
7
|
+
- **auth**: `LoginDto`, `RefreshTokenDto`, payloads Kafka (`LoginPayload`, etc.)
|
|
8
|
+
- **users**: `CreateUserDto`, `UserListItemDto`, `UpdateSelfUserDto`, `UpdateUserByAdminDto`, `UpdatedUserDto` (atualização de perfil e por administrador)
|
|
8
9
|
|
|
9
10
|
## Uso
|
|
10
11
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LoginDto } from
|
|
2
|
-
import { RefreshTokenDto } from
|
|
1
|
+
import { LoginDto } from './login.dto';
|
|
2
|
+
import { RefreshTokenDto } from './refresh-token.dto';
|
|
3
3
|
export declare class LoginPayload extends LoginDto {
|
|
4
4
|
tenant: string;
|
|
5
5
|
}
|
|
@@ -10,4 +10,13 @@ export declare class ValidatePayload {
|
|
|
10
10
|
export declare class RefreshPayload extends RefreshTokenDto {
|
|
11
11
|
tenant: string;
|
|
12
12
|
}
|
|
13
|
+
export declare class RequestPasswordResetPayload {
|
|
14
|
+
tenant: string;
|
|
15
|
+
email: string;
|
|
16
|
+
}
|
|
17
|
+
export declare class ConfirmPasswordResetPayload {
|
|
18
|
+
tenant: string;
|
|
19
|
+
verify_token: string;
|
|
20
|
+
password: string;
|
|
21
|
+
}
|
|
13
22
|
//# sourceMappingURL=auth-kafka.payloads.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-kafka.payloads.d.ts","sourceRoot":"","sources":["../../src/auth/auth-kafka.payloads.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth-kafka.payloads.d.ts","sourceRoot":"","sources":["../../src/auth/auth-kafka.payloads.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,qBAAa,YAAa,SAAQ,QAAQ;IAKxC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,eAAe;IAK1B,MAAM,EAAE,MAAM,CAAC;IAMf,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,cAAe,SAAQ,eAAe;IAKjD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,2BAA2B;IAKtC,MAAM,EAAE,MAAM,CAAC;IAMf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,2BAA2B;IAKtC,MAAM,EAAE,MAAM,CAAC;IAMf,YAAY,EAAE,MAAM,CAAC;IAMrB,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -9,10 +9,10 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.RefreshPayload = exports.ValidatePayload = exports.LoginPayload = void 0;
|
|
12
|
+
exports.ConfirmPasswordResetPayload = exports.RequestPasswordResetPayload = exports.RefreshPayload = exports.ValidatePayload = exports.LoginPayload = void 0;
|
|
13
13
|
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
-
const login_dto_1 = require("./login.dto");
|
|
15
14
|
const class_validator_1 = require("class-validator");
|
|
15
|
+
const login_dto_1 = require("./login.dto");
|
|
16
16
|
const refresh_token_dto_1 = require("./refresh-token.dto");
|
|
17
17
|
class LoginPayload extends login_dto_1.LoginDto {
|
|
18
18
|
tenant;
|
|
@@ -55,3 +55,49 @@ __decorate([
|
|
|
55
55
|
(0, class_validator_1.MaxLength)(255),
|
|
56
56
|
__metadata("design:type", String)
|
|
57
57
|
], RefreshPayload.prototype, "tenant", void 0);
|
|
58
|
+
class RequestPasswordResetPayload {
|
|
59
|
+
tenant;
|
|
60
|
+
email;
|
|
61
|
+
}
|
|
62
|
+
exports.RequestPasswordResetPayload = RequestPasswordResetPayload;
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, swagger_1.ApiProperty)({ description: 'ID do tenant', example: 'tenant1' }),
|
|
65
|
+
(0, class_validator_1.IsString)(),
|
|
66
|
+
(0, class_validator_1.MinLength)(1, { message: 'tenant não pode ser vazio' }),
|
|
67
|
+
(0, class_validator_1.MaxLength)(255),
|
|
68
|
+
__metadata("design:type", String)
|
|
69
|
+
], RequestPasswordResetPayload.prototype, "tenant", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, swagger_1.ApiProperty)({ description: 'E-mail do usuário', example: 'usuario@empresa.com' }),
|
|
72
|
+
(0, class_validator_1.IsString)(),
|
|
73
|
+
(0, class_validator_1.MinLength)(1, { message: 'email não pode ser vazio' }),
|
|
74
|
+
(0, class_validator_1.MaxLength)(255),
|
|
75
|
+
__metadata("design:type", String)
|
|
76
|
+
], RequestPasswordResetPayload.prototype, "email", void 0);
|
|
77
|
+
class ConfirmPasswordResetPayload {
|
|
78
|
+
tenant;
|
|
79
|
+
verify_token;
|
|
80
|
+
password;
|
|
81
|
+
}
|
|
82
|
+
exports.ConfirmPasswordResetPayload = ConfirmPasswordResetPayload;
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, swagger_1.ApiProperty)({ description: 'ID do tenant', example: 'tenant1' }),
|
|
85
|
+
(0, class_validator_1.IsString)(),
|
|
86
|
+
(0, class_validator_1.MinLength)(1, { message: 'tenant não pode ser vazio' }),
|
|
87
|
+
(0, class_validator_1.MaxLength)(255),
|
|
88
|
+
__metadata("design:type", String)
|
|
89
|
+
], ConfirmPasswordResetPayload.prototype, "tenant", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
(0, swagger_1.ApiProperty)({ description: 'Token de verificação para reset de senha', example: 'a3b5f3c1...' }),
|
|
92
|
+
(0, class_validator_1.IsString)(),
|
|
93
|
+
(0, class_validator_1.MinLength)(1, { message: 'verify_token não pode ser vazio' }),
|
|
94
|
+
(0, class_validator_1.MaxLength)(255),
|
|
95
|
+
__metadata("design:type", String)
|
|
96
|
+
], ConfirmPasswordResetPayload.prototype, "verify_token", void 0);
|
|
97
|
+
__decorate([
|
|
98
|
+
(0, swagger_1.ApiProperty)({ description: 'Nova senha do usuário', example: 'senha123' }),
|
|
99
|
+
(0, class_validator_1.IsString)(),
|
|
100
|
+
(0, class_validator_1.MinLength)(6, { message: 'password deve ter no mínimo 6 caracteres' }),
|
|
101
|
+
(0, class_validator_1.MaxLength)(255),
|
|
102
|
+
__metadata("design:type", String)
|
|
103
|
+
], ConfirmPasswordResetPayload.prototype, "password", void 0);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-login-response.dto.d.ts","sourceRoot":"","sources":["../../src/auth/auth-login-response.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,oBAAoB;IAE/B,YAAY,EAAE,MAAM,CAAC;IAGrB,aAAa,EAAE,MAAM,CAAC;IAMtB,qBAAqB,EAAE,OAAO,CAAC;CAChC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AuthLoginResponseDto = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
class AuthLoginResponseDto {
|
|
15
|
+
access_token;
|
|
16
|
+
refresh_token;
|
|
17
|
+
force_change_password;
|
|
18
|
+
}
|
|
19
|
+
exports.AuthLoginResponseDto = AuthLoginResponseDto;
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, swagger_1.ApiProperty)({ description: 'Token de acesso JWT' }),
|
|
22
|
+
__metadata("design:type", String)
|
|
23
|
+
], AuthLoginResponseDto.prototype, "access_token", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, swagger_1.ApiProperty)({ description: 'Token de refresh JWT' }),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], AuthLoginResponseDto.prototype, "refresh_token", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, swagger_1.ApiProperty)({
|
|
30
|
+
description: 'Indica se o usuário deve alterar a senha no primeiro acesso',
|
|
31
|
+
example: true,
|
|
32
|
+
}),
|
|
33
|
+
__metadata("design:type", Boolean)
|
|
34
|
+
], AuthLoginResponseDto.prototype, "force_change_password", void 0);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirm-password-reset.dto.d.ts","sourceRoot":"","sources":["../../src/auth/confirm-password-reset.dto.ts"],"names":[],"mappings":"AAIA,qBAAa,uBAAuB;IAQlC,YAAY,EAAE,MAAM,CAAC;IAMrB,QAAQ,EAAE,MAAM,CAAC;IAajB,qBAAqB,EAAE,MAAM,CAAC;CAC/B"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ConfirmPasswordResetDto = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
const match_field_decorator_1 = require("./match-field.decorator");
|
|
16
|
+
class ConfirmPasswordResetDto {
|
|
17
|
+
verify_token;
|
|
18
|
+
password;
|
|
19
|
+
password_confirmation;
|
|
20
|
+
}
|
|
21
|
+
exports.ConfirmPasswordResetDto = ConfirmPasswordResetDto;
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, swagger_1.ApiProperty)({
|
|
24
|
+
description: 'Token de verificação recebido para troca de senha',
|
|
25
|
+
example: 'a3b5f3c1ef65...',
|
|
26
|
+
}),
|
|
27
|
+
(0, class_validator_1.IsString)(),
|
|
28
|
+
(0, class_validator_1.MinLength)(1, { message: 'verify_token não pode ser vazio' }),
|
|
29
|
+
(0, class_validator_1.MaxLength)(255),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], ConfirmPasswordResetDto.prototype, "verify_token", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, swagger_1.ApiProperty)({ description: 'Nova senha', example: 'senha123', minLength: 6 }),
|
|
34
|
+
(0, class_validator_1.IsString)(),
|
|
35
|
+
(0, class_validator_1.MinLength)(6, { message: 'password deve ter no mínimo 6 caracteres' }),
|
|
36
|
+
(0, class_validator_1.MaxLength)(255),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], ConfirmPasswordResetDto.prototype, "password", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, swagger_1.ApiProperty)({
|
|
41
|
+
description: 'Confirmação da nova senha',
|
|
42
|
+
example: 'senha123',
|
|
43
|
+
minLength: 6,
|
|
44
|
+
}),
|
|
45
|
+
(0, class_validator_1.IsString)(),
|
|
46
|
+
(0, class_validator_1.MinLength)(6, { message: 'password_confirmation deve ter no mínimo 6 caracteres' }),
|
|
47
|
+
(0, class_validator_1.MaxLength)(255),
|
|
48
|
+
(0, match_field_decorator_1.MatchField)('password', {
|
|
49
|
+
message: 'password_confirmation deve ser igual a password',
|
|
50
|
+
}),
|
|
51
|
+
__metadata("design:type", String)
|
|
52
|
+
], ConfirmPasswordResetDto.prototype, "password_confirmation", void 0);
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export { LoginDto } from './login.dto';
|
|
2
|
-
export
|
|
2
|
+
export { LoginPayload, ValidatePayload, RefreshPayload, RequestPasswordResetPayload, ConfirmPasswordResetPayload, } from './auth-kafka.payloads';
|
|
3
3
|
export { RefreshTokenDto } from './refresh-token.dto';
|
|
4
|
+
export { RequestPasswordResetDto } from './request-password-reset.dto';
|
|
5
|
+
export { ConfirmPasswordResetDto } from './confirm-password-reset.dto';
|
|
6
|
+
export { AuthLoginResponseDto } from './auth-login-response.dto';
|
|
4
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/auth/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,cAAc,EACd,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC"}
|
package/dist/auth/index.js
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RefreshTokenDto = exports.LoginDto = void 0;
|
|
3
|
+
exports.AuthLoginResponseDto = exports.ConfirmPasswordResetDto = exports.RequestPasswordResetDto = exports.RefreshTokenDto = exports.ConfirmPasswordResetPayload = exports.RequestPasswordResetPayload = exports.RefreshPayload = exports.ValidatePayload = exports.LoginPayload = exports.LoginDto = void 0;
|
|
4
4
|
var login_dto_1 = require("./login.dto");
|
|
5
5
|
Object.defineProperty(exports, "LoginDto", { enumerable: true, get: function () { return login_dto_1.LoginDto; } });
|
|
6
|
+
var auth_kafka_payloads_1 = require("./auth-kafka.payloads");
|
|
7
|
+
Object.defineProperty(exports, "LoginPayload", { enumerable: true, get: function () { return auth_kafka_payloads_1.LoginPayload; } });
|
|
8
|
+
Object.defineProperty(exports, "ValidatePayload", { enumerable: true, get: function () { return auth_kafka_payloads_1.ValidatePayload; } });
|
|
9
|
+
Object.defineProperty(exports, "RefreshPayload", { enumerable: true, get: function () { return auth_kafka_payloads_1.RefreshPayload; } });
|
|
10
|
+
Object.defineProperty(exports, "RequestPasswordResetPayload", { enumerable: true, get: function () { return auth_kafka_payloads_1.RequestPasswordResetPayload; } });
|
|
11
|
+
Object.defineProperty(exports, "ConfirmPasswordResetPayload", { enumerable: true, get: function () { return auth_kafka_payloads_1.ConfirmPasswordResetPayload; } });
|
|
6
12
|
var refresh_token_dto_1 = require("./refresh-token.dto");
|
|
7
13
|
Object.defineProperty(exports, "RefreshTokenDto", { enumerable: true, get: function () { return refresh_token_dto_1.RefreshTokenDto; } });
|
|
14
|
+
var request_password_reset_dto_1 = require("./request-password-reset.dto");
|
|
15
|
+
Object.defineProperty(exports, "RequestPasswordResetDto", { enumerable: true, get: function () { return request_password_reset_dto_1.RequestPasswordResetDto; } });
|
|
16
|
+
var confirm_password_reset_dto_1 = require("./confirm-password-reset.dto");
|
|
17
|
+
Object.defineProperty(exports, "ConfirmPasswordResetDto", { enumerable: true, get: function () { return confirm_password_reset_dto_1.ConfirmPasswordResetDto; } });
|
|
18
|
+
var auth_login_response_dto_1 = require("./auth-login-response.dto");
|
|
19
|
+
Object.defineProperty(exports, "AuthLoginResponseDto", { enumerable: true, get: function () { return auth_login_response_dto_1.AuthLoginResponseDto; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"match-field.decorator.d.ts","sourceRoot":"","sources":["../../src/auth/match-field.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AAEzB,wBAAgB,UAAU,CACxB,WAAW,EAAE,MAAM,EACnB,iBAAiB,CAAC,EAAE,iBAAiB,IAEpB,QAAQ,MAAM,EAAE,cAAc,MAAM,UAmBtD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MatchField = MatchField;
|
|
4
|
+
const class_validator_1 = require("class-validator");
|
|
5
|
+
function MatchField(sourceField, validationOptions) {
|
|
6
|
+
return function (object, propertyName) {
|
|
7
|
+
(0, class_validator_1.registerDecorator)({
|
|
8
|
+
name: 'matchField',
|
|
9
|
+
target: object.constructor,
|
|
10
|
+
propertyName,
|
|
11
|
+
constraints: [sourceField],
|
|
12
|
+
options: validationOptions,
|
|
13
|
+
validator: {
|
|
14
|
+
validate(value, args) {
|
|
15
|
+
const [field] = args.constraints;
|
|
16
|
+
return value === args.object[field];
|
|
17
|
+
},
|
|
18
|
+
defaultMessage(args) {
|
|
19
|
+
const [field] = args.constraints;
|
|
20
|
+
return `${args.property} must match ${field}`;
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-password-reset.dto.d.ts","sourceRoot":"","sources":["../../src/auth/request-password-reset.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,uBAAuB;IAKlC,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.RequestPasswordResetDto = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
class RequestPasswordResetDto {
|
|
16
|
+
email;
|
|
17
|
+
}
|
|
18
|
+
exports.RequestPasswordResetDto = RequestPasswordResetDto;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, swagger_1.ApiProperty)({ description: 'E-mail do usuário', example: 'usuario@empresa.com' }),
|
|
21
|
+
(0, class_validator_1.IsEmail)({}, { message: 'email deve ser um e-mail válido' }),
|
|
22
|
+
(0, class_validator_1.IsString)(),
|
|
23
|
+
(0, class_validator_1.MinLength)(1, { message: 'email não pode ser vazio' }),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], RequestPasswordResetDto.prototype, "email", void 0);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ValidationOptions } from 'class-validator';
|
|
2
|
+
/**
|
|
3
|
+
* Ensures at least one of the listed properties is present and non-empty on the object.
|
|
4
|
+
* Apply to a dummy property (e.g. `_atLeastOne`) that is not sent by clients.
|
|
5
|
+
*/
|
|
6
|
+
export declare function AtLeastOneOf(propertyNames: string[], validationOptions?: ValidationOptions): (object: object, propertyName: string) => void;
|
|
7
|
+
//# sourceMappingURL=at-least-one-of.decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"at-least-one-of.decorator.d.ts","sourceRoot":"","sources":["../../src/users/at-least-one-of.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AAEzB;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,aAAa,EAAE,MAAM,EAAE,EACvB,iBAAiB,CAAC,EAAE,iBAAiB,IAEpB,QAAQ,MAAM,EAAE,cAAc,MAAM,UAyBtD"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AtLeastOneOf = AtLeastOneOf;
|
|
4
|
+
const class_validator_1 = require("class-validator");
|
|
5
|
+
/**
|
|
6
|
+
* Ensures at least one of the listed properties is present and non-empty on the object.
|
|
7
|
+
* Apply to a dummy property (e.g. `_atLeastOne`) that is not sent by clients.
|
|
8
|
+
*/
|
|
9
|
+
function AtLeastOneOf(propertyNames, validationOptions) {
|
|
10
|
+
return function (object, propertyName) {
|
|
11
|
+
(0, class_validator_1.registerDecorator)({
|
|
12
|
+
name: 'atLeastOneOf',
|
|
13
|
+
target: object.constructor,
|
|
14
|
+
propertyName,
|
|
15
|
+
constraints: [propertyNames],
|
|
16
|
+
options: validationOptions,
|
|
17
|
+
validator: {
|
|
18
|
+
validate(_value, args) {
|
|
19
|
+
const obj = args.object;
|
|
20
|
+
const props = args.constraints[0];
|
|
21
|
+
return props.some((prop) => {
|
|
22
|
+
const v = obj[prop];
|
|
23
|
+
if (v == null)
|
|
24
|
+
return false;
|
|
25
|
+
if (typeof v === 'string')
|
|
26
|
+
return v.trim().length > 0;
|
|
27
|
+
return true;
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
defaultMessage(args) {
|
|
31
|
+
const props = args.constraints[0];
|
|
32
|
+
return `Provide at least one of: ${props.join(', ')}`;
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
}
|
package/dist/users/index.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
export { CreateUserDto, CREATABLE_USER_ROLES, type CreatableUserRole, } from './create-user.dto';
|
|
2
2
|
export { UserListItemDto } from './user-list-item.dto';
|
|
3
|
+
export { UpdateSelfUserDto } from './update-self-user.dto';
|
|
4
|
+
export { UpdateUserByAdminDto, ALL_USER_ROLES, type AllUserRole, } from './update-user-by-admin.dto';
|
|
5
|
+
export { UpdatedUserDto } from './updated-user.dto';
|
|
6
|
+
export type { AuthUpdateSelfPayload, AuthUpdateUserAdminPayload, } from './user-update-kafka-payloads';
|
|
3
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/users/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,KAAK,iBAAiB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/users/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,KAAK,iBAAiB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,KAAK,WAAW,GACjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,YAAY,EACV,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,8BAA8B,CAAC"}
|
package/dist/users/index.js
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UserListItemDto = exports.CREATABLE_USER_ROLES = exports.CreateUserDto = void 0;
|
|
3
|
+
exports.UpdatedUserDto = exports.ALL_USER_ROLES = exports.UpdateUserByAdminDto = exports.UpdateSelfUserDto = exports.UserListItemDto = exports.CREATABLE_USER_ROLES = exports.CreateUserDto = void 0;
|
|
4
4
|
var create_user_dto_1 = require("./create-user.dto");
|
|
5
5
|
Object.defineProperty(exports, "CreateUserDto", { enumerable: true, get: function () { return create_user_dto_1.CreateUserDto; } });
|
|
6
6
|
Object.defineProperty(exports, "CREATABLE_USER_ROLES", { enumerable: true, get: function () { return create_user_dto_1.CREATABLE_USER_ROLES; } });
|
|
7
7
|
var user_list_item_dto_1 = require("./user-list-item.dto");
|
|
8
8
|
Object.defineProperty(exports, "UserListItemDto", { enumerable: true, get: function () { return user_list_item_dto_1.UserListItemDto; } });
|
|
9
|
+
var update_self_user_dto_1 = require("./update-self-user.dto");
|
|
10
|
+
Object.defineProperty(exports, "UpdateSelfUserDto", { enumerable: true, get: function () { return update_self_user_dto_1.UpdateSelfUserDto; } });
|
|
11
|
+
var update_user_by_admin_dto_1 = require("./update-user-by-admin.dto");
|
|
12
|
+
Object.defineProperty(exports, "UpdateUserByAdminDto", { enumerable: true, get: function () { return update_user_by_admin_dto_1.UpdateUserByAdminDto; } });
|
|
13
|
+
Object.defineProperty(exports, "ALL_USER_ROLES", { enumerable: true, get: function () { return update_user_by_admin_dto_1.ALL_USER_ROLES; } });
|
|
14
|
+
var updated_user_dto_1 = require("./updated-user.dto");
|
|
15
|
+
Object.defineProperty(exports, "UpdatedUserDto", { enumerable: true, get: function () { return updated_user_dto_1.UpdatedUserDto; } });
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Fields the authenticated user may change on their own profile (no role change). */
|
|
2
|
+
export declare class UpdateSelfUserDto {
|
|
3
|
+
_atLeastOne?: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
email?: string;
|
|
6
|
+
password?: string;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=update-self-user.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-self-user.dto.d.ts","sourceRoot":"","sources":["../../src/users/update-self-user.dto.ts"],"names":[],"mappings":"AAIA,sFAAsF;AACtF,qBAAa,iBAAiB;IAG5B,WAAW,CAAC,EAAE,MAAM,CAAC;IAWrB,IAAI,CAAC,EAAE,MAAM,CAAC;IAUd,KAAK,CAAC,EAAE,MAAM,CAAC;IAWf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.UpdateSelfUserDto = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
const at_least_one_of_decorator_1 = require("./at-least-one-of.decorator");
|
|
16
|
+
/** Fields the authenticated user may change on their own profile (no role change). */
|
|
17
|
+
class UpdateSelfUserDto {
|
|
18
|
+
_atLeastOne;
|
|
19
|
+
name;
|
|
20
|
+
email;
|
|
21
|
+
password;
|
|
22
|
+
}
|
|
23
|
+
exports.UpdateSelfUserDto = UpdateSelfUserDto;
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, swagger_1.ApiHideProperty)(),
|
|
26
|
+
(0, at_least_one_of_decorator_1.AtLeastOneOf)(['name', 'email', 'password']),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], UpdateSelfUserDto.prototype, "_atLeastOne", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
31
|
+
description: 'Full name',
|
|
32
|
+
example: 'Maria da Silva',
|
|
33
|
+
maxLength: 255,
|
|
34
|
+
}),
|
|
35
|
+
(0, class_validator_1.IsOptional)(),
|
|
36
|
+
(0, class_validator_1.IsString)(),
|
|
37
|
+
(0, class_validator_1.MinLength)(1, { message: 'name cannot be empty when provided' }),
|
|
38
|
+
(0, class_validator_1.MaxLength)(255),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], UpdateSelfUserDto.prototype, "name", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
43
|
+
description: 'E-mail (unique per tenant)',
|
|
44
|
+
example: 'maria@empresa.com',
|
|
45
|
+
maxLength: 255,
|
|
46
|
+
}),
|
|
47
|
+
(0, class_validator_1.IsOptional)(),
|
|
48
|
+
(0, class_validator_1.IsEmail)({}, { message: 'email must be a valid e-mail' }),
|
|
49
|
+
(0, class_validator_1.MaxLength)(255),
|
|
50
|
+
__metadata("design:type", String)
|
|
51
|
+
], UpdateSelfUserDto.prototype, "email", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
54
|
+
description: 'New password (bcrypt-hashed on the auth service)',
|
|
55
|
+
example: 'senha123',
|
|
56
|
+
minLength: 6,
|
|
57
|
+
}),
|
|
58
|
+
(0, class_validator_1.IsOptional)(),
|
|
59
|
+
(0, class_validator_1.IsString)(),
|
|
60
|
+
(0, class_validator_1.MinLength)(6, { message: 'password must be at least 6 characters' }),
|
|
61
|
+
(0, class_validator_1.MaxLength)(255),
|
|
62
|
+
__metadata("design:type", String)
|
|
63
|
+
], UpdateSelfUserDto.prototype, "password", void 0);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const ALL_USER_ROLES: readonly ["administrator", "attendant", "health_professional"];
|
|
2
|
+
export type AllUserRole = (typeof ALL_USER_ROLES)[number];
|
|
3
|
+
/** Fields an administrator may change for any user (including role). */
|
|
4
|
+
export declare class UpdateUserByAdminDto {
|
|
5
|
+
_atLeastOne?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
email?: string;
|
|
8
|
+
password?: string;
|
|
9
|
+
role?: AllUserRole;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=update-user-by-admin.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-user-by-admin.dto.d.ts","sourceRoot":"","sources":["../../src/users/update-user-by-admin.dto.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc,gEAIjB,CAAC;AACX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,wEAAwE;AACxE,qBAAa,oBAAoB;IAG/B,WAAW,CAAC,EAAE,MAAM,CAAC;IAWrB,IAAI,CAAC,EAAE,MAAM,CAAC;IAUd,KAAK,CAAC,EAAE,MAAM,CAAC;IAWf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAYlB,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.UpdateUserByAdminDto = exports.ALL_USER_ROLES = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
const at_least_one_of_decorator_1 = require("./at-least-one-of.decorator");
|
|
16
|
+
exports.ALL_USER_ROLES = [
|
|
17
|
+
'administrator',
|
|
18
|
+
'attendant',
|
|
19
|
+
'health_professional',
|
|
20
|
+
];
|
|
21
|
+
/** Fields an administrator may change for any user (including role). */
|
|
22
|
+
class UpdateUserByAdminDto {
|
|
23
|
+
_atLeastOne;
|
|
24
|
+
name;
|
|
25
|
+
email;
|
|
26
|
+
password;
|
|
27
|
+
role;
|
|
28
|
+
}
|
|
29
|
+
exports.UpdateUserByAdminDto = UpdateUserByAdminDto;
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, swagger_1.ApiHideProperty)(),
|
|
32
|
+
(0, at_least_one_of_decorator_1.AtLeastOneOf)(['name', 'email', 'password', 'role']),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], UpdateUserByAdminDto.prototype, "_atLeastOne", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
37
|
+
description: 'Full name',
|
|
38
|
+
example: 'Maria da Silva',
|
|
39
|
+
maxLength: 255,
|
|
40
|
+
}),
|
|
41
|
+
(0, class_validator_1.IsOptional)(),
|
|
42
|
+
(0, class_validator_1.IsString)(),
|
|
43
|
+
(0, class_validator_1.MinLength)(1, { message: 'name cannot be empty when provided' }),
|
|
44
|
+
(0, class_validator_1.MaxLength)(255),
|
|
45
|
+
__metadata("design:type", String)
|
|
46
|
+
], UpdateUserByAdminDto.prototype, "name", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
49
|
+
description: 'E-mail (unique per tenant)',
|
|
50
|
+
example: 'maria@empresa.com',
|
|
51
|
+
maxLength: 255,
|
|
52
|
+
}),
|
|
53
|
+
(0, class_validator_1.IsOptional)(),
|
|
54
|
+
(0, class_validator_1.IsEmail)({}, { message: 'email must be a valid e-mail' }),
|
|
55
|
+
(0, class_validator_1.MaxLength)(255),
|
|
56
|
+
__metadata("design:type", String)
|
|
57
|
+
], UpdateUserByAdminDto.prototype, "email", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
60
|
+
description: 'New password (bcrypt-hashed on the auth service)',
|
|
61
|
+
example: 'senha123',
|
|
62
|
+
minLength: 6,
|
|
63
|
+
}),
|
|
64
|
+
(0, class_validator_1.IsOptional)(),
|
|
65
|
+
(0, class_validator_1.IsString)(),
|
|
66
|
+
(0, class_validator_1.MinLength)(6, { message: 'password must be at least 6 characters' }),
|
|
67
|
+
(0, class_validator_1.MaxLength)(255),
|
|
68
|
+
__metadata("design:type", String)
|
|
69
|
+
], UpdateUserByAdminDto.prototype, "password", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
72
|
+
description: 'User role',
|
|
73
|
+
enum: exports.ALL_USER_ROLES,
|
|
74
|
+
example: 'attendant',
|
|
75
|
+
}),
|
|
76
|
+
(0, class_validator_1.IsOptional)(),
|
|
77
|
+
(0, class_validator_1.IsString)(),
|
|
78
|
+
(0, class_validator_1.IsIn)(exports.ALL_USER_ROLES, {
|
|
79
|
+
message: 'role must be administrator, attendant, or health_professional',
|
|
80
|
+
}),
|
|
81
|
+
__metadata("design:type", String)
|
|
82
|
+
], UpdateUserByAdminDto.prototype, "role", void 0);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** User payload returned after create or update (no password). */
|
|
2
|
+
export declare class UpdatedUserDto {
|
|
3
|
+
userId: string;
|
|
4
|
+
name: string;
|
|
5
|
+
email: string;
|
|
6
|
+
role: 'administrator' | 'attendant' | 'health_professional';
|
|
7
|
+
createdAt: Date;
|
|
8
|
+
updatedAt: Date;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=updated-user.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updated-user.dto.d.ts","sourceRoot":"","sources":["../../src/users/updated-user.dto.ts"],"names":[],"mappings":"AAEA,kEAAkE;AAClE,qBAAa,cAAc;IAMzB,MAAM,EAAE,MAAM,CAAC;IAGf,IAAI,EAAE,MAAM,CAAC;IAGb,KAAK,EAAE,MAAM,CAAC;IAOd,IAAI,EAAE,eAAe,GAAG,WAAW,GAAG,qBAAqB,CAAC;IAG5D,SAAS,EAAE,IAAI,CAAC;IAGhB,SAAS,EAAE,IAAI,CAAC;CACjB"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.UpdatedUserDto = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
/** User payload returned after create or update (no password). */
|
|
15
|
+
class UpdatedUserDto {
|
|
16
|
+
userId;
|
|
17
|
+
name;
|
|
18
|
+
email;
|
|
19
|
+
role;
|
|
20
|
+
createdAt;
|
|
21
|
+
updatedAt;
|
|
22
|
+
}
|
|
23
|
+
exports.UpdatedUserDto = UpdatedUserDto;
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, swagger_1.ApiProperty)({
|
|
26
|
+
format: 'uuid',
|
|
27
|
+
description: 'User identifier',
|
|
28
|
+
example: '550e8400-e29b-41d4-a716-446655440000',
|
|
29
|
+
}),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], UpdatedUserDto.prototype, "userId", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, swagger_1.ApiProperty)({ description: 'Full name', example: 'Maria da Silva' }),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], UpdatedUserDto.prototype, "name", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, swagger_1.ApiProperty)({ description: 'E-mail (unique per tenant)', example: 'maria@empresa.com' }),
|
|
38
|
+
__metadata("design:type", String)
|
|
39
|
+
], UpdatedUserDto.prototype, "email", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, swagger_1.ApiProperty)({
|
|
42
|
+
description: 'User role',
|
|
43
|
+
enum: ['administrator', 'attendant', 'health_professional'],
|
|
44
|
+
example: 'attendant',
|
|
45
|
+
}),
|
|
46
|
+
__metadata("design:type", String)
|
|
47
|
+
], UpdatedUserDto.prototype, "role", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, swagger_1.ApiProperty)({ description: 'Creation timestamp' }),
|
|
50
|
+
__metadata("design:type", Date)
|
|
51
|
+
], UpdatedUserDto.prototype, "createdAt", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, swagger_1.ApiProperty)({ description: 'Last update timestamp' }),
|
|
54
|
+
__metadata("design:type", Date)
|
|
55
|
+
], UpdatedUserDto.prototype, "updatedAt", void 0);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kafka payload for auth.update_self (tychat-api → tychat-auth-service).
|
|
3
|
+
*/
|
|
4
|
+
export interface AuthUpdateSelfPayload {
|
|
5
|
+
tenant?: string;
|
|
6
|
+
userId: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
email?: string;
|
|
9
|
+
password?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Kafka payload for auth.update_user_admin (tychat-api → tychat-auth-service).
|
|
13
|
+
* actorRole must be "administrator" or the handler rejects the request.
|
|
14
|
+
*/
|
|
15
|
+
export interface AuthUpdateUserAdminPayload {
|
|
16
|
+
tenant?: string;
|
|
17
|
+
actorRole: string;
|
|
18
|
+
targetUserId: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
email?: string;
|
|
21
|
+
password?: string;
|
|
22
|
+
role?: 'administrator' | 'attendant' | 'health_professional';
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=user-update-kafka-payloads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-update-kafka-payloads.d.ts","sourceRoot":"","sources":["../../src/users/user-update-kafka-payloads.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,eAAe,GAAG,WAAW,GAAG,qBAAqB,CAAC;CAC9D"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ApiProperty } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { RefreshTokenDto } from
|
|
1
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
+
import { IsString, MaxLength, MinLength } from 'class-validator';
|
|
3
|
+
import { LoginDto } from './login.dto';
|
|
4
|
+
import { RefreshTokenDto } from './refresh-token.dto';
|
|
5
5
|
|
|
6
6
|
export class LoginPayload extends LoginDto {
|
|
7
7
|
@ApiProperty({ description: 'ID do tenant', example: 'tenant1' })
|
|
@@ -31,4 +31,38 @@ export class RefreshPayload extends RefreshTokenDto {
|
|
|
31
31
|
@MinLength(1, { message: 'tenant não pode ser vazio' })
|
|
32
32
|
@MaxLength(255)
|
|
33
33
|
tenant: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export class RequestPasswordResetPayload {
|
|
37
|
+
@ApiProperty({ description: 'ID do tenant', example: 'tenant1' })
|
|
38
|
+
@IsString()
|
|
39
|
+
@MinLength(1, { message: 'tenant não pode ser vazio' })
|
|
40
|
+
@MaxLength(255)
|
|
41
|
+
tenant: string;
|
|
42
|
+
|
|
43
|
+
@ApiProperty({ description: 'E-mail do usuário', example: 'usuario@empresa.com' })
|
|
44
|
+
@IsString()
|
|
45
|
+
@MinLength(1, { message: 'email não pode ser vazio' })
|
|
46
|
+
@MaxLength(255)
|
|
47
|
+
email: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export class ConfirmPasswordResetPayload {
|
|
51
|
+
@ApiProperty({ description: 'ID do tenant', example: 'tenant1' })
|
|
52
|
+
@IsString()
|
|
53
|
+
@MinLength(1, { message: 'tenant não pode ser vazio' })
|
|
54
|
+
@MaxLength(255)
|
|
55
|
+
tenant: string;
|
|
56
|
+
|
|
57
|
+
@ApiProperty({ description: 'Token de verificação para reset de senha', example: 'a3b5f3c1...' })
|
|
58
|
+
@IsString()
|
|
59
|
+
@MinLength(1, { message: 'verify_token não pode ser vazio' })
|
|
60
|
+
@MaxLength(255)
|
|
61
|
+
verify_token: string;
|
|
62
|
+
|
|
63
|
+
@ApiProperty({ description: 'Nova senha do usuário', example: 'senha123' })
|
|
64
|
+
@IsString()
|
|
65
|
+
@MinLength(6, { message: 'password deve ter no mínimo 6 caracteres' })
|
|
66
|
+
@MaxLength(255)
|
|
67
|
+
password: string;
|
|
34
68
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
+
|
|
3
|
+
export class AuthLoginResponseDto {
|
|
4
|
+
@ApiProperty({ description: 'Token de acesso JWT' })
|
|
5
|
+
access_token: string;
|
|
6
|
+
|
|
7
|
+
@ApiProperty({ description: 'Token de refresh JWT' })
|
|
8
|
+
refresh_token: string;
|
|
9
|
+
|
|
10
|
+
@ApiProperty({
|
|
11
|
+
description: 'Indica se o usuário deve alterar a senha no primeiro acesso',
|
|
12
|
+
example: true,
|
|
13
|
+
})
|
|
14
|
+
force_change_password: boolean;
|
|
15
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
+
import { IsString, MaxLength, MinLength } from 'class-validator';
|
|
3
|
+
import { MatchField } from './match-field.decorator';
|
|
4
|
+
|
|
5
|
+
export class ConfirmPasswordResetDto {
|
|
6
|
+
@ApiProperty({
|
|
7
|
+
description: 'Token de verificação recebido para troca de senha',
|
|
8
|
+
example: 'a3b5f3c1ef65...',
|
|
9
|
+
})
|
|
10
|
+
@IsString()
|
|
11
|
+
@MinLength(1, { message: 'verify_token não pode ser vazio' })
|
|
12
|
+
@MaxLength(255)
|
|
13
|
+
verify_token: string;
|
|
14
|
+
|
|
15
|
+
@ApiProperty({ description: 'Nova senha', example: 'senha123', minLength: 6 })
|
|
16
|
+
@IsString()
|
|
17
|
+
@MinLength(6, { message: 'password deve ter no mínimo 6 caracteres' })
|
|
18
|
+
@MaxLength(255)
|
|
19
|
+
password: string;
|
|
20
|
+
|
|
21
|
+
@ApiProperty({
|
|
22
|
+
description: 'Confirmação da nova senha',
|
|
23
|
+
example: 'senha123',
|
|
24
|
+
minLength: 6,
|
|
25
|
+
})
|
|
26
|
+
@IsString()
|
|
27
|
+
@MinLength(6, { message: 'password_confirmation deve ter no mínimo 6 caracteres' })
|
|
28
|
+
@MaxLength(255)
|
|
29
|
+
@MatchField('password', {
|
|
30
|
+
message: 'password_confirmation deve ser igual a password',
|
|
31
|
+
})
|
|
32
|
+
password_confirmation: string;
|
|
33
|
+
}
|
package/src/auth/index.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
export { LoginDto } from './login.dto';
|
|
2
|
-
export
|
|
2
|
+
export {
|
|
3
3
|
LoginPayload,
|
|
4
4
|
ValidatePayload,
|
|
5
5
|
RefreshPayload,
|
|
6
|
+
RequestPasswordResetPayload,
|
|
7
|
+
ConfirmPasswordResetPayload,
|
|
6
8
|
} from './auth-kafka.payloads';
|
|
7
9
|
export { RefreshTokenDto } from './refresh-token.dto';
|
|
10
|
+
export { RequestPasswordResetDto } from './request-password-reset.dto';
|
|
11
|
+
export { ConfirmPasswordResetDto } from './confirm-password-reset.dto';
|
|
12
|
+
export { AuthLoginResponseDto } from './auth-login-response.dto';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
registerDecorator,
|
|
3
|
+
ValidationArguments,
|
|
4
|
+
ValidationOptions,
|
|
5
|
+
} from 'class-validator';
|
|
6
|
+
|
|
7
|
+
export function MatchField(
|
|
8
|
+
sourceField: string,
|
|
9
|
+
validationOptions?: ValidationOptions,
|
|
10
|
+
) {
|
|
11
|
+
return function (object: object, propertyName: string) {
|
|
12
|
+
registerDecorator({
|
|
13
|
+
name: 'matchField',
|
|
14
|
+
target: object.constructor,
|
|
15
|
+
propertyName,
|
|
16
|
+
constraints: [sourceField],
|
|
17
|
+
options: validationOptions,
|
|
18
|
+
validator: {
|
|
19
|
+
validate(value: unknown, args: ValidationArguments) {
|
|
20
|
+
const [field] = args.constraints as [string];
|
|
21
|
+
return value === (args.object as Record<string, unknown>)[field];
|
|
22
|
+
},
|
|
23
|
+
defaultMessage(args: ValidationArguments) {
|
|
24
|
+
const [field] = args.constraints as [string];
|
|
25
|
+
return `${args.property} must match ${field}`;
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
+
import { IsEmail, IsString, MinLength } from 'class-validator';
|
|
3
|
+
|
|
4
|
+
export class RequestPasswordResetDto {
|
|
5
|
+
@ApiProperty({ description: 'E-mail do usuário', example: 'usuario@empresa.com' })
|
|
6
|
+
@IsEmail({}, { message: 'email deve ser um e-mail válido' })
|
|
7
|
+
@IsString()
|
|
8
|
+
@MinLength(1, { message: 'email não pode ser vazio' })
|
|
9
|
+
email: string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {
|
|
2
|
+
registerDecorator,
|
|
3
|
+
ValidationArguments,
|
|
4
|
+
ValidationOptions,
|
|
5
|
+
} from 'class-validator';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Ensures at least one of the listed properties is present and non-empty on the object.
|
|
9
|
+
* Apply to a dummy property (e.g. `_atLeastOne`) that is not sent by clients.
|
|
10
|
+
*/
|
|
11
|
+
export function AtLeastOneOf(
|
|
12
|
+
propertyNames: string[],
|
|
13
|
+
validationOptions?: ValidationOptions,
|
|
14
|
+
) {
|
|
15
|
+
return function (object: object, propertyName: string) {
|
|
16
|
+
registerDecorator({
|
|
17
|
+
name: 'atLeastOneOf',
|
|
18
|
+
target: object.constructor,
|
|
19
|
+
propertyName,
|
|
20
|
+
constraints: [propertyNames],
|
|
21
|
+
options: validationOptions,
|
|
22
|
+
validator: {
|
|
23
|
+
validate(_value: unknown, args: ValidationArguments) {
|
|
24
|
+
const obj = args.object as Record<string, unknown>;
|
|
25
|
+
const props = args.constraints[0] as string[];
|
|
26
|
+
return props.some((prop) => {
|
|
27
|
+
const v = obj[prop];
|
|
28
|
+
if (v == null) return false;
|
|
29
|
+
if (typeof v === 'string') return v.trim().length > 0;
|
|
30
|
+
return true;
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
defaultMessage(args: ValidationArguments) {
|
|
34
|
+
const props = args.constraints[0] as string[];
|
|
35
|
+
return `Provide at least one of: ${props.join(', ')}`;
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
}
|
package/src/users/index.ts
CHANGED
|
@@ -4,3 +4,14 @@ export {
|
|
|
4
4
|
type CreatableUserRole,
|
|
5
5
|
} from './create-user.dto';
|
|
6
6
|
export { UserListItemDto } from './user-list-item.dto';
|
|
7
|
+
export { UpdateSelfUserDto } from './update-self-user.dto';
|
|
8
|
+
export {
|
|
9
|
+
UpdateUserByAdminDto,
|
|
10
|
+
ALL_USER_ROLES,
|
|
11
|
+
type AllUserRole,
|
|
12
|
+
} from './update-user-by-admin.dto';
|
|
13
|
+
export { UpdatedUserDto } from './updated-user.dto';
|
|
14
|
+
export type {
|
|
15
|
+
AuthUpdateSelfPayload,
|
|
16
|
+
AuthUpdateUserAdminPayload,
|
|
17
|
+
} from './user-update-kafka-payloads';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ApiHideProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
+
import { IsEmail, IsOptional, IsString, MaxLength, MinLength } from 'class-validator';
|
|
3
|
+
import { AtLeastOneOf } from './at-least-one-of.decorator';
|
|
4
|
+
|
|
5
|
+
/** Fields the authenticated user may change on their own profile (no role change). */
|
|
6
|
+
export class UpdateSelfUserDto {
|
|
7
|
+
@ApiHideProperty()
|
|
8
|
+
@AtLeastOneOf(['name', 'email', 'password'])
|
|
9
|
+
_atLeastOne?: string;
|
|
10
|
+
|
|
11
|
+
@ApiPropertyOptional({
|
|
12
|
+
description: 'Full name',
|
|
13
|
+
example: 'Maria da Silva',
|
|
14
|
+
maxLength: 255,
|
|
15
|
+
})
|
|
16
|
+
@IsOptional()
|
|
17
|
+
@IsString()
|
|
18
|
+
@MinLength(1, { message: 'name cannot be empty when provided' })
|
|
19
|
+
@MaxLength(255)
|
|
20
|
+
name?: string;
|
|
21
|
+
|
|
22
|
+
@ApiPropertyOptional({
|
|
23
|
+
description: 'E-mail (unique per tenant)',
|
|
24
|
+
example: 'maria@empresa.com',
|
|
25
|
+
maxLength: 255,
|
|
26
|
+
})
|
|
27
|
+
@IsOptional()
|
|
28
|
+
@IsEmail({}, { message: 'email must be a valid e-mail' })
|
|
29
|
+
@MaxLength(255)
|
|
30
|
+
email?: string;
|
|
31
|
+
|
|
32
|
+
@ApiPropertyOptional({
|
|
33
|
+
description: 'New password (bcrypt-hashed on the auth service)',
|
|
34
|
+
example: 'senha123',
|
|
35
|
+
minLength: 6,
|
|
36
|
+
})
|
|
37
|
+
@IsOptional()
|
|
38
|
+
@IsString()
|
|
39
|
+
@MinLength(6, { message: 'password must be at least 6 characters' })
|
|
40
|
+
@MaxLength(255)
|
|
41
|
+
password?: string;
|
|
42
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ApiHideProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
+
import { IsEmail, IsIn, IsOptional, IsString, MaxLength, MinLength } from 'class-validator';
|
|
3
|
+
import { AtLeastOneOf } from './at-least-one-of.decorator';
|
|
4
|
+
|
|
5
|
+
export const ALL_USER_ROLES = [
|
|
6
|
+
'administrator',
|
|
7
|
+
'attendant',
|
|
8
|
+
'health_professional',
|
|
9
|
+
] as const;
|
|
10
|
+
export type AllUserRole = (typeof ALL_USER_ROLES)[number];
|
|
11
|
+
|
|
12
|
+
/** Fields an administrator may change for any user (including role). */
|
|
13
|
+
export class UpdateUserByAdminDto {
|
|
14
|
+
@ApiHideProperty()
|
|
15
|
+
@AtLeastOneOf(['name', 'email', 'password', 'role'])
|
|
16
|
+
_atLeastOne?: string;
|
|
17
|
+
|
|
18
|
+
@ApiPropertyOptional({
|
|
19
|
+
description: 'Full name',
|
|
20
|
+
example: 'Maria da Silva',
|
|
21
|
+
maxLength: 255,
|
|
22
|
+
})
|
|
23
|
+
@IsOptional()
|
|
24
|
+
@IsString()
|
|
25
|
+
@MinLength(1, { message: 'name cannot be empty when provided' })
|
|
26
|
+
@MaxLength(255)
|
|
27
|
+
name?: string;
|
|
28
|
+
|
|
29
|
+
@ApiPropertyOptional({
|
|
30
|
+
description: 'E-mail (unique per tenant)',
|
|
31
|
+
example: 'maria@empresa.com',
|
|
32
|
+
maxLength: 255,
|
|
33
|
+
})
|
|
34
|
+
@IsOptional()
|
|
35
|
+
@IsEmail({}, { message: 'email must be a valid e-mail' })
|
|
36
|
+
@MaxLength(255)
|
|
37
|
+
email?: string;
|
|
38
|
+
|
|
39
|
+
@ApiPropertyOptional({
|
|
40
|
+
description: 'New password (bcrypt-hashed on the auth service)',
|
|
41
|
+
example: 'senha123',
|
|
42
|
+
minLength: 6,
|
|
43
|
+
})
|
|
44
|
+
@IsOptional()
|
|
45
|
+
@IsString()
|
|
46
|
+
@MinLength(6, { message: 'password must be at least 6 characters' })
|
|
47
|
+
@MaxLength(255)
|
|
48
|
+
password?: string;
|
|
49
|
+
|
|
50
|
+
@ApiPropertyOptional({
|
|
51
|
+
description: 'User role',
|
|
52
|
+
enum: ALL_USER_ROLES,
|
|
53
|
+
example: 'attendant',
|
|
54
|
+
})
|
|
55
|
+
@IsOptional()
|
|
56
|
+
@IsString()
|
|
57
|
+
@IsIn(ALL_USER_ROLES, {
|
|
58
|
+
message: 'role must be administrator, attendant, or health_professional',
|
|
59
|
+
})
|
|
60
|
+
role?: AllUserRole;
|
|
61
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
+
|
|
3
|
+
/** User payload returned after create or update (no password). */
|
|
4
|
+
export class UpdatedUserDto {
|
|
5
|
+
@ApiProperty({
|
|
6
|
+
format: 'uuid',
|
|
7
|
+
description: 'User identifier',
|
|
8
|
+
example: '550e8400-e29b-41d4-a716-446655440000',
|
|
9
|
+
})
|
|
10
|
+
userId: string;
|
|
11
|
+
|
|
12
|
+
@ApiProperty({ description: 'Full name', example: 'Maria da Silva' })
|
|
13
|
+
name: string;
|
|
14
|
+
|
|
15
|
+
@ApiProperty({ description: 'E-mail (unique per tenant)', example: 'maria@empresa.com' })
|
|
16
|
+
email: string;
|
|
17
|
+
|
|
18
|
+
@ApiProperty({
|
|
19
|
+
description: 'User role',
|
|
20
|
+
enum: ['administrator', 'attendant', 'health_professional'],
|
|
21
|
+
example: 'attendant',
|
|
22
|
+
})
|
|
23
|
+
role: 'administrator' | 'attendant' | 'health_professional';
|
|
24
|
+
|
|
25
|
+
@ApiProperty({ description: 'Creation timestamp' })
|
|
26
|
+
createdAt: Date;
|
|
27
|
+
|
|
28
|
+
@ApiProperty({ description: 'Last update timestamp' })
|
|
29
|
+
updatedAt: Date;
|
|
30
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kafka payload for auth.update_self (tychat-api → tychat-auth-service).
|
|
3
|
+
*/
|
|
4
|
+
export interface AuthUpdateSelfPayload {
|
|
5
|
+
tenant?: string;
|
|
6
|
+
userId: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
email?: string;
|
|
9
|
+
password?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Kafka payload for auth.update_user_admin (tychat-api → tychat-auth-service).
|
|
14
|
+
* actorRole must be "administrator" or the handler rejects the request.
|
|
15
|
+
*/
|
|
16
|
+
export interface AuthUpdateUserAdminPayload {
|
|
17
|
+
tenant?: string;
|
|
18
|
+
actorRole: string;
|
|
19
|
+
targetUserId: string;
|
|
20
|
+
name?: string;
|
|
21
|
+
email?: string;
|
|
22
|
+
password?: string;
|
|
23
|
+
role?: 'administrator' | 'attendant' | 'health_professional';
|
|
24
|
+
}
|
|
Binary file
|