tychat-contracts 1.6.65 → 1.6.66
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/package.json
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
+
import { IsIn, IsInt, IsNotEmpty, IsObject, IsOptional, IsString, Max, Min } from 'class-validator';
|
|
2
3
|
|
|
3
4
|
export const FISCAL_DOCUMENT_TYPES = ['nfe', 'nfce', 'nfse'] as const;
|
|
4
5
|
export type FiscalDocumentType = (typeof FISCAL_DOCUMENT_TYPES)[number];
|
|
5
6
|
|
|
7
|
+
export const FISCAL_DOCUMENT_STATUSES = [
|
|
8
|
+
'queued',
|
|
9
|
+
'processing',
|
|
10
|
+
'authorized',
|
|
11
|
+
'rejected',
|
|
12
|
+
'failed',
|
|
13
|
+
'cancel_queued',
|
|
14
|
+
'cancel_processing',
|
|
15
|
+
'canceled',
|
|
16
|
+
'cancel_failed',
|
|
17
|
+
] as const;
|
|
18
|
+
export type FiscalDocumentStatusDto = (typeof FISCAL_DOCUMENT_STATUSES)[number];
|
|
19
|
+
|
|
6
20
|
export class EnqueueNfeDto {
|
|
7
21
|
@IsString()
|
|
8
22
|
@IsOptional()
|
|
@@ -20,3 +34,77 @@ export class EnqueueNfeDto {
|
|
|
20
34
|
@IsOptional()
|
|
21
35
|
referenceId?: string;
|
|
22
36
|
}
|
|
37
|
+
|
|
38
|
+
export class ListFiscalDocumentsQueryDto {
|
|
39
|
+
@ApiPropertyOptional({ enum: FISCAL_DOCUMENT_TYPES, default: 'nfse' })
|
|
40
|
+
@IsOptional()
|
|
41
|
+
@IsIn(FISCAL_DOCUMENT_TYPES)
|
|
42
|
+
documentType?: FiscalDocumentType;
|
|
43
|
+
|
|
44
|
+
@ApiPropertyOptional({ enum: FISCAL_DOCUMENT_STATUSES })
|
|
45
|
+
@IsOptional()
|
|
46
|
+
@IsIn(FISCAL_DOCUMENT_STATUSES)
|
|
47
|
+
status?: FiscalDocumentStatusDto;
|
|
48
|
+
|
|
49
|
+
@ApiPropertyOptional({ description: 'Busca por referência (ex.: appointmentId)' })
|
|
50
|
+
@IsOptional()
|
|
51
|
+
@IsString()
|
|
52
|
+
referenceId?: string;
|
|
53
|
+
|
|
54
|
+
@ApiPropertyOptional({ description: 'Busca por ACBR ID (parcial ou completo)' })
|
|
55
|
+
@IsOptional()
|
|
56
|
+
@IsString()
|
|
57
|
+
acbrId?: string;
|
|
58
|
+
|
|
59
|
+
@ApiPropertyOptional({ description: 'Data inicial (ISO: YYYY-MM-DD)' })
|
|
60
|
+
@IsOptional()
|
|
61
|
+
@IsString()
|
|
62
|
+
createdFrom?: string;
|
|
63
|
+
|
|
64
|
+
@ApiPropertyOptional({ description: 'Data final (ISO: YYYY-MM-DD)' })
|
|
65
|
+
@IsOptional()
|
|
66
|
+
@IsString()
|
|
67
|
+
createdTo?: string;
|
|
68
|
+
|
|
69
|
+
@ApiPropertyOptional({ description: 'Página (inicia em 1)', default: 1, minimum: 1 })
|
|
70
|
+
@IsOptional()
|
|
71
|
+
@IsInt()
|
|
72
|
+
@Min(1)
|
|
73
|
+
page?: number;
|
|
74
|
+
|
|
75
|
+
@ApiPropertyOptional({ description: 'Registros por página', default: 20, minimum: 1, maximum: 200 })
|
|
76
|
+
@IsOptional()
|
|
77
|
+
@IsInt()
|
|
78
|
+
@Min(1)
|
|
79
|
+
@Max(200)
|
|
80
|
+
limit?: number;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export type FiscalDocumentListItemDto = {
|
|
84
|
+
id: string;
|
|
85
|
+
documentType: FiscalDocumentType;
|
|
86
|
+
companyCpfCnpj: string;
|
|
87
|
+
referenceId: string | null;
|
|
88
|
+
acbrId: string | null;
|
|
89
|
+
status: FiscalDocumentStatusDto;
|
|
90
|
+
lastError: string | null;
|
|
91
|
+
createdAt: string;
|
|
92
|
+
updatedAt: string;
|
|
93
|
+
processedAt: string | null;
|
|
94
|
+
canceledAt: string | null;
|
|
95
|
+
archivedAt: string | null;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export type ListFiscalDocumentsResponseDto = {
|
|
99
|
+
items: FiscalDocumentListItemDto[];
|
|
100
|
+
total: number;
|
|
101
|
+
page: number;
|
|
102
|
+
limit: number;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export class InutilizeFiscalDocumentDto {
|
|
106
|
+
@ApiPropertyOptional({ description: 'Justificativa (opcional)' })
|
|
107
|
+
@IsOptional()
|
|
108
|
+
@IsString()
|
|
109
|
+
justificativa?: string;
|
|
110
|
+
}
|
|
@@ -13,13 +13,18 @@ export const FISCAL_COMPANIES_NFSE_CONFIG_GET =
|
|
|
13
13
|
'fiscal.companies.nfse_config.get';
|
|
14
14
|
export const FISCAL_COMPANIES_NFSE_CONFIG_PUT =
|
|
15
15
|
'fiscal.companies.nfse_config.put';
|
|
16
|
+
export const FISCAL_COMPANIES_SETTINGS_GET = 'fiscal.companies.settings.get';
|
|
17
|
+
export const FISCAL_COMPANIES_SETTINGS_PUT = 'fiscal.companies.settings.put';
|
|
16
18
|
|
|
17
19
|
export const FISCAL_DOCUMENTS_ENQUEUE = 'fiscal.documents.enqueue';
|
|
20
|
+
export const FISCAL_DOCUMENTS_LIST = 'fiscal.documents.list';
|
|
18
21
|
export const FISCAL_DOCUMENTS_GET = 'fiscal.documents.get';
|
|
19
22
|
export const FISCAL_DOCUMENTS_CANCEL = 'fiscal.documents.cancel';
|
|
23
|
+
export const FISCAL_DOCUMENTS_INUTILIZE = 'fiscal.documents.inutilize';
|
|
20
24
|
export const FISCAL_DOCUMENTS_SYNC = 'fiscal.documents.sync';
|
|
21
25
|
export const FISCAL_DOCUMENTS_PDF = 'fiscal.documents.pdf';
|
|
22
26
|
export const FISCAL_DOCUMENTS_XML = 'fiscal.documents.xml';
|
|
27
|
+
export const FISCAL_QUOTA_GET = 'fiscal.quota.get';
|
|
23
28
|
|
|
24
29
|
export const FISCAL_NFSE_CIDADES = 'fiscal.nfse.cidades';
|
|
25
30
|
export const FISCAL_NFSE_CIDADE_METADADOS = 'fiscal.nfse.cidade_metadados';
|
|
@@ -9,8 +9,76 @@ import {
|
|
|
9
9
|
IsString,
|
|
10
10
|
Length,
|
|
11
11
|
MaxLength,
|
|
12
|
+
ValidateNested,
|
|
12
13
|
} from 'class-validator';
|
|
13
|
-
import { Transform } from 'class-transformer';
|
|
14
|
+
import { Transform, Type } from 'class-transformer';
|
|
15
|
+
|
|
16
|
+
export class PatientInvoiceRecipientDto {
|
|
17
|
+
@ApiPropertyOptional({ description: 'Identificador do tomador (UUID ou string livre)' })
|
|
18
|
+
@IsOptional()
|
|
19
|
+
@IsString()
|
|
20
|
+
id?: string;
|
|
21
|
+
|
|
22
|
+
@ApiProperty({ description: 'Nome/Razão social do tomador' })
|
|
23
|
+
@IsString()
|
|
24
|
+
@IsNotEmpty()
|
|
25
|
+
@MaxLength(255)
|
|
26
|
+
name: string;
|
|
27
|
+
|
|
28
|
+
@ApiProperty({ description: 'CPF ou CNPJ do tomador (apenas dígitos)' })
|
|
29
|
+
@IsString()
|
|
30
|
+
@IsNotEmpty()
|
|
31
|
+
@MaxLength(14)
|
|
32
|
+
cpfCnpj: string;
|
|
33
|
+
|
|
34
|
+
@ApiPropertyOptional({ description: 'E-mail do tomador' })
|
|
35
|
+
@IsOptional()
|
|
36
|
+
@IsEmail({}, { message: 'email deve ser um e-mail válido' })
|
|
37
|
+
@MaxLength(255)
|
|
38
|
+
email?: string | null;
|
|
39
|
+
|
|
40
|
+
@ApiPropertyOptional({ description: 'Telefone do tomador (apenas dígitos)' })
|
|
41
|
+
@IsOptional()
|
|
42
|
+
@IsString()
|
|
43
|
+
@MaxLength(30)
|
|
44
|
+
phone?: string | null;
|
|
45
|
+
|
|
46
|
+
@ApiPropertyOptional({ description: 'CEP (apenas dígitos)' })
|
|
47
|
+
@IsOptional()
|
|
48
|
+
@IsString()
|
|
49
|
+
@MaxLength(8)
|
|
50
|
+
cep?: string | null;
|
|
51
|
+
|
|
52
|
+
@ApiPropertyOptional({ description: 'Código IBGE do município (cMun)' })
|
|
53
|
+
@IsOptional()
|
|
54
|
+
@IsString()
|
|
55
|
+
@MaxLength(7)
|
|
56
|
+
cityIbge?: string | null;
|
|
57
|
+
|
|
58
|
+
@ApiPropertyOptional({ description: 'Logradouro' })
|
|
59
|
+
@IsOptional()
|
|
60
|
+
@IsString()
|
|
61
|
+
@MaxLength(255)
|
|
62
|
+
street?: string | null;
|
|
63
|
+
|
|
64
|
+
@ApiPropertyOptional({ description: 'Número' })
|
|
65
|
+
@IsOptional()
|
|
66
|
+
@IsString()
|
|
67
|
+
@MaxLength(30)
|
|
68
|
+
number?: string | null;
|
|
69
|
+
|
|
70
|
+
@ApiPropertyOptional({ description: 'Bairro' })
|
|
71
|
+
@IsOptional()
|
|
72
|
+
@IsString()
|
|
73
|
+
@MaxLength(255)
|
|
74
|
+
neighborhood?: string | null;
|
|
75
|
+
|
|
76
|
+
@ApiPropertyOptional({ description: 'Complemento' })
|
|
77
|
+
@IsOptional()
|
|
78
|
+
@IsString()
|
|
79
|
+
@MaxLength(255)
|
|
80
|
+
complement?: string | null;
|
|
81
|
+
}
|
|
14
82
|
|
|
15
83
|
export class CreatePatientDto {
|
|
16
84
|
@ApiProperty({
|
|
@@ -212,6 +280,16 @@ export class CreatePatientDto {
|
|
|
212
280
|
@Transform(({ value, obj }) => value ?? obj.notes ?? obj.observation)
|
|
213
281
|
observation?: string | null;
|
|
214
282
|
|
|
283
|
+
@ApiPropertyOptional({
|
|
284
|
+
description:
|
|
285
|
+
'Lista de tomadores para emissão de nota fiscal (ex.: empresa do paciente).',
|
|
286
|
+
type: [PatientInvoiceRecipientDto],
|
|
287
|
+
})
|
|
288
|
+
@IsOptional()
|
|
289
|
+
@ValidateNested({ each: true })
|
|
290
|
+
@Type(() => PatientInvoiceRecipientDto)
|
|
291
|
+
invoiceRecipients?: PatientInvoiceRecipientDto[] | null;
|
|
292
|
+
|
|
215
293
|
@ApiPropertyOptional({
|
|
216
294
|
description: 'ID do objeto no storage da foto de perfil',
|
|
217
295
|
maxLength: 64,
|