tychat-contracts 1.0.7 → 1.0.9

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.
@@ -11,4 +11,11 @@ export interface RefreshPayload {
11
11
  refresh_token: string;
12
12
  tenant?: string;
13
13
  }
14
+ /** Payload para criação de usuário (atendente ou profissional de saúde). Quem envia deve garantir que apenas administrador pode solicitar. */
15
+ export interface CreateUserPayload {
16
+ tenant?: string;
17
+ username: string;
18
+ password: string;
19
+ role: 'attendant' | 'health_professional';
20
+ }
14
21
  //# 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":"AAAA,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
1
+ {"version":3,"file":"auth-kafka.payloads.d.ts","sourceRoot":"","sources":["../../src/auth/auth-kafka.payloads.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,8IAA8I;AAC9I,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,WAAW,GAAG,qBAAqB,CAAC;CAC3C"}
@@ -1,4 +1,4 @@
1
1
  export { LoginDto } from './login.dto';
2
- export { LoginPayload, ValidatePayload, RefreshPayload } from './auth-kafka.payloads';
2
+ export { LoginPayload, ValidatePayload, RefreshPayload, CreateUserPayload, } from './auth-kafka.payloads';
3
3
  export { RefreshTokenDto } from './refresh-token.dto';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -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,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC"}
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,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './auth';
2
2
  export * from './users';
3
+ export * from './patients';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./auth"), exports);
18
18
  __exportStar(require("./users"), exports);
19
+ __exportStar(require("./patients"), exports);
@@ -0,0 +1,9 @@
1
+ export declare class CreatePatientDto {
2
+ name: string;
3
+ cpf: string;
4
+ birthDate: string;
5
+ hasDisability: boolean;
6
+ disabilityDescription?: string | null;
7
+ notes?: string | null;
8
+ }
9
+ //# sourceMappingURL=create-patient.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-patient.dto.d.ts","sourceRoot":"","sources":["../../src/patients/create-patient.dto.ts"],"names":[],"mappings":"AAWA,qBAAa,gBAAgB;IAS3B,IAAI,EAAE,MAAM,CAAC;IAUb,GAAG,EAAE,MAAM,CAAC;IAOZ,SAAS,EAAE,MAAM,CAAC;IAOlB,aAAa,EAAE,OAAO,CAAC;IAWvB,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAUtC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB"}
@@ -0,0 +1,83 @@
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.CreatePatientDto = void 0;
13
+ const swagger_1 = require("@nestjs/swagger");
14
+ const class_validator_1 = require("class-validator");
15
+ class CreatePatientDto {
16
+ name;
17
+ cpf;
18
+ birthDate;
19
+ hasDisability;
20
+ disabilityDescription;
21
+ notes;
22
+ }
23
+ exports.CreatePatientDto = CreatePatientDto;
24
+ __decorate([
25
+ (0, swagger_1.ApiProperty)({
26
+ description: 'Nome completo do paciente',
27
+ example: 'João da Silva',
28
+ maxLength: 255,
29
+ }),
30
+ (0, class_validator_1.IsString)(),
31
+ (0, class_validator_1.IsNotEmpty)(),
32
+ (0, class_validator_1.MaxLength)(255),
33
+ __metadata("design:type", String)
34
+ ], CreatePatientDto.prototype, "name", void 0);
35
+ __decorate([
36
+ (0, swagger_1.ApiProperty)({
37
+ description: 'CPF do paciente apenas com dígitos',
38
+ example: '12345678909',
39
+ minLength: 11,
40
+ maxLength: 11,
41
+ }),
42
+ (0, class_validator_1.IsString)(),
43
+ (0, class_validator_1.Length)(11, 11, { message: 'cpf deve conter exatamente 11 dígitos' }),
44
+ __metadata("design:type", String)
45
+ ], CreatePatientDto.prototype, "cpf", void 0);
46
+ __decorate([
47
+ (0, swagger_1.ApiProperty)({
48
+ description: 'Data de nascimento do paciente no formato ISO (YYYY-MM-DD)',
49
+ example: '1990-01-01',
50
+ }),
51
+ (0, class_validator_1.IsDateString)(),
52
+ __metadata("design:type", String)
53
+ ], CreatePatientDto.prototype, "birthDate", void 0);
54
+ __decorate([
55
+ (0, swagger_1.ApiProperty)({
56
+ description: 'Indica se o paciente possui alguma deficiência',
57
+ example: true,
58
+ }),
59
+ (0, class_validator_1.IsBoolean)(),
60
+ __metadata("design:type", Boolean)
61
+ ], CreatePatientDto.prototype, "hasDisability", void 0);
62
+ __decorate([
63
+ (0, swagger_1.ApiPropertyOptional)({
64
+ description: 'Descrição da deficiência do paciente (obrigatório quando hasDisability for true)',
65
+ example: 'Deficiência visual',
66
+ maxLength: 500,
67
+ }),
68
+ (0, class_validator_1.IsString)(),
69
+ (0, class_validator_1.IsOptional)(),
70
+ (0, class_validator_1.MaxLength)(500),
71
+ __metadata("design:type", Object)
72
+ ], CreatePatientDto.prototype, "disabilityDescription", void 0);
73
+ __decorate([
74
+ (0, swagger_1.ApiPropertyOptional)({
75
+ description: 'Observações gerais sobre o paciente',
76
+ example: 'Paciente tem alergia a penicilina',
77
+ maxLength: 1000,
78
+ }),
79
+ (0, class_validator_1.IsString)(),
80
+ (0, class_validator_1.IsOptional)(),
81
+ (0, class_validator_1.MaxLength)(1000),
82
+ __metadata("design:type", Object)
83
+ ], CreatePatientDto.prototype, "notes", void 0);
@@ -0,0 +1,4 @@
1
+ export * from './create-patient.dto';
2
+ export * from './update-patient.dto';
3
+ export * from './patient-history-entry.dto';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/patients/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
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("./create-patient.dto"), exports);
18
+ __exportStar(require("./update-patient.dto"), exports);
19
+ __exportStar(require("./patient-history-entry.dto"), exports);
@@ -0,0 +1,5 @@
1
+ export declare class PatientHistoryEntryDto {
2
+ createdAt: string;
3
+ note: string;
4
+ }
5
+ //# sourceMappingURL=patient-history-entry.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patient-history-entry.dto.d.ts","sourceRoot":"","sources":["../../src/patients/patient-history-entry.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,sBAAsB;IAMjC,SAAS,EAAE,MAAM,CAAC;IAUlB,IAAI,EAAE,MAAM,CAAC;CACd"}
@@ -0,0 +1,38 @@
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.PatientHistoryEntryDto = void 0;
13
+ const swagger_1 = require("@nestjs/swagger");
14
+ const class_validator_1 = require("class-validator");
15
+ class PatientHistoryEntryDto {
16
+ createdAt;
17
+ note;
18
+ }
19
+ exports.PatientHistoryEntryDto = PatientHistoryEntryDto;
20
+ __decorate([
21
+ (0, swagger_1.ApiProperty)({
22
+ description: 'Data em que a observação foi registrada',
23
+ example: '2025-03-10T10:00:00.000Z',
24
+ }),
25
+ (0, class_validator_1.IsDateString)(),
26
+ __metadata("design:type", String)
27
+ ], PatientHistoryEntryDto.prototype, "createdAt", void 0);
28
+ __decorate([
29
+ (0, swagger_1.ApiProperty)({
30
+ description: 'Texto da observação sobre o paciente',
31
+ example: 'Paciente relatou melhora significativa nos sintomas.',
32
+ maxLength: 2000,
33
+ }),
34
+ (0, class_validator_1.IsString)(),
35
+ (0, class_validator_1.IsNotEmpty)(),
36
+ (0, class_validator_1.MaxLength)(2000),
37
+ __metadata("design:type", String)
38
+ ], PatientHistoryEntryDto.prototype, "note", void 0);
@@ -0,0 +1,6 @@
1
+ import { CreatePatientDto } from './create-patient.dto';
2
+ declare const UpdatePatientDto_base: import("@nestjs/common").Type<Partial<CreatePatientDto>>;
3
+ export declare class UpdatePatientDto extends UpdatePatientDto_base {
4
+ }
5
+ export {};
6
+ //# sourceMappingURL=update-patient.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-patient.dto.d.ts","sourceRoot":"","sources":["../../src/patients/update-patient.dto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;;AAExD,qBAAa,gBAAiB,SAAQ,qBAA6B;CAAG"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpdatePatientDto = void 0;
4
+ const swagger_1 = require("@nestjs/swagger");
5
+ const create_patient_dto_1 = require("./create-patient.dto");
6
+ class UpdatePatientDto extends (0, swagger_1.PartialType)(create_patient_dto_1.CreatePatientDto) {
7
+ }
8
+ exports.UpdatePatientDto = UpdatePatientDto;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tychat-contracts",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
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",
@@ -14,3 +14,11 @@ export interface RefreshPayload {
14
14
  tenant?: string;
15
15
  }
16
16
 
17
+ /** Payload para criação de usuário (atendente ou profissional de saúde). Quem envia deve garantir que apenas administrador pode solicitar. */
18
+ export interface CreateUserPayload {
19
+ tenant?: string;
20
+ username: string;
21
+ password: string;
22
+ role: 'attendant' | 'health_professional';
23
+ }
24
+
package/src/auth/index.ts CHANGED
@@ -1,3 +1,8 @@
1
- export { LoginDto } from './login.dto';
2
- export { LoginPayload, ValidatePayload, RefreshPayload } from './auth-kafka.payloads';
3
- export { RefreshTokenDto } from './refresh-token.dto';
1
+ export { LoginDto } from './login.dto';
2
+ export {
3
+ LoginPayload,
4
+ ValidatePayload,
5
+ RefreshPayload,
6
+ CreateUserPayload,
7
+ } from './auth-kafka.payloads';
8
+ export { RefreshTokenDto } from './refresh-token.dto';
package/src/index.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './auth';
2
2
  export * from './users';
3
+ export * from './patients';
@@ -0,0 +1,68 @@
1
+ import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
2
+ import {
3
+ IsBoolean,
4
+ IsDateString,
5
+ IsNotEmpty,
6
+ IsOptional,
7
+ IsString,
8
+ Length,
9
+ MaxLength,
10
+ } from 'class-validator';
11
+
12
+ export class CreatePatientDto {
13
+ @ApiProperty({
14
+ description: 'Nome completo do paciente',
15
+ example: 'João da Silva',
16
+ maxLength: 255,
17
+ })
18
+ @IsString()
19
+ @IsNotEmpty()
20
+ @MaxLength(255)
21
+ name: string;
22
+
23
+ @ApiProperty({
24
+ description: 'CPF do paciente apenas com dígitos',
25
+ example: '12345678909',
26
+ minLength: 11,
27
+ maxLength: 11,
28
+ })
29
+ @IsString()
30
+ @Length(11, 11, { message: 'cpf deve conter exatamente 11 dígitos' })
31
+ cpf: string;
32
+
33
+ @ApiProperty({
34
+ description: 'Data de nascimento do paciente no formato ISO (YYYY-MM-DD)',
35
+ example: '1990-01-01',
36
+ })
37
+ @IsDateString()
38
+ birthDate: string;
39
+
40
+ @ApiProperty({
41
+ description: 'Indica se o paciente possui alguma deficiência',
42
+ example: true,
43
+ })
44
+ @IsBoolean()
45
+ hasDisability: boolean;
46
+
47
+ @ApiPropertyOptional({
48
+ description:
49
+ 'Descrição da deficiência do paciente (obrigatório quando hasDisability for true)',
50
+ example: 'Deficiência visual',
51
+ maxLength: 500,
52
+ })
53
+ @IsString()
54
+ @IsOptional()
55
+ @MaxLength(500)
56
+ disabilityDescription?: string | null;
57
+
58
+ @ApiPropertyOptional({
59
+ description: 'Observações gerais sobre o paciente',
60
+ example: 'Paciente tem alergia a penicilina',
61
+ maxLength: 1000,
62
+ })
63
+ @IsString()
64
+ @IsOptional()
65
+ @MaxLength(1000)
66
+ notes?: string | null;
67
+ }
68
+
@@ -0,0 +1,4 @@
1
+ export * from './create-patient.dto';
2
+ export * from './update-patient.dto';
3
+ export * from './patient-history-entry.dto';
4
+
@@ -0,0 +1,22 @@
1
+ import { ApiProperty } from '@nestjs/swagger';
2
+ import { IsDateString, IsNotEmpty, IsString, MaxLength } from 'class-validator';
3
+
4
+ export class PatientHistoryEntryDto {
5
+ @ApiProperty({
6
+ description: 'Data em que a observação foi registrada',
7
+ example: '2025-03-10T10:00:00.000Z',
8
+ })
9
+ @IsDateString()
10
+ createdAt: string;
11
+
12
+ @ApiProperty({
13
+ description: 'Texto da observação sobre o paciente',
14
+ example: 'Paciente relatou melhora significativa nos sintomas.',
15
+ maxLength: 2000,
16
+ })
17
+ @IsString()
18
+ @IsNotEmpty()
19
+ @MaxLength(2000)
20
+ note: string;
21
+ }
22
+
@@ -0,0 +1,5 @@
1
+ import { PartialType } from '@nestjs/swagger';
2
+ import { CreatePatientDto } from './create-patient.dto';
3
+
4
+ export class UpdatePatientDto extends PartialType(CreatePatientDto) {}
5
+
Binary file