tychat-contracts 1.0.53 → 1.0.55

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.
Files changed (34) hide show
  1. package/README.md +5 -4
  2. package/dist/configurations/clinic-configuration-with-tenant.dto.d.ts +9 -0
  3. package/dist/configurations/clinic-configuration-with-tenant.dto.d.ts.map +1 -0
  4. package/dist/configurations/clinic-configuration-with-tenant.dto.js +29 -0
  5. package/dist/configurations/configuration-tenant-summary.dto.d.ts +16 -0
  6. package/dist/configurations/configuration-tenant-summary.dto.d.ts.map +1 -0
  7. package/dist/configurations/configuration-tenant-summary.dto.js +69 -0
  8. package/dist/configurations/index.d.ts +4 -0
  9. package/dist/configurations/index.d.ts.map +1 -1
  10. package/dist/configurations/index.js +4 -0
  11. package/dist/configurations/plan-summary.dto.d.ts +20 -0
  12. package/dist/configurations/plan-summary.dto.d.ts.map +1 -0
  13. package/dist/configurations/plan-summary.dto.js +89 -0
  14. package/dist/configurations/tenant-limits-summary.dto.d.ts +14 -0
  15. package/dist/configurations/tenant-limits-summary.dto.d.ts.map +1 -0
  16. package/dist/configurations/tenant-limits-summary.dto.js +59 -0
  17. package/dist/index.d.ts +1 -0
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +1 -0
  20. package/dist/tenants/index.d.ts +1 -0
  21. package/dist/tenants/index.d.ts.map +1 -1
  22. package/dist/tenants/index.js +16 -1
  23. package/dist/tenants/update-tenant-environment-url.dto.d.ts +8 -0
  24. package/dist/tenants/update-tenant-environment-url.dto.d.ts.map +1 -0
  25. package/dist/tenants/update-tenant-environment-url.dto.js +35 -0
  26. package/package.json +1 -1
  27. package/src/configurations/clinic-configuration-with-tenant.dto.ts +14 -0
  28. package/src/configurations/configuration-tenant-summary.dto.ts +40 -0
  29. package/src/configurations/index.ts +4 -0
  30. package/src/configurations/plan-summary.dto.ts +48 -0
  31. package/src/configurations/tenant-limits-summary.dto.ts +30 -0
  32. package/src/index.ts +1 -0
  33. package/src/tenants/index.ts +1 -1
  34. package/src/tenants/update-tenant-environment-url.dto.ts +21 -0
package/README.md CHANGED
@@ -7,6 +7,7 @@ DTOs compartilhados com **class-validator** usados pela **tychat-api** e pelos m
7
7
  - **auth**: `LoginDto`, `RefreshTokenDto`, `RequestPasswordResetDto`, `ConfirmPasswordResetDto`, `AuthLoginResponseDto`, payloads Kafka (`LoginPayload`, `RequestPasswordResetPayload`, etc.)
8
8
  - **users**: `CreateUserDto` (sem password para criação por admin), `UserListItemDto`, `UpdateSelfUserDto` (name/email), `UpdateUserByAdminDto` (name/email/role), `UpdatedUserDto`, `ChangeForcePasswordDto`
9
9
  - **professionals**: `ProfessionalProfileDto`, `UpdateProfessionalProfileDto`, `CreateProfessionalWithProfileDto`
10
+ - **notifications**: payloads Kafka para notificações de e-mail (`NotificationUserCreatedEventPayload`, `NotificationPasswordResetRequestedEventPayload`)
10
11
 
11
12
  ## Uso
12
13
 
@@ -15,18 +16,18 @@ DTOs compartilhados com **class-validator** usados pela **tychat-api** e pelos m
15
16
  npm run build
16
17
  ```
17
18
 
18
- Nos projetos que consomem (tychat-api, tychat-tenant-service):
19
+ Nos projetos que consomem (tychat-api, tychat-tenant-service, etc.):
19
20
 
20
21
  ```json
21
22
  "dependencies": {
22
- "tychat-contracts-dtos": "file:../tychat-contracts-dtos"
23
+ "tychat-contracts": "^1.0.53"
23
24
  }
24
25
  ```
25
26
 
26
27
  ```ts
27
- import { LoginDto } from 'tychat-contracts-dtos';
28
+ import { LoginDto } from 'tychat-contracts';
28
29
  ```
29
30
 
30
31
  ## Desenvolvimento
31
32
 
32
- Após alterar os DTOs, rode `npm run build` no pacote e reinstale (ou use `npm link`) nos projetos que o utilizam.
33
+ Após alterar os DTOs, rode `npm run build`, publique no registry e atualize os consumidores para a mesma versão.
@@ -0,0 +1,9 @@
1
+ import { ClinicConfigurationDto } from './clinic-configuration.dto';
2
+ import { ConfigurationTenantSummaryDto } from './configuration-tenant-summary.dto';
3
+ /**
4
+ * Clinic configuration (opening hours) plus tenant summary for the same tenant context.
5
+ */
6
+ export declare class ClinicConfigurationWithTenantDto extends ClinicConfigurationDto {
7
+ tenant: ConfigurationTenantSummaryDto;
8
+ }
9
+ //# sourceMappingURL=clinic-configuration-with-tenant.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clinic-configuration-with-tenant.dto.d.ts","sourceRoot":"","sources":["../../src/configurations/clinic-configuration-with-tenant.dto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AAEnF;;GAEG;AACH,qBAAa,gCAAiC,SAAQ,sBAAsB;IAK1E,MAAM,EAAE,6BAA6B,CAAC;CACvC"}
@@ -0,0 +1,29 @@
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.ClinicConfigurationWithTenantDto = void 0;
13
+ const swagger_1 = require("@nestjs/swagger");
14
+ const clinic_configuration_dto_1 = require("./clinic-configuration.dto");
15
+ const configuration_tenant_summary_dto_1 = require("./configuration-tenant-summary.dto");
16
+ /**
17
+ * Clinic configuration (opening hours) plus tenant summary for the same tenant context.
18
+ */
19
+ class ClinicConfigurationWithTenantDto extends clinic_configuration_dto_1.ClinicConfigurationDto {
20
+ tenant;
21
+ }
22
+ exports.ClinicConfigurationWithTenantDto = ClinicConfigurationWithTenantDto;
23
+ __decorate([
24
+ (0, swagger_1.ApiProperty)({
25
+ description: 'Tenant metadata (name, branding, plan, limits)',
26
+ type: () => configuration_tenant_summary_dto_1.ConfigurationTenantSummaryDto,
27
+ }),
28
+ __metadata("design:type", configuration_tenant_summary_dto_1.ConfigurationTenantSummaryDto)
29
+ ], ClinicConfigurationWithTenantDto.prototype, "tenant", void 0);
@@ -0,0 +1,16 @@
1
+ import { PlanSummaryDto } from './plan-summary.dto';
2
+ import { TenantLimitsSummaryDto } from './tenant-limits-summary.dto';
3
+ /**
4
+ * Tenant branding and subscription info returned with clinic configuration (no DB credentials).
5
+ */
6
+ export declare class ConfigurationTenantSummaryDto {
7
+ name: string;
8
+ cnpj: string;
9
+ location: string | null;
10
+ logoWhite: string | null;
11
+ logoDark: string | null;
12
+ status: 'active' | 'inactive';
13
+ plan: PlanSummaryDto | null;
14
+ limits: TenantLimitsSummaryDto | null;
15
+ }
16
+ //# sourceMappingURL=configuration-tenant-summary.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configuration-tenant-summary.dto.d.ts","sourceRoot":"","sources":["../../src/configurations/configuration-tenant-summary.dto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE;;GAEG;AACH,qBAAa,6BAA6B;IAExC,IAAI,EAAE,MAAM,CAAC;IAGb,IAAI,EAAE,MAAM,CAAC;IAGb,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAGxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAGzB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAGxB,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAC;IAO9B,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;IAO5B,MAAM,EAAE,sBAAsB,GAAG,IAAI,CAAC;CACvC"}
@@ -0,0 +1,69 @@
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.ConfigurationTenantSummaryDto = void 0;
13
+ const swagger_1 = require("@nestjs/swagger");
14
+ const plan_summary_dto_1 = require("./plan-summary.dto");
15
+ const tenant_limits_summary_dto_1 = require("./tenant-limits-summary.dto");
16
+ /**
17
+ * Tenant branding and subscription info returned with clinic configuration (no DB credentials).
18
+ */
19
+ class ConfigurationTenantSummaryDto {
20
+ name;
21
+ cnpj;
22
+ location;
23
+ logoWhite;
24
+ logoDark;
25
+ status;
26
+ plan;
27
+ limits;
28
+ }
29
+ exports.ConfigurationTenantSummaryDto = ConfigurationTenantSummaryDto;
30
+ __decorate([
31
+ (0, swagger_1.ApiProperty)({ description: 'Tenant display name', example: 'Clínica Demo' }),
32
+ __metadata("design:type", String)
33
+ ], ConfigurationTenantSummaryDto.prototype, "name", void 0);
34
+ __decorate([
35
+ (0, swagger_1.ApiProperty)({ description: 'CNPJ', example: '12345678000199' }),
36
+ __metadata("design:type", String)
37
+ ], ConfigurationTenantSummaryDto.prototype, "cnpj", void 0);
38
+ __decorate([
39
+ (0, swagger_1.ApiPropertyOptional)({ description: 'Location / address', nullable: true }),
40
+ __metadata("design:type", Object)
41
+ ], ConfigurationTenantSummaryDto.prototype, "location", void 0);
42
+ __decorate([
43
+ (0, swagger_1.ApiPropertyOptional)({ description: 'Logo URL (light background)', nullable: true }),
44
+ __metadata("design:type", Object)
45
+ ], ConfigurationTenantSummaryDto.prototype, "logoWhite", void 0);
46
+ __decorate([
47
+ (0, swagger_1.ApiPropertyOptional)({ description: 'Logo URL (dark background)', nullable: true }),
48
+ __metadata("design:type", Object)
49
+ ], ConfigurationTenantSummaryDto.prototype, "logoDark", void 0);
50
+ __decorate([
51
+ (0, swagger_1.ApiProperty)({ description: 'Tenant status', enum: ['active', 'inactive'] }),
52
+ __metadata("design:type", String)
53
+ ], ConfigurationTenantSummaryDto.prototype, "status", void 0);
54
+ __decorate([
55
+ (0, swagger_1.ApiPropertyOptional)({
56
+ description: 'Subscription plan',
57
+ type: () => plan_summary_dto_1.PlanSummaryDto,
58
+ nullable: true,
59
+ }),
60
+ __metadata("design:type", Object)
61
+ ], ConfigurationTenantSummaryDto.prototype, "plan", void 0);
62
+ __decorate([
63
+ (0, swagger_1.ApiPropertyOptional)({
64
+ description: 'Per-tenant limit overrides',
65
+ type: () => tenant_limits_summary_dto_1.TenantLimitsSummaryDto,
66
+ nullable: true,
67
+ }),
68
+ __metadata("design:type", Object)
69
+ ], ConfigurationTenantSummaryDto.prototype, "limits", void 0);
@@ -1,4 +1,8 @@
1
1
  export * from './opening-hours-slot.dto';
2
2
  export * from './update-clinic-configuration.dto';
3
3
  export * from './clinic-configuration.dto';
4
+ export * from './plan-summary.dto';
5
+ export * from './tenant-limits-summary.dto';
6
+ export * from './configuration-tenant-summary.dto';
7
+ export * from './clinic-configuration-with-tenant.dto';
4
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/configurations/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,mCAAmC,CAAC;AAClD,cAAc,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/configurations/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,mCAAmC,CAAC;AAClD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,wCAAwC,CAAC"}
@@ -17,3 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./opening-hours-slot.dto"), exports);
18
18
  __exportStar(require("./update-clinic-configuration.dto"), exports);
19
19
  __exportStar(require("./clinic-configuration.dto"), exports);
20
+ __exportStar(require("./plan-summary.dto"), exports);
21
+ __exportStar(require("./tenant-limits-summary.dto"), exports);
22
+ __exportStar(require("./configuration-tenant-summary.dto"), exports);
23
+ __exportStar(require("./clinic-configuration-with-tenant.dto"), exports);
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Plan fields exposed with clinic configuration (subset of core Plan entity).
3
+ */
4
+ export declare class PlanSummaryDto {
5
+ id: string;
6
+ name: string;
7
+ price: number;
8
+ recurrenceDays: number;
9
+ maxUnits: number;
10
+ status: 'active' | 'inactive';
11
+ maxWhatsappInstances: number;
12
+ maxPatients: number;
13
+ maxDoctors: number;
14
+ maxAttendants: number;
15
+ maxAdministrators: number;
16
+ maxProcedures: number;
17
+ createdAt?: Date;
18
+ updatedAt?: Date;
19
+ }
20
+ //# sourceMappingURL=plan-summary.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan-summary.dto.d.ts","sourceRoot":"","sources":["../../src/configurations/plan-summary.dto.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,qBAAa,cAAc;IAEzB,EAAE,EAAE,MAAM,CAAC;IAGX,IAAI,EAAE,MAAM,CAAC;IAGb,KAAK,EAAE,MAAM,CAAC;IAGd,cAAc,EAAE,MAAM,CAAC;IAGvB,QAAQ,EAAE,MAAM,CAAC;IAGjB,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAC;IAG9B,oBAAoB,EAAE,MAAM,CAAC;IAG7B,WAAW,EAAE,MAAM,CAAC;IAGpB,UAAU,EAAE,MAAM,CAAC;IAGnB,aAAa,EAAE,MAAM,CAAC;IAGtB,iBAAiB,EAAE,MAAM,CAAC;IAG1B,aAAa,EAAE,MAAM,CAAC;IAGtB,SAAS,CAAC,EAAE,IAAI,CAAC;IAGjB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB"}
@@ -0,0 +1,89 @@
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.PlanSummaryDto = void 0;
13
+ const swagger_1 = require("@nestjs/swagger");
14
+ /**
15
+ * Plan fields exposed with clinic configuration (subset of core Plan entity).
16
+ */
17
+ class PlanSummaryDto {
18
+ id;
19
+ name;
20
+ price;
21
+ recurrenceDays;
22
+ maxUnits;
23
+ status;
24
+ maxWhatsappInstances;
25
+ maxPatients;
26
+ maxDoctors;
27
+ maxAttendants;
28
+ maxAdministrators;
29
+ maxProcedures;
30
+ createdAt;
31
+ updatedAt;
32
+ }
33
+ exports.PlanSummaryDto = PlanSummaryDto;
34
+ __decorate([
35
+ (0, swagger_1.ApiProperty)({ description: 'Plan ID (UUID)', example: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890' }),
36
+ __metadata("design:type", String)
37
+ ], PlanSummaryDto.prototype, "id", void 0);
38
+ __decorate([
39
+ (0, swagger_1.ApiProperty)({ description: 'Plan display name', example: 'Professional' }),
40
+ __metadata("design:type", String)
41
+ ], PlanSummaryDto.prototype, "name", void 0);
42
+ __decorate([
43
+ (0, swagger_1.ApiProperty)({ description: 'Price', example: 99.9 }),
44
+ __metadata("design:type", Number)
45
+ ], PlanSummaryDto.prototype, "price", void 0);
46
+ __decorate([
47
+ (0, swagger_1.ApiProperty)({ description: 'Recurrence period in days', example: 30 }),
48
+ __metadata("design:type", Number)
49
+ ], PlanSummaryDto.prototype, "recurrenceDays", void 0);
50
+ __decorate([
51
+ (0, swagger_1.ApiProperty)({ description: 'Maximum units allowed by plan', example: 3 }),
52
+ __metadata("design:type", Number)
53
+ ], PlanSummaryDto.prototype, "maxUnits", void 0);
54
+ __decorate([
55
+ (0, swagger_1.ApiProperty)({ description: 'Plan status', enum: ['active', 'inactive'] }),
56
+ __metadata("design:type", String)
57
+ ], PlanSummaryDto.prototype, "status", void 0);
58
+ __decorate([
59
+ (0, swagger_1.ApiProperty)({ description: 'Max WhatsApp instances', example: 2 }),
60
+ __metadata("design:type", Number)
61
+ ], PlanSummaryDto.prototype, "maxWhatsappInstances", void 0);
62
+ __decorate([
63
+ (0, swagger_1.ApiProperty)({ description: 'Max patients', example: 5000 }),
64
+ __metadata("design:type", Number)
65
+ ], PlanSummaryDto.prototype, "maxPatients", void 0);
66
+ __decorate([
67
+ (0, swagger_1.ApiProperty)({ description: 'Max doctors', example: 20 }),
68
+ __metadata("design:type", Number)
69
+ ], PlanSummaryDto.prototype, "maxDoctors", void 0);
70
+ __decorate([
71
+ (0, swagger_1.ApiProperty)({ description: 'Max attendants', example: 10 }),
72
+ __metadata("design:type", Number)
73
+ ], PlanSummaryDto.prototype, "maxAttendants", void 0);
74
+ __decorate([
75
+ (0, swagger_1.ApiProperty)({ description: 'Max administrators', example: 5 }),
76
+ __metadata("design:type", Number)
77
+ ], PlanSummaryDto.prototype, "maxAdministrators", void 0);
78
+ __decorate([
79
+ (0, swagger_1.ApiProperty)({ description: 'Max procedures', example: 200 }),
80
+ __metadata("design:type", Number)
81
+ ], PlanSummaryDto.prototype, "maxProcedures", void 0);
82
+ __decorate([
83
+ (0, swagger_1.ApiPropertyOptional)(),
84
+ __metadata("design:type", Date)
85
+ ], PlanSummaryDto.prototype, "createdAt", void 0);
86
+ __decorate([
87
+ (0, swagger_1.ApiPropertyOptional)(),
88
+ __metadata("design:type", Date)
89
+ ], PlanSummaryDto.prototype, "updatedAt", void 0);
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Tenant-specific limit overrides (nullable fields fall back to plan defaults).
3
+ */
4
+ export declare class TenantLimitsSummaryDto {
5
+ tenantId?: string;
6
+ maxPatients: number | null;
7
+ maxDoctors: number | null;
8
+ maxAttendants: number | null;
9
+ maxAdministrators: number | null;
10
+ maxProcedures: number | null;
11
+ maxWhatsappInstances: number | null;
12
+ maxUnits: number | null;
13
+ }
14
+ //# sourceMappingURL=tenant-limits-summary.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tenant-limits-summary.dto.d.ts","sourceRoot":"","sources":["../../src/configurations/tenant-limits-summary.dto.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,qBAAa,sBAAsB;IAEjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAG3B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAG1B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAG7B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IAGjC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAG7B,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IAGpC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB"}
@@ -0,0 +1,59 @@
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.TenantLimitsSummaryDto = void 0;
13
+ const swagger_1 = require("@nestjs/swagger");
14
+ /**
15
+ * Tenant-specific limit overrides (nullable fields fall back to plan defaults).
16
+ */
17
+ class TenantLimitsSummaryDto {
18
+ tenantId;
19
+ maxPatients;
20
+ maxDoctors;
21
+ maxAttendants;
22
+ maxAdministrators;
23
+ maxProcedures;
24
+ maxWhatsappInstances;
25
+ maxUnits;
26
+ }
27
+ exports.TenantLimitsSummaryDto = TenantLimitsSummaryDto;
28
+ __decorate([
29
+ (0, swagger_1.ApiPropertyOptional)({ description: 'Tenant ID (UUID)' }),
30
+ __metadata("design:type", String)
31
+ ], TenantLimitsSummaryDto.prototype, "tenantId", void 0);
32
+ __decorate([
33
+ (0, swagger_1.ApiPropertyOptional)({ description: 'Override max patients' }),
34
+ __metadata("design:type", Object)
35
+ ], TenantLimitsSummaryDto.prototype, "maxPatients", void 0);
36
+ __decorate([
37
+ (0, swagger_1.ApiPropertyOptional)({ description: 'Override max doctors' }),
38
+ __metadata("design:type", Object)
39
+ ], TenantLimitsSummaryDto.prototype, "maxDoctors", void 0);
40
+ __decorate([
41
+ (0, swagger_1.ApiPropertyOptional)({ description: 'Override max attendants' }),
42
+ __metadata("design:type", Object)
43
+ ], TenantLimitsSummaryDto.prototype, "maxAttendants", void 0);
44
+ __decorate([
45
+ (0, swagger_1.ApiPropertyOptional)({ description: 'Override max administrators' }),
46
+ __metadata("design:type", Object)
47
+ ], TenantLimitsSummaryDto.prototype, "maxAdministrators", void 0);
48
+ __decorate([
49
+ (0, swagger_1.ApiPropertyOptional)({ description: 'Override max procedures' }),
50
+ __metadata("design:type", Object)
51
+ ], TenantLimitsSummaryDto.prototype, "maxProcedures", void 0);
52
+ __decorate([
53
+ (0, swagger_1.ApiPropertyOptional)({ description: 'Override max WhatsApp instances' }),
54
+ __metadata("design:type", Object)
55
+ ], TenantLimitsSummaryDto.prototype, "maxWhatsappInstances", void 0);
56
+ __decorate([
57
+ (0, swagger_1.ApiPropertyOptional)({ description: 'Override max units' }),
58
+ __metadata("design:type", Object)
59
+ ], TenantLimitsSummaryDto.prototype, "maxUnits", void 0);
package/dist/index.d.ts CHANGED
@@ -11,4 +11,5 @@ export * from './billing';
11
11
  export * from './ai';
12
12
  export * from './storage';
13
13
  export * from './notifications';
14
+ export * from './tenants';
14
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,MAAM,CAAC;AACrB,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,MAAM,CAAC;AACrB,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC"}
package/dist/index.js CHANGED
@@ -27,3 +27,4 @@ __exportStar(require("./billing"), exports);
27
27
  __exportStar(require("./ai"), exports);
28
28
  __exportStar(require("./storage"), exports);
29
29
  __exportStar(require("./notifications"), exports);
30
+ __exportStar(require("./tenants"), exports);
@@ -1 +1,2 @@
1
+ export * from './update-tenant-environment-url.dto';
1
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tenants/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tenants/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC"}
@@ -1,2 +1,17 @@
1
1
  "use strict";
2
- // DTOs de tenants foram movidos para o próprio microserviço tychat-tenant-service
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./update-tenant-environment-url.dto"), exports);
@@ -0,0 +1,8 @@
1
+ /**
2
+ * PATCH /tenants/:id/environment-urls/:service — set or reset custom hostname for Dokploy.
3
+ * Send `null` or empty string to revert to default (slug-based) host.
4
+ */
5
+ export declare class UpdateTenantEnvironmentUrlDto {
6
+ host?: string | null;
7
+ }
8
+ //# sourceMappingURL=update-tenant-environment-url.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-tenant-environment-url.dto.d.ts","sourceRoot":"","sources":["../../src/tenants/update-tenant-environment-url.dto.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,qBAAa,6BAA6B;IAYxC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB"}
@@ -0,0 +1,35 @@
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.UpdateTenantEnvironmentUrlDto = void 0;
13
+ const swagger_1 = require("@nestjs/swagger");
14
+ const class_validator_1 = require("class-validator");
15
+ /**
16
+ * PATCH /tenants/:id/environment-urls/:service — set or reset custom hostname for Dokploy.
17
+ * Send `null` or empty string to revert to default (slug-based) host.
18
+ */
19
+ class UpdateTenantEnvironmentUrlDto {
20
+ host;
21
+ }
22
+ exports.UpdateTenantEnvironmentUrlDto = UpdateTenantEnvironmentUrlDto;
23
+ __decorate([
24
+ (0, swagger_1.ApiPropertyOptional)({
25
+ description: 'Hostname or full URL (e.g. clinic.example.com or https://clinic.example.com). Omit or send null to reset to default slug-based domain.',
26
+ nullable: true,
27
+ example: 'acme.custom.com',
28
+ maxLength: 255,
29
+ }),
30
+ (0, class_validator_1.IsOptional)(),
31
+ (0, class_validator_1.ValidateIf)((_, v) => v !== null && v !== undefined),
32
+ (0, class_validator_1.IsString)(),
33
+ (0, class_validator_1.MaxLength)(255),
34
+ __metadata("design:type", Object)
35
+ ], UpdateTenantEnvironmentUrlDto.prototype, "host", void 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tychat-contracts",
3
- "version": "1.0.53",
3
+ "version": "1.0.55",
4
4
  "description": "DTOs compartilhados com class-validator (API e microserviços)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,14 @@
1
+ import { ApiProperty } from '@nestjs/swagger';
2
+ import { ClinicConfigurationDto } from './clinic-configuration.dto';
3
+ import { ConfigurationTenantSummaryDto } from './configuration-tenant-summary.dto';
4
+
5
+ /**
6
+ * Clinic configuration (opening hours) plus tenant summary for the same tenant context.
7
+ */
8
+ export class ClinicConfigurationWithTenantDto extends ClinicConfigurationDto {
9
+ @ApiProperty({
10
+ description: 'Tenant metadata (name, branding, plan, limits)',
11
+ type: () => ConfigurationTenantSummaryDto,
12
+ })
13
+ tenant: ConfigurationTenantSummaryDto;
14
+ }
@@ -0,0 +1,40 @@
1
+ import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
2
+ import { PlanSummaryDto } from './plan-summary.dto';
3
+ import { TenantLimitsSummaryDto } from './tenant-limits-summary.dto';
4
+
5
+ /**
6
+ * Tenant branding and subscription info returned with clinic configuration (no DB credentials).
7
+ */
8
+ export class ConfigurationTenantSummaryDto {
9
+ @ApiProperty({ description: 'Tenant display name', example: 'Clínica Demo' })
10
+ name: string;
11
+
12
+ @ApiProperty({ description: 'CNPJ', example: '12345678000199' })
13
+ cnpj: string;
14
+
15
+ @ApiPropertyOptional({ description: 'Location / address', nullable: true })
16
+ location: string | null;
17
+
18
+ @ApiPropertyOptional({ description: 'Logo URL (light background)', nullable: true })
19
+ logoWhite: string | null;
20
+
21
+ @ApiPropertyOptional({ description: 'Logo URL (dark background)', nullable: true })
22
+ logoDark: string | null;
23
+
24
+ @ApiProperty({ description: 'Tenant status', enum: ['active', 'inactive'] })
25
+ status: 'active' | 'inactive';
26
+
27
+ @ApiPropertyOptional({
28
+ description: 'Subscription plan',
29
+ type: () => PlanSummaryDto,
30
+ nullable: true,
31
+ })
32
+ plan: PlanSummaryDto | null;
33
+
34
+ @ApiPropertyOptional({
35
+ description: 'Per-tenant limit overrides',
36
+ type: () => TenantLimitsSummaryDto,
37
+ nullable: true,
38
+ })
39
+ limits: TenantLimitsSummaryDto | null;
40
+ }
@@ -1,3 +1,7 @@
1
1
  export * from './opening-hours-slot.dto';
2
2
  export * from './update-clinic-configuration.dto';
3
3
  export * from './clinic-configuration.dto';
4
+ export * from './plan-summary.dto';
5
+ export * from './tenant-limits-summary.dto';
6
+ export * from './configuration-tenant-summary.dto';
7
+ export * from './clinic-configuration-with-tenant.dto';
@@ -0,0 +1,48 @@
1
+ import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
2
+
3
+ /**
4
+ * Plan fields exposed with clinic configuration (subset of core Plan entity).
5
+ */
6
+ export class PlanSummaryDto {
7
+ @ApiProperty({ description: 'Plan ID (UUID)', example: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890' })
8
+ id: string;
9
+
10
+ @ApiProperty({ description: 'Plan display name', example: 'Professional' })
11
+ name: string;
12
+
13
+ @ApiProperty({ description: 'Price', example: 99.9 })
14
+ price: number;
15
+
16
+ @ApiProperty({ description: 'Recurrence period in days', example: 30 })
17
+ recurrenceDays: number;
18
+
19
+ @ApiProperty({ description: 'Maximum units allowed by plan', example: 3 })
20
+ maxUnits: number;
21
+
22
+ @ApiProperty({ description: 'Plan status', enum: ['active', 'inactive'] })
23
+ status: 'active' | 'inactive';
24
+
25
+ @ApiProperty({ description: 'Max WhatsApp instances', example: 2 })
26
+ maxWhatsappInstances: number;
27
+
28
+ @ApiProperty({ description: 'Max patients', example: 5000 })
29
+ maxPatients: number;
30
+
31
+ @ApiProperty({ description: 'Max doctors', example: 20 })
32
+ maxDoctors: number;
33
+
34
+ @ApiProperty({ description: 'Max attendants', example: 10 })
35
+ maxAttendants: number;
36
+
37
+ @ApiProperty({ description: 'Max administrators', example: 5 })
38
+ maxAdministrators: number;
39
+
40
+ @ApiProperty({ description: 'Max procedures', example: 200 })
41
+ maxProcedures: number;
42
+
43
+ @ApiPropertyOptional()
44
+ createdAt?: Date;
45
+
46
+ @ApiPropertyOptional()
47
+ updatedAt?: Date;
48
+ }
@@ -0,0 +1,30 @@
1
+ import { ApiPropertyOptional } from '@nestjs/swagger';
2
+
3
+ /**
4
+ * Tenant-specific limit overrides (nullable fields fall back to plan defaults).
5
+ */
6
+ export class TenantLimitsSummaryDto {
7
+ @ApiPropertyOptional({ description: 'Tenant ID (UUID)' })
8
+ tenantId?: string;
9
+
10
+ @ApiPropertyOptional({ description: 'Override max patients' })
11
+ maxPatients: number | null;
12
+
13
+ @ApiPropertyOptional({ description: 'Override max doctors' })
14
+ maxDoctors: number | null;
15
+
16
+ @ApiPropertyOptional({ description: 'Override max attendants' })
17
+ maxAttendants: number | null;
18
+
19
+ @ApiPropertyOptional({ description: 'Override max administrators' })
20
+ maxAdministrators: number | null;
21
+
22
+ @ApiPropertyOptional({ description: 'Override max procedures' })
23
+ maxProcedures: number | null;
24
+
25
+ @ApiPropertyOptional({ description: 'Override max WhatsApp instances' })
26
+ maxWhatsappInstances: number | null;
27
+
28
+ @ApiPropertyOptional({ description: 'Override max units' })
29
+ maxUnits: number | null;
30
+ }
package/src/index.ts CHANGED
@@ -11,3 +11,4 @@ export * from './billing';
11
11
  export * from './ai';
12
12
  export * from './storage';
13
13
  export * from './notifications';
14
+ export * from './tenants';
@@ -1 +1 @@
1
- // DTOs de tenants foram movidos para o próprio microserviço tychat-tenant-service
1
+ export * from './update-tenant-environment-url.dto';
@@ -0,0 +1,21 @@
1
+ import { ApiPropertyOptional } from '@nestjs/swagger';
2
+ import { IsOptional, IsString, MaxLength, ValidateIf } from 'class-validator';
3
+
4
+ /**
5
+ * PATCH /tenants/:id/environment-urls/:service — set or reset custom hostname for Dokploy.
6
+ * Send `null` or empty string to revert to default (slug-based) host.
7
+ */
8
+ export class UpdateTenantEnvironmentUrlDto {
9
+ @ApiPropertyOptional({
10
+ description:
11
+ 'Hostname or full URL (e.g. clinic.example.com or https://clinic.example.com). Omit or send null to reset to default slug-based domain.',
12
+ nullable: true,
13
+ example: 'acme.custom.com',
14
+ maxLength: 255,
15
+ })
16
+ @IsOptional()
17
+ @ValidateIf((_, v) => v !== null && v !== undefined)
18
+ @IsString()
19
+ @MaxLength(255)
20
+ host?: string | null;
21
+ }