tychat-contracts 1.0.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.
- package/README.md +31 -0
- package/dist/auth/index.d.ts +2 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +5 -0
- package/dist/auth/login.dto.d.ts +5 -0
- package/dist/auth/login.dto.d.ts.map +1 -0
- package/dist/auth/login.dto.js +28 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/tenants/create-tenant.dto.d.ts +10 -0
- package/dist/tenants/create-tenant.dto.d.ts.map +1 -0
- package/dist/tenants/create-tenant.dto.js +65 -0
- package/dist/tenants/index.d.ts +4 -0
- package/dist/tenants/index.d.ts.map +1 -0
- package/dist/tenants/index.js +9 -0
- package/dist/tenants/update-tenant-payload.dto.d.ts +6 -0
- package/dist/tenants/update-tenant-payload.dto.d.ts.map +1 -0
- package/dist/tenants/update-tenant-payload.dto.js +23 -0
- package/dist/tenants/update-tenant.dto.d.ts +10 -0
- package/dist/tenants/update-tenant.dto.d.ts.map +1 -0
- package/dist/tenants/update-tenant.dto.js +70 -0
- package/package.json +22 -0
- package/src/auth/index.ts +1 -0
- package/src/auth/login.dto.ts +11 -0
- package/src/index.ts +2 -0
- package/src/tenants/create-tenant.dto.ts +47 -0
- package/src/tenants/index.ts +3 -0
- package/src/tenants/update-tenant-payload.dto.ts +8 -0
- package/src/tenants/update-tenant.dto.ts +52 -0
- package/tsconfig.json +20 -0
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
- **tenants**: `CreateTenantDto`, `UpdateTenantDto`, `UpdateTenantPayloadDto`
|
|
9
|
+
|
|
10
|
+
## Uso
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# Build (gera dist/)
|
|
14
|
+
npm run build
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Nos projetos que consomem (tychat-api, tychat-tenant-service):
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"tychat-contracts-dtos": "file:../tychat-contracts-dtos"
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { CreateTenantDto, UpdateTenantDto, LoginDto } from 'tychat-contracts-dtos';
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Desenvolvimento
|
|
30
|
+
|
|
31
|
+
Após alterar os DTOs, rode `npm run build` no pacote e reinstale (ou use `npm link`) nos projetos que o utilizam.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.dto.d.ts","sourceRoot":"","sources":["../../src/auth/login.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,QAAQ;IAGnB,QAAQ,EAAE,MAAM,CAAC;IAIjB,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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.LoginDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
class LoginDto {
|
|
15
|
+
username;
|
|
16
|
+
password;
|
|
17
|
+
}
|
|
18
|
+
exports.LoginDto = LoginDto;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, class_validator_1.IsString)(),
|
|
21
|
+
(0, class_validator_1.MinLength)(1, { message: 'username não pode ser vazio' }),
|
|
22
|
+
__metadata("design:type", String)
|
|
23
|
+
], LoginDto.prototype, "username", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, class_validator_1.IsString)(),
|
|
26
|
+
(0, class_validator_1.MinLength)(1, { message: 'password não pode ser vazio' }),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], LoginDto.prototype, "password", void 0);
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
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("./auth"), exports);
|
|
18
|
+
__exportStar(require("./tenants"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-tenant.dto.d.ts","sourceRoot":"","sources":["../../src/tenants/create-tenant.dto.ts"],"names":[],"mappings":"AAWA,qBAAa,eAAe;IAI1B,IAAI,EAAE,MAAM,CAAC;IAKb,MAAM,EAAE,MAAM,CAAC;IAMf,MAAM,CAAC,EAAE,MAAM,CAAC;IAKhB,MAAM,EAAE,MAAM,CAAC;IAKf,MAAM,EAAE,MAAM,CAAC;IAKf,UAAU,EAAE,MAAM,CAAC;IAInB,MAAM,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;CAChC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
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.CreateTenantDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
class CreateTenantDto {
|
|
15
|
+
slug;
|
|
16
|
+
dbHost;
|
|
17
|
+
dbPort;
|
|
18
|
+
dbName;
|
|
19
|
+
dbUser;
|
|
20
|
+
dbPassword;
|
|
21
|
+
status;
|
|
22
|
+
}
|
|
23
|
+
exports.CreateTenantDto = CreateTenantDto;
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, class_validator_1.IsString)(),
|
|
26
|
+
(0, class_validator_1.MinLength)(1, { message: 'slug não pode ser vazio' }),
|
|
27
|
+
(0, class_validator_1.MaxLength)(255),
|
|
28
|
+
__metadata("design:type", String)
|
|
29
|
+
], CreateTenantDto.prototype, "slug", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, class_validator_1.IsString)(),
|
|
32
|
+
(0, class_validator_1.MinLength)(1, { message: 'dbHost não pode ser vazio' }),
|
|
33
|
+
(0, class_validator_1.MaxLength)(255),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], CreateTenantDto.prototype, "dbHost", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, class_validator_1.IsOptional)(),
|
|
38
|
+
(0, class_validator_1.IsInt)(),
|
|
39
|
+
(0, class_validator_1.Min)(1),
|
|
40
|
+
(0, class_validator_1.Max)(65535),
|
|
41
|
+
__metadata("design:type", Number)
|
|
42
|
+
], CreateTenantDto.prototype, "dbPort", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, class_validator_1.IsString)(),
|
|
45
|
+
(0, class_validator_1.MinLength)(1, { message: 'dbName não pode ser vazio' }),
|
|
46
|
+
(0, class_validator_1.MaxLength)(255),
|
|
47
|
+
__metadata("design:type", String)
|
|
48
|
+
], CreateTenantDto.prototype, "dbName", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, class_validator_1.IsString)(),
|
|
51
|
+
(0, class_validator_1.MinLength)(1, { message: 'dbUser não pode ser vazio' }),
|
|
52
|
+
(0, class_validator_1.MaxLength)(255),
|
|
53
|
+
__metadata("design:type", String)
|
|
54
|
+
], CreateTenantDto.prototype, "dbUser", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, class_validator_1.IsString)(),
|
|
57
|
+
(0, class_validator_1.MinLength)(1, { message: 'dbPassword não pode ser vazio' }),
|
|
58
|
+
(0, class_validator_1.MaxLength)(255),
|
|
59
|
+
__metadata("design:type", String)
|
|
60
|
+
], CreateTenantDto.prototype, "dbPassword", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
(0, class_validator_1.IsOptional)(),
|
|
63
|
+
(0, class_validator_1.IsIn)(['active', 'inactive'], { message: 'status deve ser active ou inactive' }),
|
|
64
|
+
__metadata("design:type", String)
|
|
65
|
+
], CreateTenantDto.prototype, "status", void 0);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tenants/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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; } });
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { UpdateTenantDto } from './update-tenant.dto';
|
|
2
|
+
/** Payload do Kafka para tenant.update: id + campos opcionais. */
|
|
3
|
+
export declare class UpdateTenantPayloadDto extends UpdateTenantDto {
|
|
4
|
+
id: number;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=update-tenant-payload.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-tenant-payload.dto.d.ts","sourceRoot":"","sources":["../../src/tenants/update-tenant-payload.dto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,kEAAkE;AAClE,qBAAa,sBAAuB,SAAQ,eAAe;IAEzD,EAAE,EAAE,MAAM,CAAC;CACZ"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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.UpdateTenantPayloadDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const update_tenant_dto_1 = require("./update-tenant.dto");
|
|
15
|
+
/** Payload do Kafka para tenant.update: id + campos opcionais. */
|
|
16
|
+
class UpdateTenantPayloadDto extends update_tenant_dto_1.UpdateTenantDto {
|
|
17
|
+
id;
|
|
18
|
+
}
|
|
19
|
+
exports.UpdateTenantPayloadDto = UpdateTenantPayloadDto;
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, class_validator_1.IsInt)(),
|
|
22
|
+
__metadata("design:type", Number)
|
|
23
|
+
], UpdateTenantPayloadDto.prototype, "id", void 0);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-tenant.dto.d.ts","sourceRoot":"","sources":["../../src/tenants/update-tenant.dto.ts"],"names":[],"mappings":"AAWA,qBAAa,eAAe;IAK1B,IAAI,CAAC,EAAE,MAAM,CAAC;IAMd,MAAM,CAAC,EAAE,MAAM,CAAC;IAMhB,MAAM,CAAC,EAAE,MAAM,CAAC;IAMhB,MAAM,CAAC,EAAE,MAAM,CAAC;IAMhB,MAAM,CAAC,EAAE,MAAM,CAAC;IAMhB,UAAU,CAAC,EAAE,MAAM,CAAC;IAIpB,MAAM,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;CAChC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
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.UpdateTenantDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
class UpdateTenantDto {
|
|
15
|
+
slug;
|
|
16
|
+
dbHost;
|
|
17
|
+
dbPort;
|
|
18
|
+
dbName;
|
|
19
|
+
dbUser;
|
|
20
|
+
dbPassword;
|
|
21
|
+
status;
|
|
22
|
+
}
|
|
23
|
+
exports.UpdateTenantDto = UpdateTenantDto;
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, class_validator_1.IsOptional)(),
|
|
26
|
+
(0, class_validator_1.IsString)(),
|
|
27
|
+
(0, class_validator_1.MinLength)(1, { message: 'slug não pode ser vazio' }),
|
|
28
|
+
(0, class_validator_1.MaxLength)(255),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], UpdateTenantDto.prototype, "slug", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, class_validator_1.IsOptional)(),
|
|
33
|
+
(0, class_validator_1.IsString)(),
|
|
34
|
+
(0, class_validator_1.MinLength)(1, { message: 'dbHost não pode ser vazio' }),
|
|
35
|
+
(0, class_validator_1.MaxLength)(255),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], UpdateTenantDto.prototype, "dbHost", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, class_validator_1.IsOptional)(),
|
|
40
|
+
(0, class_validator_1.IsInt)(),
|
|
41
|
+
(0, class_validator_1.Min)(1),
|
|
42
|
+
(0, class_validator_1.Max)(65535),
|
|
43
|
+
__metadata("design:type", Number)
|
|
44
|
+
], UpdateTenantDto.prototype, "dbPort", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, class_validator_1.IsOptional)(),
|
|
47
|
+
(0, class_validator_1.IsString)(),
|
|
48
|
+
(0, class_validator_1.MinLength)(1, { message: 'dbName não pode ser vazio' }),
|
|
49
|
+
(0, class_validator_1.MaxLength)(255),
|
|
50
|
+
__metadata("design:type", String)
|
|
51
|
+
], UpdateTenantDto.prototype, "dbName", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, class_validator_1.IsOptional)(),
|
|
54
|
+
(0, class_validator_1.IsString)(),
|
|
55
|
+
(0, class_validator_1.MinLength)(1, { message: 'dbUser não pode ser vazio' }),
|
|
56
|
+
(0, class_validator_1.MaxLength)(255),
|
|
57
|
+
__metadata("design:type", String)
|
|
58
|
+
], UpdateTenantDto.prototype, "dbUser", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, class_validator_1.IsOptional)(),
|
|
61
|
+
(0, class_validator_1.IsString)(),
|
|
62
|
+
(0, class_validator_1.MinLength)(1, { message: 'dbPassword não pode ser vazio' }),
|
|
63
|
+
(0, class_validator_1.MaxLength)(255),
|
|
64
|
+
__metadata("design:type", String)
|
|
65
|
+
], UpdateTenantDto.prototype, "dbPassword", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, class_validator_1.IsOptional)(),
|
|
68
|
+
(0, class_validator_1.IsIn)(['active', 'inactive'], { message: 'status deve ser active ou inactive' }),
|
|
69
|
+
__metadata("design:type", String)
|
|
70
|
+
], UpdateTenantDto.prototype, "status", void 0);
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tychat-contracts",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "DTOs compartilhados com class-validator (API e microserviços)",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"private": false,
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"prepublishOnly": "npm run build"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"class-validator": "^0.14.1",
|
|
14
|
+
"reflect-metadata": "^0.2.2"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"typescript": "^5.7.3"
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"reflect-metadata": "*"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LoginDto } from './login.dto';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IsString, MinLength } from 'class-validator';
|
|
2
|
+
|
|
3
|
+
export class LoginDto {
|
|
4
|
+
@IsString()
|
|
5
|
+
@MinLength(1, { message: 'username não pode ser vazio' })
|
|
6
|
+
username: string;
|
|
7
|
+
|
|
8
|
+
@IsString()
|
|
9
|
+
@MinLength(1, { message: 'password não pode ser vazio' })
|
|
10
|
+
password: string;
|
|
11
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IsString,
|
|
3
|
+
IsOptional,
|
|
4
|
+
IsInt,
|
|
5
|
+
Min,
|
|
6
|
+
Max,
|
|
7
|
+
IsIn,
|
|
8
|
+
MaxLength,
|
|
9
|
+
MinLength,
|
|
10
|
+
} from 'class-validator';
|
|
11
|
+
|
|
12
|
+
export class CreateTenantDto {
|
|
13
|
+
@IsString()
|
|
14
|
+
@MinLength(1, { message: 'slug não pode ser vazio' })
|
|
15
|
+
@MaxLength(255)
|
|
16
|
+
slug: string;
|
|
17
|
+
|
|
18
|
+
@IsString()
|
|
19
|
+
@MinLength(1, { message: 'dbHost não pode ser vazio' })
|
|
20
|
+
@MaxLength(255)
|
|
21
|
+
dbHost: string;
|
|
22
|
+
|
|
23
|
+
@IsOptional()
|
|
24
|
+
@IsInt()
|
|
25
|
+
@Min(1)
|
|
26
|
+
@Max(65535)
|
|
27
|
+
dbPort?: number;
|
|
28
|
+
|
|
29
|
+
@IsString()
|
|
30
|
+
@MinLength(1, { message: 'dbName não pode ser vazio' })
|
|
31
|
+
@MaxLength(255)
|
|
32
|
+
dbName: string;
|
|
33
|
+
|
|
34
|
+
@IsString()
|
|
35
|
+
@MinLength(1, { message: 'dbUser não pode ser vazio' })
|
|
36
|
+
@MaxLength(255)
|
|
37
|
+
dbUser: string;
|
|
38
|
+
|
|
39
|
+
@IsString()
|
|
40
|
+
@MinLength(1, { message: 'dbPassword não pode ser vazio' })
|
|
41
|
+
@MaxLength(255)
|
|
42
|
+
dbPassword: string;
|
|
43
|
+
|
|
44
|
+
@IsOptional()
|
|
45
|
+
@IsIn(['active', 'inactive'], { message: 'status deve ser active ou inactive' })
|
|
46
|
+
status?: 'active' | 'inactive';
|
|
47
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IsString,
|
|
3
|
+
IsOptional,
|
|
4
|
+
IsInt,
|
|
5
|
+
Min,
|
|
6
|
+
Max,
|
|
7
|
+
IsIn,
|
|
8
|
+
MaxLength,
|
|
9
|
+
MinLength,
|
|
10
|
+
} from 'class-validator';
|
|
11
|
+
|
|
12
|
+
export class UpdateTenantDto {
|
|
13
|
+
@IsOptional()
|
|
14
|
+
@IsString()
|
|
15
|
+
@MinLength(1, { message: 'slug não pode ser vazio' })
|
|
16
|
+
@MaxLength(255)
|
|
17
|
+
slug?: string;
|
|
18
|
+
|
|
19
|
+
@IsOptional()
|
|
20
|
+
@IsString()
|
|
21
|
+
@MinLength(1, { message: 'dbHost não pode ser vazio' })
|
|
22
|
+
@MaxLength(255)
|
|
23
|
+
dbHost?: string;
|
|
24
|
+
|
|
25
|
+
@IsOptional()
|
|
26
|
+
@IsInt()
|
|
27
|
+
@Min(1)
|
|
28
|
+
@Max(65535)
|
|
29
|
+
dbPort?: number;
|
|
30
|
+
|
|
31
|
+
@IsOptional()
|
|
32
|
+
@IsString()
|
|
33
|
+
@MinLength(1, { message: 'dbName não pode ser vazio' })
|
|
34
|
+
@MaxLength(255)
|
|
35
|
+
dbName?: string;
|
|
36
|
+
|
|
37
|
+
@IsOptional()
|
|
38
|
+
@IsString()
|
|
39
|
+
@MinLength(1, { message: 'dbUser não pode ser vazio' })
|
|
40
|
+
@MaxLength(255)
|
|
41
|
+
dbUser?: string;
|
|
42
|
+
|
|
43
|
+
@IsOptional()
|
|
44
|
+
@IsString()
|
|
45
|
+
@MinLength(1, { message: 'dbPassword não pode ser vazio' })
|
|
46
|
+
@MaxLength(255)
|
|
47
|
+
dbPassword?: string;
|
|
48
|
+
|
|
49
|
+
@IsOptional()
|
|
50
|
+
@IsIn(['active', 'inactive'], { message: 'status deve ser active ou inactive' })
|
|
51
|
+
status?: 'active' | 'inactive';
|
|
52
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"lib": ["ES2022"],
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"declarationMap": true,
|
|
8
|
+
"outDir": "./dist",
|
|
9
|
+
"rootDir": "./src",
|
|
10
|
+
"strict": true,
|
|
11
|
+
"strictPropertyInitialization": false,
|
|
12
|
+
"esModuleInterop": true,
|
|
13
|
+
"skipLibCheck": true,
|
|
14
|
+
"forceConsistentCasingInFileNames": true,
|
|
15
|
+
"experimentalDecorators": true,
|
|
16
|
+
"emitDecoratorMetadata": true
|
|
17
|
+
},
|
|
18
|
+
"include": ["src/**/*.ts"],
|
|
19
|
+
"exclude": ["node_modules", "dist"]
|
|
20
|
+
}
|