tychat-contracts 1.0.4 → 1.0.6
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 +30 -31
- package/dist/auth/index.d.ts +1 -0
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +3 -1
- package/dist/auth/refresh-token.dto.d.ts +4 -0
- package/dist/auth/refresh-token.dto.d.ts.map +1 -0
- package/dist/auth/refresh-token.dto.js +24 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/tenants/index.d.ts +0 -3
- package/dist/tenants/index.d.ts.map +1 -1
- package/dist/tenants/index.js +1 -8
- package/package.json +1 -1
- package/src/auth/index.ts +1 -0
- package/src/auth/refresh-token.dto.ts +10 -0
- package/src/index.ts +1 -2
- package/src/tenants/index.ts +1 -3
- package/src/tenants/create-tenant.dto.ts +0 -55
- package/src/tenants/update-tenant-payload.dto.ts +0 -10
- package/src/tenants/update-tenant.dto.ts +0 -60
package/README.md
CHANGED
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
# tychat-contracts-dtos
|
|
2
|
-
|
|
3
|
-
DTOs compartilhados com **class-validator** usados pela **tychat-api** e pelos microserviços (ex.: **tychat-tenant-service**).
|
|
4
|
-
|
|
5
|
-
## Estrutura
|
|
6
|
-
|
|
7
|
-
- **auth**: `LoginDto`
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
Após alterar os DTOs, rode `npm run build` no pacote e reinstale (ou use `npm link`) nos projetos que o utilizam.
|
|
1
|
+
# tychat-contracts-dtos
|
|
2
|
+
|
|
3
|
+
DTOs compartilhados com **class-validator** usados pela **tychat-api** e pelos microserviços (ex.: **tychat-tenant-service**).
|
|
4
|
+
|
|
5
|
+
## Estrutura
|
|
6
|
+
|
|
7
|
+
- **auth**: `LoginDto`
|
|
8
|
+
|
|
9
|
+
## Uso
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Build (gera dist/)
|
|
13
|
+
npm run build
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Nos projetos que consomem (tychat-api, tychat-tenant-service):
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"tychat-contracts-dtos": "file:../tychat-contracts-dtos"
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { LoginDto } from 'tychat-contracts-dtos';
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Desenvolvimento
|
|
29
|
+
|
|
30
|
+
Após alterar os DTOs, rode `npm run build` no pacote e reinstale (ou use `npm link`) nos projetos que o utilizam.
|
package/dist/auth/index.d.ts
CHANGED
package/dist/auth/index.d.ts.map
CHANGED
|
@@ -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"}
|
|
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"}
|
package/dist/auth/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LoginDto = void 0;
|
|
3
|
+
exports.RefreshTokenDto = exports.LoginDto = void 0;
|
|
4
4
|
var login_dto_1 = require("./login.dto");
|
|
5
5
|
Object.defineProperty(exports, "LoginDto", { enumerable: true, get: function () { return login_dto_1.LoginDto; } });
|
|
6
|
+
var refresh_token_dto_1 = require("./refresh-token.dto");
|
|
7
|
+
Object.defineProperty(exports, "RefreshTokenDto", { enumerable: true, get: function () { return refresh_token_dto_1.RefreshTokenDto; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refresh-token.dto.d.ts","sourceRoot":"","sources":["../../src/auth/refresh-token.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,eAAe;IAI1B,aAAa,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
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.RefreshTokenDto = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
class RefreshTokenDto {
|
|
16
|
+
refresh_token;
|
|
17
|
+
}
|
|
18
|
+
exports.RefreshTokenDto = RefreshTokenDto;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, swagger_1.ApiProperty)({ description: 'Token de refresh JWT', example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' }),
|
|
21
|
+
(0, class_validator_1.IsString)(),
|
|
22
|
+
(0, class_validator_1.MinLength)(1, { message: 'refresh_token não pode ser vazio' }),
|
|
23
|
+
__metadata("design:type", String)
|
|
24
|
+
], RefreshTokenDto.prototype, "refresh_token", void 0);
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/tenants/index.d.ts
CHANGED
|
@@ -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":""}
|
package/dist/tenants/index.js
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.UpdateTenantPayloadDto = exports.UpdateTenantDto = exports.CreateTenantDto = void 0;
|
|
4
|
-
var create_tenant_dto_1 = require("./create-tenant.dto");
|
|
5
|
-
Object.defineProperty(exports, "CreateTenantDto", { enumerable: true, get: function () { return create_tenant_dto_1.CreateTenantDto; } });
|
|
6
|
-
var update_tenant_dto_1 = require("./update-tenant.dto");
|
|
7
|
-
Object.defineProperty(exports, "UpdateTenantDto", { enumerable: true, get: function () { return update_tenant_dto_1.UpdateTenantDto; } });
|
|
8
|
-
var update_tenant_payload_dto_1 = require("./update-tenant-payload.dto");
|
|
9
|
-
Object.defineProperty(exports, "UpdateTenantPayloadDto", { enumerable: true, get: function () { return update_tenant_payload_dto_1.UpdateTenantPayloadDto; } });
|
|
2
|
+
// DTOs de tenants foram movidos para o próprio microserviço tychat-tenant-service
|
package/package.json
CHANGED
package/src/auth/index.ts
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
+
import { IsString, MinLength } from 'class-validator';
|
|
3
|
+
|
|
4
|
+
export class RefreshTokenDto {
|
|
5
|
+
@ApiProperty({ description: 'Token de refresh JWT', example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' })
|
|
6
|
+
@IsString()
|
|
7
|
+
@MinLength(1, { message: 'refresh_token não pode ser vazio' })
|
|
8
|
+
refresh_token: string;
|
|
9
|
+
}
|
|
10
|
+
|
package/src/index.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from './auth';
|
|
2
|
-
export * from './tenants';
|
|
1
|
+
export * from './auth';
|
package/src/tenants/index.ts
CHANGED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
-
import {
|
|
3
|
-
IsString,
|
|
4
|
-
IsOptional,
|
|
5
|
-
IsInt,
|
|
6
|
-
Min,
|
|
7
|
-
Max,
|
|
8
|
-
IsIn,
|
|
9
|
-
MaxLength,
|
|
10
|
-
MinLength,
|
|
11
|
-
} from 'class-validator';
|
|
12
|
-
|
|
13
|
-
export class CreateTenantDto {
|
|
14
|
-
@ApiProperty({ description: 'Identificador único do tenant na URL', example: 'acme', maxLength: 255 })
|
|
15
|
-
@IsString()
|
|
16
|
-
@MinLength(1, { message: 'slug não pode ser vazio' })
|
|
17
|
-
@MaxLength(255)
|
|
18
|
-
slug: string;
|
|
19
|
-
|
|
20
|
-
@ApiProperty({ description: 'Host do banco de dados do tenant', example: 'localhost', maxLength: 255 })
|
|
21
|
-
@IsString()
|
|
22
|
-
@MinLength(1, { message: 'dbHost não pode ser vazio' })
|
|
23
|
-
@MaxLength(255)
|
|
24
|
-
dbHost: string;
|
|
25
|
-
|
|
26
|
-
@ApiPropertyOptional({ description: 'Porta do banco de dados', example: 5432, minimum: 1, maximum: 65535, default: 5432 })
|
|
27
|
-
@IsOptional()
|
|
28
|
-
@IsInt()
|
|
29
|
-
@Min(1)
|
|
30
|
-
@Max(65535)
|
|
31
|
-
dbPort?: number;
|
|
32
|
-
|
|
33
|
-
@ApiProperty({ description: 'Nome do banco de dados', example: 'tychat_acme', maxLength: 255 })
|
|
34
|
-
@IsString()
|
|
35
|
-
@MinLength(1, { message: 'dbName não pode ser vazio' })
|
|
36
|
-
@MaxLength(255)
|
|
37
|
-
dbName: string;
|
|
38
|
-
|
|
39
|
-
@ApiProperty({ description: 'Usuário do banco de dados', example: 'tychat_user', maxLength: 255 })
|
|
40
|
-
@IsString()
|
|
41
|
-
@MinLength(1, { message: 'dbUser não pode ser vazio' })
|
|
42
|
-
@MaxLength(255)
|
|
43
|
-
dbUser: string;
|
|
44
|
-
|
|
45
|
-
@ApiProperty({ description: 'Senha do banco de dados', example: 'secret', maxLength: 255 })
|
|
46
|
-
@IsString()
|
|
47
|
-
@MinLength(1, { message: 'dbPassword não pode ser vazio' })
|
|
48
|
-
@MaxLength(255)
|
|
49
|
-
dbPassword: string;
|
|
50
|
-
|
|
51
|
-
@ApiPropertyOptional({ description: 'Status do tenant', enum: ['active', 'inactive'], default: 'active' })
|
|
52
|
-
@IsOptional()
|
|
53
|
-
@IsIn(['active', 'inactive'], { message: 'status deve ser active ou inactive' })
|
|
54
|
-
status?: 'active' | 'inactive';
|
|
55
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
-
import { IsInt } from 'class-validator';
|
|
3
|
-
import { UpdateTenantDto } from './update-tenant.dto';
|
|
4
|
-
|
|
5
|
-
/** Payload do Kafka para tenant.update: id + campos opcionais. */
|
|
6
|
-
export class UpdateTenantPayloadDto extends UpdateTenantDto {
|
|
7
|
-
@ApiProperty({ description: 'ID do tenant a ser atualizado', example: 1 })
|
|
8
|
-
@IsInt()
|
|
9
|
-
id: number;
|
|
10
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
-
import {
|
|
3
|
-
IsString,
|
|
4
|
-
IsOptional,
|
|
5
|
-
IsInt,
|
|
6
|
-
Min,
|
|
7
|
-
Max,
|
|
8
|
-
IsIn,
|
|
9
|
-
MaxLength,
|
|
10
|
-
MinLength,
|
|
11
|
-
} from 'class-validator';
|
|
12
|
-
|
|
13
|
-
export class UpdateTenantDto {
|
|
14
|
-
@ApiPropertyOptional({ description: 'Identificador único do tenant na URL', example: 'acme', maxLength: 255 })
|
|
15
|
-
@IsOptional()
|
|
16
|
-
@IsString()
|
|
17
|
-
@MinLength(1, { message: 'slug não pode ser vazio' })
|
|
18
|
-
@MaxLength(255)
|
|
19
|
-
slug?: string;
|
|
20
|
-
|
|
21
|
-
@ApiPropertyOptional({ description: 'Host do banco de dados do tenant', example: 'localhost', maxLength: 255 })
|
|
22
|
-
@IsOptional()
|
|
23
|
-
@IsString()
|
|
24
|
-
@MinLength(1, { message: 'dbHost não pode ser vazio' })
|
|
25
|
-
@MaxLength(255)
|
|
26
|
-
dbHost?: string;
|
|
27
|
-
|
|
28
|
-
@ApiPropertyOptional({ description: 'Porta do banco de dados', example: 5432, minimum: 1, maximum: 65535 })
|
|
29
|
-
@IsOptional()
|
|
30
|
-
@IsInt()
|
|
31
|
-
@Min(1)
|
|
32
|
-
@Max(65535)
|
|
33
|
-
dbPort?: number;
|
|
34
|
-
|
|
35
|
-
@ApiPropertyOptional({ description: 'Nome do banco de dados', example: 'tychat_acme', maxLength: 255 })
|
|
36
|
-
@IsOptional()
|
|
37
|
-
@IsString()
|
|
38
|
-
@MinLength(1, { message: 'dbName não pode ser vazio' })
|
|
39
|
-
@MaxLength(255)
|
|
40
|
-
dbName?: string;
|
|
41
|
-
|
|
42
|
-
@ApiPropertyOptional({ description: 'Usuário do banco de dados', example: 'tychat_user', maxLength: 255 })
|
|
43
|
-
@IsOptional()
|
|
44
|
-
@IsString()
|
|
45
|
-
@MinLength(1, { message: 'dbUser não pode ser vazio' })
|
|
46
|
-
@MaxLength(255)
|
|
47
|
-
dbUser?: string;
|
|
48
|
-
|
|
49
|
-
@ApiPropertyOptional({ description: 'Senha do banco de dados', example: 'secret', maxLength: 255 })
|
|
50
|
-
@IsOptional()
|
|
51
|
-
@IsString()
|
|
52
|
-
@MinLength(1, { message: 'dbPassword não pode ser vazio' })
|
|
53
|
-
@MaxLength(255)
|
|
54
|
-
dbPassword?: string;
|
|
55
|
-
|
|
56
|
-
@ApiPropertyOptional({ description: 'Status do tenant', enum: ['active', 'inactive'] })
|
|
57
|
-
@IsOptional()
|
|
58
|
-
@IsIn(['active', 'inactive'], { message: 'status deve ser active ou inactive' })
|
|
59
|
-
status?: 'active' | 'inactive';
|
|
60
|
-
}
|