tychat-contracts 1.0.57 → 1.0.59
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 -2
- package/dist/users/update-self-user.dto.d.ts +1 -2
- package/dist/users/update-self-user.dto.d.ts.map +1 -1
- package/dist/users/update-self-user.dto.js +2 -14
- package/dist/users/update-user-by-admin.dto.d.ts.map +1 -1
- package/dist/users/update-user-by-admin.dto.js +1 -1
- package/dist/users/user-update-kafka-payloads.d.ts +3 -1
- package/dist/users/user-update-kafka-payloads.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/users/update-self-user.dto.ts +3 -13
- package/src/users/update-user-by-admin.dto.ts +2 -1
- package/src/users/user-update-kafka-payloads.ts +3 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ DTOs compartilhados com **class-validator** usados pela **tychat-api** e pelos m
|
|
|
5
5
|
## Estrutura
|
|
6
6
|
|
|
7
7
|
- **auth**: `LoginDto`, `RefreshTokenDto`, `RequestPasswordResetDto`, `ConfirmPasswordResetDto`, `AuthLoginResponseDto`, payloads Kafka (`LoginPayload`, `RequestPasswordResetPayload`, etc.)
|
|
8
|
-
- **users**: `CreateUserDto` (sem password para criação por admin), `UserListItemDto`, `UpdateSelfUserDto` (name
|
|
8
|
+
- **users**: `CreateUserDto` (sem password para criação por admin), `UserListItemDto`, `UpdateSelfUserDto` (apenas **name**), `UpdateUserByAdminDto` (name/email/role; regras de e-mail na API/auth-service), `UpdatedUserDto`, `ChangeForcePasswordDto`
|
|
9
9
|
- **professionals**: `ProfessionalProfileDto`, `UpdateProfessionalProfileDto`, `CreateProfessionalWithProfileDto`
|
|
10
10
|
- **notifications**: payloads Kafka para notificações de e-mail (`NotificationUserCreatedEventPayload`, `NotificationPasswordResetRequestedEventPayload`)
|
|
11
11
|
|
|
@@ -20,7 +20,7 @@ Nos projetos que consomem (tychat-api, tychat-tenant-service, etc.):
|
|
|
20
20
|
|
|
21
21
|
```json
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"tychat-contracts": "^1.0.
|
|
23
|
+
"tychat-contracts": "^1.0.58"
|
|
24
24
|
}
|
|
25
25
|
```
|
|
26
26
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/** Fields the authenticated user may change on their own profile (no role change). */
|
|
1
|
+
/** Fields the authenticated user may change on their own profile (no role change). Email is not editable here. */
|
|
2
2
|
export declare class UpdateSelfUserDto {
|
|
3
3
|
_atLeastOne?: string;
|
|
4
4
|
name?: string;
|
|
5
|
-
email?: string;
|
|
6
5
|
}
|
|
7
6
|
//# sourceMappingURL=update-self-user.dto.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-self-user.dto.d.ts","sourceRoot":"","sources":["../../src/users/update-self-user.dto.ts"],"names":[],"mappings":"AAIA,
|
|
1
|
+
{"version":3,"file":"update-self-user.dto.d.ts","sourceRoot":"","sources":["../../src/users/update-self-user.dto.ts"],"names":[],"mappings":"AAIA,kHAAkH;AAClH,qBAAa,iBAAiB;IAG5B,WAAW,CAAC,EAAE,MAAM,CAAC;IAWrB,IAAI,CAAC,EAAE,MAAM,CAAC;CAEf"}
|
|
@@ -13,16 +13,15 @@ exports.UpdateSelfUserDto = void 0;
|
|
|
13
13
|
const swagger_1 = require("@nestjs/swagger");
|
|
14
14
|
const class_validator_1 = require("class-validator");
|
|
15
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). */
|
|
16
|
+
/** Fields the authenticated user may change on their own profile (no role change). Email is not editable here. */
|
|
17
17
|
class UpdateSelfUserDto {
|
|
18
18
|
_atLeastOne;
|
|
19
19
|
name;
|
|
20
|
-
email;
|
|
21
20
|
}
|
|
22
21
|
exports.UpdateSelfUserDto = UpdateSelfUserDto;
|
|
23
22
|
__decorate([
|
|
24
23
|
(0, swagger_1.ApiHideProperty)(),
|
|
25
|
-
(0, at_least_one_of_decorator_1.AtLeastOneOf)(['name'
|
|
24
|
+
(0, at_least_one_of_decorator_1.AtLeastOneOf)(['name']),
|
|
26
25
|
__metadata("design:type", String)
|
|
27
26
|
], UpdateSelfUserDto.prototype, "_atLeastOne", void 0);
|
|
28
27
|
__decorate([
|
|
@@ -37,14 +36,3 @@ __decorate([
|
|
|
37
36
|
(0, class_validator_1.MaxLength)(255),
|
|
38
37
|
__metadata("design:type", String)
|
|
39
38
|
], UpdateSelfUserDto.prototype, "name", void 0);
|
|
40
|
-
__decorate([
|
|
41
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
42
|
-
description: 'E-mail (unique per tenant)',
|
|
43
|
-
example: 'maria@empresa.com',
|
|
44
|
-
maxLength: 255,
|
|
45
|
-
}),
|
|
46
|
-
(0, class_validator_1.IsOptional)(),
|
|
47
|
-
(0, class_validator_1.IsEmail)({}, { message: 'email must be a valid e-mail' }),
|
|
48
|
-
(0, class_validator_1.MaxLength)(255),
|
|
49
|
-
__metadata("design:type", String)
|
|
50
|
-
], UpdateSelfUserDto.prototype, "email", void 0);
|
|
@@ -1 +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;
|
|
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;IAWd,KAAK,CAAC,EAAE,MAAM,CAAC;IAYf,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB"}
|
|
@@ -45,7 +45,7 @@ __decorate([
|
|
|
45
45
|
], UpdateUserByAdminDto.prototype, "name", void 0);
|
|
46
46
|
__decorate([
|
|
47
47
|
(0, swagger_1.ApiPropertyOptional)({
|
|
48
|
-
description: 'E-mail (
|
|
48
|
+
description: 'E-mail (único por tenant). Só pode ser alterado para utilizadores que não sejam administradores; não é permitido alterar o próprio e-mail nem o de outros administradores.',
|
|
49
49
|
example: 'maria@empresa.com',
|
|
50
50
|
maxLength: 255,
|
|
51
51
|
}),
|
|
@@ -5,15 +5,17 @@ export interface AuthUpdateSelfPayload {
|
|
|
5
5
|
tenant?: string;
|
|
6
6
|
userId: string;
|
|
7
7
|
name?: string;
|
|
8
|
-
email?: string;
|
|
9
8
|
}
|
|
10
9
|
/**
|
|
11
10
|
* Kafka payload for auth.update_user_admin (tychat-api → tychat-auth-service).
|
|
12
11
|
* actorRole must be "administrator" or the handler rejects the request.
|
|
12
|
+
* actorUserId is the JWT subject of the caller (used to block self email changes).
|
|
13
13
|
*/
|
|
14
14
|
export interface AuthUpdateUserAdminPayload {
|
|
15
15
|
tenant?: string;
|
|
16
16
|
actorRole: string;
|
|
17
|
+
/** JWT `sub` of the administrator performing the update */
|
|
18
|
+
actorUserId: string;
|
|
17
19
|
targetUserId: string;
|
|
18
20
|
name?: string;
|
|
19
21
|
email?: string;
|
|
@@ -1 +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;
|
|
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;CACf;AAED;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,2DAA2D;IAC3D,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,eAAe,GAAG,WAAW,GAAG,qBAAqB,CAAC;CAC9D;AAED;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;CACtB"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ApiHideProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
-
import {
|
|
2
|
+
import { IsOptional, IsString, MaxLength, MinLength } from 'class-validator';
|
|
3
3
|
import { AtLeastOneOf } from './at-least-one-of.decorator';
|
|
4
4
|
|
|
5
|
-
/** Fields the authenticated user may change on their own profile (no role change). */
|
|
5
|
+
/** Fields the authenticated user may change on their own profile (no role change). Email is not editable here. */
|
|
6
6
|
export class UpdateSelfUserDto {
|
|
7
7
|
@ApiHideProperty()
|
|
8
|
-
@AtLeastOneOf(['name'
|
|
8
|
+
@AtLeastOneOf(['name'])
|
|
9
9
|
_atLeastOne?: string;
|
|
10
10
|
|
|
11
11
|
@ApiPropertyOptional({
|
|
@@ -19,14 +19,4 @@ export class UpdateSelfUserDto {
|
|
|
19
19
|
@MaxLength(255)
|
|
20
20
|
name?: string;
|
|
21
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
22
|
}
|
|
@@ -27,7 +27,8 @@ export class UpdateUserByAdminDto {
|
|
|
27
27
|
name?: string;
|
|
28
28
|
|
|
29
29
|
@ApiPropertyOptional({
|
|
30
|
-
description:
|
|
30
|
+
description:
|
|
31
|
+
'E-mail (único por tenant). Só pode ser alterado para utilizadores que não sejam administradores; não é permitido alterar o próprio e-mail nem o de outros administradores.',
|
|
31
32
|
example: 'maria@empresa.com',
|
|
32
33
|
maxLength: 255,
|
|
33
34
|
})
|
|
@@ -5,16 +5,18 @@ export interface AuthUpdateSelfPayload {
|
|
|
5
5
|
tenant?: string;
|
|
6
6
|
userId: string;
|
|
7
7
|
name?: string;
|
|
8
|
-
email?: string;
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Kafka payload for auth.update_user_admin (tychat-api → tychat-auth-service).
|
|
13
12
|
* actorRole must be "administrator" or the handler rejects the request.
|
|
13
|
+
* actorUserId is the JWT subject of the caller (used to block self email changes).
|
|
14
14
|
*/
|
|
15
15
|
export interface AuthUpdateUserAdminPayload {
|
|
16
16
|
tenant?: string;
|
|
17
17
|
actorRole: string;
|
|
18
|
+
/** JWT `sub` of the administrator performing the update */
|
|
19
|
+
actorUserId: string;
|
|
18
20
|
targetUserId: string;
|
|
19
21
|
name?: string;
|
|
20
22
|
email?: string;
|