tychat-contracts 1.3.21 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
+ export * from './legal-term-body-format';
1
2
  export * from './legal-term-template.dto';
2
3
  export * from './legal-term-preview.dto';
3
4
  export * from './legal-term-dispatch.dto';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/legal-terms/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/legal-terms/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC"}
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./legal-term-body-format"), exports);
17
18
  __exportStar(require("./legal-term-template.dto"), exports);
18
19
  __exportStar(require("./legal-term-preview.dto"), exports);
19
20
  __exportStar(require("./legal-term-dispatch.dto"), exports);
@@ -0,0 +1,4 @@
1
+ /** Formato de armazenamento do modelo; conversão para HTML/PDF é determinística por enum. */
2
+ export declare const LEGAL_TERM_BODY_FORMATS: readonly ["html", "markdown", "plain_text"];
3
+ export type LegalTermBodyFormat = (typeof LEGAL_TERM_BODY_FORMATS)[number];
4
+ //# sourceMappingURL=legal-term-body-format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legal-term-body-format.d.ts","sourceRoot":"","sources":["../../src/legal-terms/legal-term-body-format.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,eAAO,MAAM,uBAAuB,6CAA8C,CAAC;AAEnF,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LEGAL_TERM_BODY_FORMATS = void 0;
4
+ /** Formato de armazenamento do modelo; conversão para HTML/PDF é determinística por enum. */
5
+ exports.LEGAL_TERM_BODY_FORMATS = ['html', 'markdown', 'plain_text'];
@@ -1,6 +1,8 @@
1
+ import { type LegalTermBodyFormat } from './legal-term-body-format';
1
2
  /** Valores explícitos para substituição na pré-visualização (sem inferência heurística). */
2
3
  export declare class LegalTermPreviewRequestDto {
3
4
  body_html?: string;
5
+ body_format?: LegalTermBodyFormat;
4
6
  nome_paciente?: string;
5
7
  cpf_exemplo?: string;
6
8
  procedimento_nomes?: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"legal-term-preview.dto.d.ts","sourceRoot":"","sources":["../../src/legal-terms/legal-term-preview.dto.ts"],"names":[],"mappings":"AAcA,4FAA4F;AAC5F,qBAAa,0BAA0B;IAQrC,SAAS,CAAC,EAAE,MAAM,CAAC;IAMnB,aAAa,CAAC,EAAE,MAAM,CAAC;IAMvB,WAAW,CAAC,EAAE,MAAM,CAAC;IAMrB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAU9B,+BAA+B,CAAC,EAAE,MAAM,EAAE,CAAC;IAM3C,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,qBAAa,gBAAgB;IAI3B,YAAY,EAAE,MAAM,EAAE,CAAC;IASvB,eAAe,EAAE,MAAM,CAAC;IAMxB,WAAW,CAAC,EAAE,MAAM,CAAC;IASrB,WAAW,CAAC,EAAE,MAAM,CAAC;IAQrB,cAAc,CAAC,EAAE,OAAO,CAAC;IAMzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAK1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAO3B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAM9B,yBAAyB,CAAC,EAAE,MAAM,CAAC;CACpC"}
1
+ {"version":3,"file":"legal-term-preview.dto.d.ts","sourceRoot":"","sources":["../../src/legal-terms/legal-term-preview.dto.ts"],"names":[],"mappings":"AAcA,OAAO,EAA2B,KAAK,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE7F,4FAA4F;AAC5F,qBAAa,0BAA0B;IAQrC,SAAS,CAAC,EAAE,MAAM,CAAC;IAQnB,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAMlC,aAAa,CAAC,EAAE,MAAM,CAAC;IAMvB,WAAW,CAAC,EAAE,MAAM,CAAC;IAMrB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAU9B,+BAA+B,CAAC,EAAE,MAAM,EAAE,CAAC;IAM3C,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,qBAAa,gBAAgB;IAI3B,YAAY,EAAE,MAAM,EAAE,CAAC;IASvB,eAAe,EAAE,MAAM,CAAC;IAMxB,WAAW,CAAC,EAAE,MAAM,CAAC;IASrB,WAAW,CAAC,EAAE,MAAM,CAAC;IAQrB,cAAc,CAAC,EAAE,OAAO,CAAC;IAMzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAK1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAO3B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAM9B,yBAAyB,CAAC,EAAE,MAAM,CAAC;CACpC"}
@@ -12,9 +12,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.LegalTermSendDto = exports.LegalTermPreviewRequestDto = void 0;
13
13
  const swagger_1 = require("@nestjs/swagger");
14
14
  const class_validator_1 = require("class-validator");
15
+ const legal_term_body_format_1 = require("./legal-term-body-format");
15
16
  /** Valores explícitos para substituição na pré-visualização (sem inferência heurística). */
16
17
  class LegalTermPreviewRequestDto {
17
18
  body_html;
19
+ body_format;
18
20
  nome_paciente;
19
21
  cpf_exemplo;
20
22
  procedimento_nomes;
@@ -32,6 +34,15 @@ __decorate([
32
34
  (0, class_validator_1.MaxLength)(500_000),
33
35
  __metadata("design:type", String)
34
36
  ], LegalTermPreviewRequestDto.prototype, "body_html", void 0);
37
+ __decorate([
38
+ (0, swagger_1.ApiPropertyOptional)({
39
+ enum: legal_term_body_format_1.LEGAL_TERM_BODY_FORMATS,
40
+ description: 'Formato do rascunho body_html; se omitido, usa o modelo salvo ou html',
41
+ }),
42
+ (0, class_validator_1.IsOptional)(),
43
+ (0, class_validator_1.IsIn)(legal_term_body_format_1.LEGAL_TERM_BODY_FORMATS),
44
+ __metadata("design:type", String)
45
+ ], LegalTermPreviewRequestDto.prototype, "body_format", void 0);
35
46
  __decorate([
36
47
  (0, swagger_1.ApiPropertyOptional)({ description: 'Nome do paciente de exemplo' }),
37
48
  (0, class_validator_1.IsOptional)(),
@@ -1,3 +1,4 @@
1
+ import { type LegalTermBodyFormat } from './legal-term-body-format';
1
2
  /** Payload RPC: tychat-api → tychat-signature-service (criar envelope Clicksign v3). */
2
3
  export declare class CreateLegalSigningEnvelopeRpcDto {
3
4
  tenant: string;
@@ -7,6 +8,7 @@ export declare class CreateLegalSigningEnvelopeRpcDto {
7
8
  signerEmail: string;
8
9
  pdfBase64?: string;
9
10
  renderedHtml?: string;
11
+ bodyFormat?: LegalTermBodyFormat;
10
12
  documentFilename: string;
11
13
  envelopeName?: string;
12
14
  tenantAutoSign?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"legal-term-signature-rpc.dto.d.ts","sourceRoot":"","sources":["../../src/legal-terms/legal-term-signature-rpc.dto.ts"],"names":[],"mappings":"AAaA,wFAAwF;AACxF,qBAAa,gCAAgC;IAK3C,MAAM,EAAE,MAAM,CAAC;IAIf,SAAS,EAAE,MAAM,CAAC;IAKlB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAM7B,UAAU,EAAE,MAAM,CAAC;IAKnB,WAAW,EAAE,MAAM,CAAC;IAMpB,SAAS,CAAC,EAAE,MAAM,CAAC;IAQnB,YAAY,CAAC,EAAE,MAAM,CAAC;IAUtB,gBAAgB,EAAE,MAAM,CAAC;IAMzB,YAAY,CAAC,EAAE,MAAM,CAAC;IAQtB,cAAc,CAAC,EAAE,OAAO,CAAC;IAMzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAK1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAO3B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAM9B,yBAAyB,CAAC,EAAE,MAAM,CAAC;CACpC;AAED,qBAAa,sCAAsC;IAEjD,mBAAmB,EAAE,MAAM,CAAC;IAG5B,UAAU,EAAE,MAAM,CAAC;IAGnB,mBAAmB,EAAE,MAAM,CAAC;IAG5B,mBAAmB,EAAE,MAAM,CAAC;IAG5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,8EAA8E;AAC9E,MAAM,MAAM,+BAA+B,GAAG;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,gBAAgB,EACZ,SAAS,GACT,QAAQ,GACR,SAAS,GACT,WAAW,GACX,SAAS,CAAC;IACd,cAAc,EAAE,OAAO,CAAC;IACxB,2BAA2B;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC"}
1
+ {"version":3,"file":"legal-term-signature-rpc.dto.d.ts","sourceRoot":"","sources":["../../src/legal-terms/legal-term-signature-rpc.dto.ts"],"names":[],"mappings":"AAaA,OAAO,EAA2B,KAAK,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE7F,wFAAwF;AACxF,qBAAa,gCAAgC;IAK3C,MAAM,EAAE,MAAM,CAAC;IAIf,SAAS,EAAE,MAAM,CAAC;IAKlB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAM7B,UAAU,EAAE,MAAM,CAAC;IAKnB,WAAW,EAAE,MAAM,CAAC;IAMpB,SAAS,CAAC,EAAE,MAAM,CAAC;IASnB,YAAY,CAAC,EAAE,MAAM,CAAC;IAQtB,UAAU,CAAC,EAAE,mBAAmB,CAAC;IAUjC,gBAAgB,EAAE,MAAM,CAAC;IAMzB,YAAY,CAAC,EAAE,MAAM,CAAC;IAQtB,cAAc,CAAC,EAAE,OAAO,CAAC;IAMzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAK1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAO3B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAM9B,yBAAyB,CAAC,EAAE,MAAM,CAAC;CACpC;AAED,qBAAa,sCAAsC;IAEjD,mBAAmB,EAAE,MAAM,CAAC;IAG5B,UAAU,EAAE,MAAM,CAAC;IAGnB,mBAAmB,EAAE,MAAM,CAAC;IAG5B,mBAAmB,EAAE,MAAM,CAAC;IAG5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,8EAA8E;AAC9E,MAAM,MAAM,+BAA+B,GAAG;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,gBAAgB,EACZ,SAAS,GACT,QAAQ,GACR,SAAS,GACT,WAAW,GACX,SAAS,CAAC;IACd,cAAc,EAAE,OAAO,CAAC;IACxB,2BAA2B;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC"}
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.CreateLegalSigningEnvelopeRpcResultDto = exports.CreateLegalSigningEnvelopeRpcDto = void 0;
13
13
  const swagger_1 = require("@nestjs/swagger");
14
14
  const class_validator_1 = require("class-validator");
15
+ const legal_term_body_format_1 = require("./legal-term-body-format");
15
16
  /** Payload RPC: tychat-api → tychat-signature-service (criar envelope Clicksign v3). */
16
17
  class CreateLegalSigningEnvelopeRpcDto {
17
18
  tenant;
@@ -21,6 +22,7 @@ class CreateLegalSigningEnvelopeRpcDto {
21
22
  signerEmail;
22
23
  pdfBase64;
23
24
  renderedHtml;
25
+ bodyFormat;
24
26
  documentFilename;
25
27
  envelopeName;
26
28
  tenantAutoSign;
@@ -70,13 +72,22 @@ __decorate([
70
72
  ], CreateLegalSigningEnvelopeRpcDto.prototype, "pdfBase64", void 0);
71
73
  __decorate([
72
74
  (0, swagger_1.ApiPropertyOptional)({
73
- description: 'HTMLrenderizado do termo; convertido para PDF no signature-service se pdfBase64 ausente',
75
+ description: 'Conteúdocom placeholders substituídos; convertido para HTML→PDF no signature-service conforme bodyFormat',
74
76
  }),
75
77
  (0, class_validator_1.ValidateIf)((o) => !o.pdfBase64?.trim()),
76
78
  (0, class_validator_1.IsString)(),
77
79
  (0, class_validator_1.MinLength)(1),
78
80
  __metadata("design:type", String)
79
81
  ], CreateLegalSigningEnvelopeRpcDto.prototype, "renderedHtml", void 0);
82
+ __decorate([
83
+ (0, swagger_1.ApiPropertyOptional)({
84
+ enum: legal_term_body_format_1.LEGAL_TERM_BODY_FORMATS,
85
+ description: 'Interpretação de renderedHtml antes do PDF; padrão html',
86
+ }),
87
+ (0, class_validator_1.IsOptional)(),
88
+ (0, class_validator_1.IsIn)(legal_term_body_format_1.LEGAL_TERM_BODY_FORMATS),
89
+ __metadata("design:type", String)
90
+ ], CreateLegalSigningEnvelopeRpcDto.prototype, "bodyFormat", void 0);
80
91
  __decorate([
81
92
  (0, swagger_1.ApiProperty)({
82
93
  example: 'termo-juridico.pdf',
@@ -1,12 +1,15 @@
1
+ import { type LegalTermBodyFormat } from './legal-term-body-format';
1
2
  export declare class LegalTermTemplateDto {
2
3
  id: string;
3
4
  body_html: string;
5
+ body_format: LegalTermBodyFormat;
4
6
  mandatory_procedure_ids: string[];
5
7
  createdAt: Date;
6
8
  updatedAt: Date;
7
9
  }
8
10
  export declare class UpsertLegalTermTemplateDto {
9
11
  body_html: string;
12
+ body_format?: LegalTermBodyFormat;
10
13
  mandatory_procedure_ids?: string[];
11
14
  }
12
15
  //# sourceMappingURL=legal-term-template.dto.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"legal-term-template.dto.d.ts","sourceRoot":"","sources":["../../src/legal-terms/legal-term-template.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,oBAAoB;IAE/B,EAAE,EAAE,MAAM,CAAC;IAGX,SAAS,EAAE,MAAM,CAAC;IAOlB,uBAAuB,EAAE,MAAM,EAAE,CAAC;IAGlC,SAAS,EAAE,IAAI,CAAC;IAGhB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,qBAAa,0BAA0B;IAKrC,SAAS,EAAE,MAAM,CAAC;IAWlB,uBAAuB,CAAC,EAAE,MAAM,EAAE,CAAC;CACpC"}
1
+ {"version":3,"file":"legal-term-template.dto.d.ts","sourceRoot":"","sources":["../../src/legal-terms/legal-term-template.dto.ts"],"names":[],"mappings":"AAUA,OAAO,EAA2B,KAAK,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE7F,qBAAa,oBAAoB;IAE/B,EAAE,EAAE,MAAM,CAAC;IAKX,SAAS,EAAE,MAAM,CAAC;IAMlB,WAAW,EAAE,mBAAmB,CAAC;IAOjC,uBAAuB,EAAE,MAAM,EAAE,CAAC;IAGlC,SAAS,EAAE,IAAI,CAAC;IAGhB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,qBAAa,0BAA0B;IASrC,SAAS,EAAE,MAAM,CAAC;IAQlB,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAWlC,uBAAuB,CAAC,EAAE,MAAM,EAAE,CAAC;CACpC"}
@@ -12,9 +12,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.UpsertLegalTermTemplateDto = exports.LegalTermTemplateDto = void 0;
13
13
  const swagger_1 = require("@nestjs/swagger");
14
14
  const class_validator_1 = require("class-validator");
15
+ const legal_term_body_format_1 = require("./legal-term-body-format");
15
16
  class LegalTermTemplateDto {
16
17
  id;
17
18
  body_html;
19
+ body_format;
18
20
  mandatory_procedure_ids;
19
21
  createdAt;
20
22
  updatedAt;
@@ -25,9 +27,18 @@ __decorate([
25
27
  __metadata("design:type", String)
26
28
  ], LegalTermTemplateDto.prototype, "id", void 0);
27
29
  __decorate([
28
- (0, swagger_1.ApiProperty)({ description: 'HTML do termo (editor rico)' }),
30
+ (0, swagger_1.ApiProperty)({
31
+ description: 'Conteúdo do modelo (HTML, Markdown ou texto conforme body_format)',
32
+ }),
29
33
  __metadata("design:type", String)
30
34
  ], LegalTermTemplateDto.prototype, "body_html", void 0);
35
+ __decorate([
36
+ (0, swagger_1.ApiProperty)({
37
+ enum: legal_term_body_format_1.LEGAL_TERM_BODY_FORMATS,
38
+ description: 'Como interpretar body_html antes de gerar PDF (Clicksign)',
39
+ }),
40
+ __metadata("design:type", String)
41
+ ], LegalTermTemplateDto.prototype, "body_format", void 0);
31
42
  __decorate([
32
43
  (0, swagger_1.ApiProperty)({
33
44
  type: [String],
@@ -46,16 +57,30 @@ __decorate([
46
57
  ], LegalTermTemplateDto.prototype, "updatedAt", void 0);
47
58
  class UpsertLegalTermTemplateDto {
48
59
  body_html;
60
+ body_format;
49
61
  mandatory_procedure_ids;
50
62
  }
51
63
  exports.UpsertLegalTermTemplateDto = UpsertLegalTermTemplateDto;
52
64
  __decorate([
53
- (0, swagger_1.ApiProperty)({ description: 'HTML do termo (editor rico)', minLength: 1, maxLength: 500_000 }),
65
+ (0, swagger_1.ApiProperty)({
66
+ description: 'Corpo do termo (HTML, Markdown ou texto puro conforme body_format)',
67
+ minLength: 1,
68
+ maxLength: 500_000,
69
+ }),
54
70
  (0, class_validator_1.IsString)(),
55
71
  (0, class_validator_1.MinLength)(1),
56
72
  (0, class_validator_1.MaxLength)(500_000),
57
73
  __metadata("design:type", String)
58
74
  ], UpsertLegalTermTemplateDto.prototype, "body_html", void 0);
75
+ __decorate([
76
+ (0, swagger_1.ApiPropertyOptional)({
77
+ enum: legal_term_body_format_1.LEGAL_TERM_BODY_FORMATS,
78
+ description: 'Padrão: html',
79
+ }),
80
+ (0, class_validator_1.IsOptional)(),
81
+ (0, class_validator_1.IsIn)(legal_term_body_format_1.LEGAL_TERM_BODY_FORMATS),
82
+ __metadata("design:type", String)
83
+ ], UpsertLegalTermTemplateDto.prototype, "body_format", void 0);
59
84
  __decorate([
60
85
  (0, swagger_1.ApiPropertyOptional)({
61
86
  type: [String],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tychat-contracts",
3
- "version": "1.3.21",
3
+ "version": "1.4.1",
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",
@@ -1,3 +1,4 @@
1
+ export * from './legal-term-body-format';
1
2
  export * from './legal-term-template.dto';
2
3
  export * from './legal-term-preview.dto';
3
4
  export * from './legal-term-dispatch.dto';
@@ -0,0 +1,4 @@
1
+ /** Formato de armazenamento do modelo; conversão para HTML/PDF é determinística por enum. */
2
+ export const LEGAL_TERM_BODY_FORMATS = ['html', 'markdown', 'plain_text'] as const;
3
+
4
+ export type LegalTermBodyFormat = (typeof LEGAL_TERM_BODY_FORMATS)[number];
@@ -3,6 +3,7 @@ import {
3
3
  IsArray,
4
4
  IsBoolean,
5
5
  IsEmail,
6
+ IsIn,
6
7
  IsOptional,
7
8
  IsString,
8
9
  IsUUID,
@@ -11,6 +12,7 @@ import {
11
12
  MinLength,
12
13
  ValidateIf,
13
14
  } from 'class-validator';
15
+ import { LEGAL_TERM_BODY_FORMATS, type LegalTermBodyFormat } from './legal-term-body-format';
14
16
 
15
17
  /** Valores explícitos para substituição na pré-visualização (sem inferência heurística). */
16
18
  export class LegalTermPreviewRequestDto {
@@ -23,6 +25,14 @@ export class LegalTermPreviewRequestDto {
23
25
  @MaxLength(500_000)
24
26
  body_html?: string;
25
27
 
28
+ @ApiPropertyOptional({
29
+ enum: LEGAL_TERM_BODY_FORMATS,
30
+ description: 'Formato do rascunho body_html; se omitido, usa o modelo salvo ou html',
31
+ })
32
+ @IsOptional()
33
+ @IsIn(LEGAL_TERM_BODY_FORMATS)
34
+ body_format?: LegalTermBodyFormat;
35
+
26
36
  @ApiPropertyOptional({ description: 'Nome do paciente de exemplo' })
27
37
  @IsOptional()
28
38
  @IsString()
@@ -2,6 +2,7 @@ import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
2
2
  import {
3
3
  IsBoolean,
4
4
  IsEmail,
5
+ IsIn,
5
6
  IsOptional,
6
7
  IsString,
7
8
  IsUUID,
@@ -10,6 +11,7 @@ import {
10
11
  MinLength,
11
12
  ValidateIf,
12
13
  } from 'class-validator';
14
+ import { LEGAL_TERM_BODY_FORMATS, type LegalTermBodyFormat } from './legal-term-body-format';
13
15
 
14
16
  /** Payload RPC: tychat-api → tychat-signature-service (criar envelope Clicksign v3). */
15
17
  export class CreateLegalSigningEnvelopeRpcDto {
@@ -46,13 +48,22 @@ export class CreateLegalSigningEnvelopeRpcDto {
46
48
  pdfBase64?: string;
47
49
 
48
50
  @ApiPropertyOptional({
49
- description: 'HTML já renderizado do termo; convertido para PDF no signature-service se pdfBase64 ausente',
51
+ description:
52
+ 'Conteúdo já com placeholders substituídos; convertido para HTML→PDF no signature-service conforme bodyFormat',
50
53
  })
51
54
  @ValidateIf((o: CreateLegalSigningEnvelopeRpcDto) => !o.pdfBase64?.trim())
52
55
  @IsString()
53
56
  @MinLength(1)
54
57
  renderedHtml?: string;
55
58
 
59
+ @ApiPropertyOptional({
60
+ enum: LEGAL_TERM_BODY_FORMATS,
61
+ description: 'Interpretação de renderedHtml antes do PDF; padrão html',
62
+ })
63
+ @IsOptional()
64
+ @IsIn(LEGAL_TERM_BODY_FORMATS)
65
+ bodyFormat?: LegalTermBodyFormat;
66
+
56
67
  @ApiProperty({
57
68
  example: 'termo-juridico.pdf',
58
69
  description:
@@ -1,13 +1,30 @@
1
1
  import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
2
- import { IsArray, IsOptional, IsString, IsUUID, MaxLength, MinLength } from 'class-validator';
2
+ import {
3
+ IsArray,
4
+ IsIn,
5
+ IsOptional,
6
+ IsString,
7
+ IsUUID,
8
+ MaxLength,
9
+ MinLength,
10
+ } from 'class-validator';
11
+ import { LEGAL_TERM_BODY_FORMATS, type LegalTermBodyFormat } from './legal-term-body-format';
3
12
 
4
13
  export class LegalTermTemplateDto {
5
14
  @ApiProperty({ format: 'uuid' })
6
15
  id: string;
7
16
 
8
- @ApiProperty({ description: 'HTML do termo (editor rico)' })
17
+ @ApiProperty({
18
+ description: 'Conteúdo do modelo (HTML, Markdown ou texto conforme body_format)',
19
+ })
9
20
  body_html: string;
10
21
 
22
+ @ApiProperty({
23
+ enum: LEGAL_TERM_BODY_FORMATS,
24
+ description: 'Como interpretar body_html antes de gerar PDF (Clicksign)',
25
+ })
26
+ body_format: LegalTermBodyFormat;
27
+
11
28
  @ApiProperty({
12
29
  type: [String],
13
30
  format: 'uuid',
@@ -23,12 +40,24 @@ export class LegalTermTemplateDto {
23
40
  }
24
41
 
25
42
  export class UpsertLegalTermTemplateDto {
26
- @ApiProperty({ description: 'HTML do termo (editor rico)', minLength: 1, maxLength: 500_000 })
43
+ @ApiProperty({
44
+ description: 'Corpo do termo (HTML, Markdown ou texto puro conforme body_format)',
45
+ minLength: 1,
46
+ maxLength: 500_000,
47
+ })
27
48
  @IsString()
28
49
  @MinLength(1)
29
50
  @MaxLength(500_000)
30
51
  body_html: string;
31
52
 
53
+ @ApiPropertyOptional({
54
+ enum: LEGAL_TERM_BODY_FORMATS,
55
+ description: 'Padrão: html',
56
+ })
57
+ @IsOptional()
58
+ @IsIn(LEGAL_TERM_BODY_FORMATS)
59
+ body_format?: LegalTermBodyFormat;
60
+
32
61
  @ApiPropertyOptional({
33
62
  type: [String],
34
63
  format: 'uuid',