@thiscargo/contracts 0.0.19 → 0.0.20
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/dist/proto/path.d.ts +1 -0
- package/dist/proto/path.js +1 -0
- package/gen/company.ts +5 -0
- package/gen/tariff.ts +92 -0
- package/package.json +1 -1
- package/proto/company.proto +10 -5
- package/proto/tariff.proto +51 -0
package/dist/proto/path.d.ts
CHANGED
package/dist/proto/path.js
CHANGED
|
@@ -7,4 +7,5 @@ exports.PROTO_PATHS = {
|
|
|
7
7
|
ACCOUNT: (0, node_path_1.join)(__dirname, "../../proto/account.proto"),
|
|
8
8
|
SERVER: (0, node_path_1.join)(__dirname, "../../proto/server.proto"),
|
|
9
9
|
COMPANY: (0, node_path_1.join)(__dirname, "../../proto/company.proto"),
|
|
10
|
+
TARIFF: (0, node_path_1.join)(__dirname, "../../proto/tariff.proto"),
|
|
10
11
|
};
|
package/gen/company.ts
CHANGED
|
@@ -19,6 +19,9 @@ export interface CreateCompanyRequest {
|
|
|
19
19
|
phone: string;
|
|
20
20
|
address: string;
|
|
21
21
|
botToken: string;
|
|
22
|
+
slug: string;
|
|
23
|
+
adminPhone: string;
|
|
24
|
+
adminPassword: string;
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
export interface GetCompanyRequest {
|
|
@@ -31,6 +34,7 @@ export interface UpdateCompanyRequest {
|
|
|
31
34
|
phone?: string | undefined;
|
|
32
35
|
address?: string | undefined;
|
|
33
36
|
botToken?: string | undefined;
|
|
37
|
+
isActive?: boolean | undefined;
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
export interface DeleteCompanyRequest {
|
|
@@ -45,6 +49,7 @@ export interface CompanyResponse {
|
|
|
45
49
|
id: string;
|
|
46
50
|
serverId: string;
|
|
47
51
|
name: string;
|
|
52
|
+
slug: string;
|
|
48
53
|
phone: string;
|
|
49
54
|
address: string;
|
|
50
55
|
botToken: string;
|
package/gen/tariff.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.2
|
|
4
|
+
// protoc v6.33.5
|
|
5
|
+
// source: tariff.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
import { Empty } from "./google/protobuf/empty";
|
|
11
|
+
import { Timestamp } from "./google/protobuf/timestamp";
|
|
12
|
+
|
|
13
|
+
export const protobufPackage = "tariff.v1";
|
|
14
|
+
|
|
15
|
+
export interface CreateTariffRequest {
|
|
16
|
+
companyId: string;
|
|
17
|
+
name: string;
|
|
18
|
+
type: string;
|
|
19
|
+
price: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface GetTariffsRequest {
|
|
23
|
+
companyId: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface UpdateTariffRequest {
|
|
27
|
+
id: string;
|
|
28
|
+
name?: string | undefined;
|
|
29
|
+
type?: string | undefined;
|
|
30
|
+
price?: number | undefined;
|
|
31
|
+
isActive?: boolean | undefined;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface DeleteTariffRequest {
|
|
35
|
+
id: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface TariffListResponse {
|
|
39
|
+
tariffs: TariffResponse[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface TariffResponse {
|
|
43
|
+
id: string;
|
|
44
|
+
companyId: string;
|
|
45
|
+
name: string;
|
|
46
|
+
type: string;
|
|
47
|
+
price: number;
|
|
48
|
+
isActive: boolean;
|
|
49
|
+
createdAt: Timestamp | undefined;
|
|
50
|
+
updatedAt: Timestamp | undefined;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const TARIFF_V1_PACKAGE_NAME = "tariff.v1";
|
|
54
|
+
|
|
55
|
+
export interface TariffServiceClient {
|
|
56
|
+
createTariff(request: CreateTariffRequest): Observable<TariffResponse>;
|
|
57
|
+
|
|
58
|
+
getTariffsByCompany(request: GetTariffsRequest): Observable<TariffListResponse>;
|
|
59
|
+
|
|
60
|
+
updateTariff(request: UpdateTariffRequest): Observable<TariffResponse>;
|
|
61
|
+
|
|
62
|
+
deleteTariff(request: DeleteTariffRequest): Observable<Empty>;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface TariffServiceController {
|
|
66
|
+
createTariff(request: CreateTariffRequest): Promise<TariffResponse> | Observable<TariffResponse> | TariffResponse;
|
|
67
|
+
|
|
68
|
+
getTariffsByCompany(
|
|
69
|
+
request: GetTariffsRequest,
|
|
70
|
+
): Promise<TariffListResponse> | Observable<TariffListResponse> | TariffListResponse;
|
|
71
|
+
|
|
72
|
+
updateTariff(request: UpdateTariffRequest): Promise<TariffResponse> | Observable<TariffResponse> | TariffResponse;
|
|
73
|
+
|
|
74
|
+
deleteTariff(request: DeleteTariffRequest): void | Promise<void>;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function TariffServiceControllerMethods() {
|
|
78
|
+
return function (constructor: Function) {
|
|
79
|
+
const grpcMethods: string[] = ["createTariff", "getTariffsByCompany", "updateTariff", "deleteTariff"];
|
|
80
|
+
for (const method of grpcMethods) {
|
|
81
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
82
|
+
GrpcMethod("TariffService", method)(constructor.prototype[method], method, descriptor);
|
|
83
|
+
}
|
|
84
|
+
const grpcStreamMethods: string[] = [];
|
|
85
|
+
for (const method of grpcStreamMethods) {
|
|
86
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
87
|
+
GrpcStreamMethod("TariffService", method)(constructor.prototype[method], method, descriptor);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export const TARIFF_SERVICE_NAME = "TariffService";
|
package/package.json
CHANGED
package/proto/company.proto
CHANGED
|
@@ -20,6 +20,9 @@ message CreateCompanyRequest {
|
|
|
20
20
|
string phone = 3;
|
|
21
21
|
string address = 4;
|
|
22
22
|
string bot_token = 5;
|
|
23
|
+
string slug = 6;
|
|
24
|
+
string admin_phone = 7;
|
|
25
|
+
string admin_password = 8;
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
message GetCompanyRequest {
|
|
@@ -32,6 +35,7 @@ message UpdateCompanyRequest {
|
|
|
32
35
|
optional string phone = 4;
|
|
33
36
|
optional string address = 5;
|
|
34
37
|
optional string bot_token = 6;
|
|
38
|
+
optional bool is_active = 7;
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
message DeleteCompanyRequest {
|
|
@@ -46,11 +50,12 @@ message CompanyResponse {
|
|
|
46
50
|
string id = 1;
|
|
47
51
|
string server_id = 2;
|
|
48
52
|
string name = 3;
|
|
49
|
-
string
|
|
50
|
-
string
|
|
51
|
-
string
|
|
52
|
-
|
|
53
|
-
google.protobuf.Timestamp
|
|
53
|
+
string slug = 4;
|
|
54
|
+
string phone = 5;
|
|
55
|
+
string address = 6;
|
|
56
|
+
string bot_token = 7;
|
|
57
|
+
google.protobuf.Timestamp created_at = 8;
|
|
58
|
+
google.protobuf.Timestamp updated_at = 9;
|
|
54
59
|
|
|
55
60
|
repeated account.v1.AccountResponse accounts = 10;
|
|
56
61
|
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package tariff.v1;
|
|
4
|
+
|
|
5
|
+
import "google/protobuf/timestamp.proto";
|
|
6
|
+
import "google/protobuf/empty.proto";
|
|
7
|
+
|
|
8
|
+
service TariffService {
|
|
9
|
+
rpc CreateTariff (CreateTariffRequest) returns (TariffResponse);
|
|
10
|
+
rpc GetTariffsByCompany (GetTariffsRequest) returns (TariffListResponse);
|
|
11
|
+
rpc UpdateTariff (UpdateTariffRequest) returns (TariffResponse);
|
|
12
|
+
rpc DeleteTariff (DeleteTariffRequest) returns (google.protobuf.Empty);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
message CreateTariffRequest {
|
|
16
|
+
string company_id = 1;
|
|
17
|
+
string name = 2;
|
|
18
|
+
string type = 3;
|
|
19
|
+
double price = 4;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
message GetTariffsRequest {
|
|
23
|
+
string company_id = 1;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
message UpdateTariffRequest {
|
|
27
|
+
string id = 1;
|
|
28
|
+
optional string name = 2;
|
|
29
|
+
optional string type = 3;
|
|
30
|
+
optional double price = 4;
|
|
31
|
+
optional bool is_active = 5;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
message DeleteTariffRequest {
|
|
35
|
+
string id = 1;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
message TariffListResponse {
|
|
39
|
+
repeated TariffResponse tariffs = 1;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
message TariffResponse {
|
|
43
|
+
string id = 1;
|
|
44
|
+
string company_id = 2;
|
|
45
|
+
string name = 3;
|
|
46
|
+
string type = 4;
|
|
47
|
+
double price = 5;
|
|
48
|
+
bool is_active = 6;
|
|
49
|
+
google.protobuf.Timestamp created_at = 7;
|
|
50
|
+
google.protobuf.Timestamp updated_at = 8;
|
|
51
|
+
}
|