@prodoctors/contracts 1.0.2 → 1.0.3

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.
@@ -0,0 +1,297 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.5
4
+ // protoc v3.21.12
5
+ // source: inventory.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+ import { BoolResponse, Empty, IdRequest, PaginationMeta, PaginationRequest } from "./common";
11
+ import { Timestamp } from "./google/protobuf/timestamp";
12
+
13
+ export const protobufPackage = "inventory.v1";
14
+
15
+ export interface Branch {
16
+ id: string;
17
+ name: string;
18
+ phone: string;
19
+ address?: string | undefined;
20
+ lat?: string | undefined;
21
+ lng?: string | undefined;
22
+ createdAt: Timestamp | undefined;
23
+ updatedAt: Timestamp | undefined;
24
+ }
25
+
26
+ export interface Product {
27
+ id: string;
28
+ name: string;
29
+ sku: string;
30
+ barcode: string;
31
+ price: string;
32
+ costPrice?: string | undefined;
33
+ createdAt: Timestamp | undefined;
34
+ updatedAt: Timestamp | undefined;
35
+ }
36
+
37
+ export interface InventoryItem {
38
+ id: string;
39
+ branchId: string;
40
+ productId: string;
41
+ quantity: number;
42
+ minQuantity: number;
43
+ expireAt?: Timestamp | undefined;
44
+ batchNumber?: string | undefined;
45
+ branch: Branch | undefined;
46
+ product: Product | undefined;
47
+ createdAt: Timestamp | undefined;
48
+ updatedAt: Timestamp | undefined;
49
+ }
50
+
51
+ export interface CreateBranchRequest {
52
+ name: string;
53
+ address?: string | undefined;
54
+ phone?: string | undefined;
55
+ }
56
+
57
+ export interface UpdateBranchRequest {
58
+ id: string;
59
+ name?: string | undefined;
60
+ address?: string | undefined;
61
+ phone?: string | undefined;
62
+ }
63
+
64
+ export interface ListBranchesResponse {
65
+ items: Branch[];
66
+ }
67
+
68
+ export interface CreateProductRequest {
69
+ name: string;
70
+ sku: string;
71
+ barcode: string;
72
+ /** / Kirim narxi */
73
+ costPrice: string;
74
+ /** / Sotuv narxi */
75
+ price?: string | undefined;
76
+ }
77
+
78
+ export interface UpdateProductRequest {
79
+ id: string;
80
+ name?: string | undefined;
81
+ sku?: string | undefined;
82
+ barcode?: string | undefined;
83
+ price?: string | undefined;
84
+ costPrice?: string | undefined;
85
+ }
86
+
87
+ export interface GetProductByIdRequest {
88
+ id: string;
89
+ }
90
+
91
+ export interface ListProductsRequest {
92
+ pagination: PaginationRequest | undefined;
93
+ search?: string | undefined;
94
+ }
95
+
96
+ export interface ListProductsResponse {
97
+ items: Product[];
98
+ meta: PaginationMeta | undefined;
99
+ }
100
+
101
+ export interface CreateInventoryRequest {
102
+ branchId: string;
103
+ productId: string;
104
+ quantity: number;
105
+ minQuantity: number;
106
+ expireAt?: Timestamp | undefined;
107
+ batchNumber?: string | undefined;
108
+ }
109
+
110
+ export interface UpdateInventoryRequest {
111
+ id: string;
112
+ quantity?: number | undefined;
113
+ minQuantity?: number | undefined;
114
+ expireAt?: Timestamp | undefined;
115
+ batchNumber?: string | undefined;
116
+ }
117
+
118
+ export interface AdjustInventoryQuantityRequest {
119
+ inventoryId: string;
120
+ quantityChange: number;
121
+ reason: string;
122
+ }
123
+
124
+ export interface TransferInventoryRequest {
125
+ productId: string;
126
+ fromBranchId: string;
127
+ toBranchId: string;
128
+ quantity: number;
129
+ batchNumber?: string | undefined;
130
+ }
131
+
132
+ export interface GetInventoryByIdRequest {
133
+ id: string;
134
+ }
135
+
136
+ export interface ListInventoryRequest {
137
+ pagination: PaginationRequest | undefined;
138
+ branchId?: string | undefined;
139
+ productId?: string | undefined;
140
+ search?: string | undefined;
141
+ lowStockOnly?: boolean | undefined;
142
+ expiringSoonOnly?: boolean | undefined;
143
+ }
144
+
145
+ export interface ListInventoryResponse {
146
+ items: InventoryItem[];
147
+ meta: PaginationMeta | undefined;
148
+ }
149
+
150
+ export const INVENTORY_V1_PACKAGE_NAME = "inventory.v1";
151
+
152
+ export interface BranchServiceClient {
153
+ createBranch(request: CreateBranchRequest): Observable<Branch>;
154
+
155
+ updateBranch(request: UpdateBranchRequest): Observable<Branch>;
156
+
157
+ getBranchById(request: IdRequest): Observable<Branch>;
158
+
159
+ listBranches(request: Empty): Observable<ListBranchesResponse>;
160
+
161
+ deleteBranch(request: IdRequest): Observable<BoolResponse>;
162
+ }
163
+
164
+ export interface BranchServiceController {
165
+ createBranch(request: CreateBranchRequest): Promise<Branch> | Observable<Branch> | Branch;
166
+
167
+ updateBranch(request: UpdateBranchRequest): Promise<Branch> | Observable<Branch> | Branch;
168
+
169
+ getBranchById(request: IdRequest): Promise<Branch> | Observable<Branch> | Branch;
170
+
171
+ listBranches(request: Empty): Promise<ListBranchesResponse> | Observable<ListBranchesResponse> | ListBranchesResponse;
172
+
173
+ deleteBranch(request: IdRequest): Promise<BoolResponse> | Observable<BoolResponse> | BoolResponse;
174
+ }
175
+
176
+ export function BranchServiceControllerMethods() {
177
+ return function (constructor: Function) {
178
+ const grpcMethods: string[] = ["createBranch", "updateBranch", "getBranchById", "listBranches", "deleteBranch"];
179
+ for (const method of grpcMethods) {
180
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
181
+ GrpcMethod("BranchService", method)(constructor.prototype[method], method, descriptor);
182
+ }
183
+ const grpcStreamMethods: string[] = [];
184
+ for (const method of grpcStreamMethods) {
185
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
186
+ GrpcStreamMethod("BranchService", method)(constructor.prototype[method], method, descriptor);
187
+ }
188
+ };
189
+ }
190
+
191
+ export const BRANCH_SERVICE_NAME = "BranchService";
192
+
193
+ export interface ProductServiceClient {
194
+ createProduct(request: CreateProductRequest): Observable<Product>;
195
+
196
+ updateProduct(request: UpdateProductRequest): Observable<Product>;
197
+
198
+ getProductById(request: GetProductByIdRequest): Observable<Product>;
199
+
200
+ listProducts(request: ListProductsRequest): Observable<ListProductsResponse>;
201
+
202
+ deleteProduct(request: IdRequest): Observable<BoolResponse>;
203
+ }
204
+
205
+ export interface ProductServiceController {
206
+ createProduct(request: CreateProductRequest): Promise<Product> | Observable<Product> | Product;
207
+
208
+ updateProduct(request: UpdateProductRequest): Promise<Product> | Observable<Product> | Product;
209
+
210
+ getProductById(request: GetProductByIdRequest): Promise<Product> | Observable<Product> | Product;
211
+
212
+ listProducts(
213
+ request: ListProductsRequest,
214
+ ): Promise<ListProductsResponse> | Observable<ListProductsResponse> | ListProductsResponse;
215
+
216
+ deleteProduct(request: IdRequest): Promise<BoolResponse> | Observable<BoolResponse> | BoolResponse;
217
+ }
218
+
219
+ export function ProductServiceControllerMethods() {
220
+ return function (constructor: Function) {
221
+ const grpcMethods: string[] = ["createProduct", "updateProduct", "getProductById", "listProducts", "deleteProduct"];
222
+ for (const method of grpcMethods) {
223
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
224
+ GrpcMethod("ProductService", method)(constructor.prototype[method], method, descriptor);
225
+ }
226
+ const grpcStreamMethods: string[] = [];
227
+ for (const method of grpcStreamMethods) {
228
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
229
+ GrpcStreamMethod("ProductService", method)(constructor.prototype[method], method, descriptor);
230
+ }
231
+ };
232
+ }
233
+
234
+ export const PRODUCT_SERVICE_NAME = "ProductService";
235
+
236
+ export interface InventoryServiceClient {
237
+ createInventory(request: CreateInventoryRequest): Observable<InventoryItem>;
238
+
239
+ updateInventory(request: UpdateInventoryRequest): Observable<InventoryItem>;
240
+
241
+ adjustQuantity(request: AdjustInventoryQuantityRequest): Observable<InventoryItem>;
242
+
243
+ transferInventory(request: TransferInventoryRequest): Observable<BoolResponse>;
244
+
245
+ getInventoryById(request: GetInventoryByIdRequest): Observable<InventoryItem>;
246
+
247
+ listInventory(request: ListInventoryRequest): Observable<ListInventoryResponse>;
248
+
249
+ deleteInventory(request: IdRequest): Observable<BoolResponse>;
250
+ }
251
+
252
+ export interface InventoryServiceController {
253
+ createInventory(request: CreateInventoryRequest): Promise<InventoryItem> | Observable<InventoryItem> | InventoryItem;
254
+
255
+ updateInventory(request: UpdateInventoryRequest): Promise<InventoryItem> | Observable<InventoryItem> | InventoryItem;
256
+
257
+ adjustQuantity(
258
+ request: AdjustInventoryQuantityRequest,
259
+ ): Promise<InventoryItem> | Observable<InventoryItem> | InventoryItem;
260
+
261
+ transferInventory(request: TransferInventoryRequest): Promise<BoolResponse> | Observable<BoolResponse> | BoolResponse;
262
+
263
+ getInventoryById(
264
+ request: GetInventoryByIdRequest,
265
+ ): Promise<InventoryItem> | Observable<InventoryItem> | InventoryItem;
266
+
267
+ listInventory(
268
+ request: ListInventoryRequest,
269
+ ): Promise<ListInventoryResponse> | Observable<ListInventoryResponse> | ListInventoryResponse;
270
+
271
+ deleteInventory(request: IdRequest): Promise<BoolResponse> | Observable<BoolResponse> | BoolResponse;
272
+ }
273
+
274
+ export function InventoryServiceControllerMethods() {
275
+ return function (constructor: Function) {
276
+ const grpcMethods: string[] = [
277
+ "createInventory",
278
+ "updateInventory",
279
+ "adjustQuantity",
280
+ "transferInventory",
281
+ "getInventoryById",
282
+ "listInventory",
283
+ "deleteInventory",
284
+ ];
285
+ for (const method of grpcMethods) {
286
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
287
+ GrpcMethod("InventoryService", method)(constructor.prototype[method], method, descriptor);
288
+ }
289
+ const grpcStreamMethods: string[] = [];
290
+ for (const method of grpcStreamMethods) {
291
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
292
+ GrpcStreamMethod("InventoryService", method)(constructor.prototype[method], method, descriptor);
293
+ }
294
+ };
295
+ }
296
+
297
+ export const INVENTORY_SERVICE_NAME = "InventoryService";
package/package.json CHANGED
@@ -1,28 +1,28 @@
1
- {
2
- "name": "@prodoctors/contracts",
3
- "version": "1.0.2",
4
- "description": "Protobuf definitions and generated Typescript types for ProDoctors",
5
- "main": "./dist/index.js",
6
- "types": "./dist/index.d.ts",
7
- "scripts": {
8
- "build": "tsc -p tsconfig.build.json",
9
- "generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
10
- },
11
- "files": [
12
- "proto",
13
- "gen",
14
- "dist"
15
- ],
16
- "publishConfig": {
17
- "access": "public"
18
- },
19
- "dependencies": {
20
- "@nestjs/microservices": "^11.1.15",
21
- "rxjs": "^7.8.2",
22
- "ts-proto": "^2.11.4"
23
- },
24
- "devDependencies": {
25
- "@types/node": "^25.3.5",
26
- "typescript": "^5.9.3"
27
- }
1
+ {
2
+ "name": "@prodoctors/contracts",
3
+ "version": "1.0.3",
4
+ "description": "Protobuf definitions and generated Typescript types for ProDoctors",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc -p tsconfig.build.json",
9
+ "generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
10
+ },
11
+ "files": [
12
+ "proto",
13
+ "gen",
14
+ "dist"
15
+ ],
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "dependencies": {
20
+ "@nestjs/microservices": "^11.1.15",
21
+ "rxjs": "^7.8.2",
22
+ "ts-proto": "^2.11.4"
23
+ },
24
+ "devDependencies": {
25
+ "@types/node": "^25.3.5",
26
+ "typescript": "^5.9.3"
27
+ }
28
28
  }
@@ -1,24 +1,22 @@
1
-
2
- syntax = "proto3";
3
-
4
- package account.v1;
5
-
6
- import "auth.proto";
7
-
8
- // Account service for managing user profiles
9
- service AccountService {
10
- // Get user profile information
11
- rpc GetProfile (GetAccountRequest) returns (GetAccountResponse);
12
- }
13
-
14
- message GetAccountRequest {
15
- string id = 1;
16
- }
17
-
18
- message GetAccountResponse {
19
- string id = 1;
20
- string name = 2;
21
- string username = 3;
22
- auth.v1.Role role = 4;
23
- string branch_id = 5;
1
+
2
+ syntax = "proto3";
3
+
4
+ package account.v1;
5
+
6
+ // Account service for managing user profiles
7
+ service AccountService {
8
+ // Get user profile information
9
+ rpc GetProfile (GetAccountRequest) returns (GetAccountResponse);
10
+ }
11
+
12
+ message GetAccountRequest {
13
+ string id = 1;
14
+ }
15
+
16
+ message GetAccountResponse {
17
+ string id = 1;
18
+ string name = 2;
19
+ string username = 3;
20
+ string role = 4;
21
+ string branch_id = 5;
24
22
  }
package/proto/auth.proto CHANGED
@@ -1,82 +1,72 @@
1
- syntax = "proto3";
2
-
3
- package auth.v1;
4
-
5
- // Authentication service for sending and verifying OTPs
6
- service AuthService {
7
- // Authoriration user
8
- rpc Login (LoginRequest) returns (LoginResponse);
9
-
10
- // Registration user
11
- rpc Register (RegisterRequest) returns (RegisterResponse);
12
-
13
- // Send OTP to the user
14
- rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);
15
-
16
- // Verify the OTP sent to the user
17
- rpc VerifyOtp (VerifyOtpRequest) returns (VerifyOtpResponse);
18
-
19
- // Refersh token
20
- rpc Refresh (RefreshRequest) returns (RefreshResponse);
21
- }
22
-
23
- message LoginRequest {
24
- string username = 1;
25
- string password = 2;
26
- }
27
-
28
- message LoginResponse {
29
- string access_token = 1;
30
- string refresh_token = 2;
31
- }
32
-
33
- message RegisterRequest {
34
- string name = 1;
35
- string username = 2;
36
- string password = 3;
37
- optional Role role = 4;
38
- optional string branch_id = 5;
39
- }
40
-
41
- message RegisterResponse {
42
- bool ok = 1;
43
- }
44
-
45
- message SendOtpRequest {
46
- string identifier = 1;
47
- string type = 2;
48
- }
49
-
50
- message SendOtpResponse {
51
- bool ok = 1;
52
- }
53
-
54
- message VerifyOtpRequest {
55
- string identifier = 1;
56
- string type = 2;
57
- string code = 3;
58
- }
59
-
60
- message VerifyOtpResponse {
61
- string access_token = 1;
62
- string refresh_token = 2;
63
- }
64
-
65
- message RefreshRequest {
66
- string refresh_token = 1;
67
- }
68
-
69
- message RefreshResponse {
70
- string access_token = 1;
71
- string refresh_token = 2;
72
- }
73
-
74
- enum Role {
75
- USER = 0;
76
- SUPER_ADMIN = 1;
77
- MANAGER = 2;
78
- PHARMACIST = 3;
79
- CASHIER = 4;
80
- INVENTORY_MANAGER = 5;
81
- AUDITOR = 6;
1
+ syntax = "proto3";
2
+
3
+ package auth.v1;
4
+
5
+ // Authentication service for sending and verifying OTPs
6
+ service AuthService {
7
+ // Authoriration user
8
+ rpc Login (LoginRequest) returns (LoginResponse);
9
+
10
+ // Registration user
11
+ rpc Register (RegisterRequest) returns (RegisterResponse);
12
+
13
+ // Send OTP to the user
14
+ rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);
15
+
16
+ // Verify the OTP sent to the user
17
+ rpc VerifyOtp (VerifyOtpRequest) returns (VerifyOtpResponse);
18
+
19
+ // Refersh token
20
+ rpc Refresh (RefreshRequest) returns (RefreshResponse);
21
+ }
22
+
23
+ message LoginRequest {
24
+ string username = 1;
25
+ string password = 2;
26
+ }
27
+
28
+ message LoginResponse {
29
+ string access_token = 1;
30
+ string refresh_token = 2;
31
+ }
32
+
33
+ message RegisterRequest {
34
+ string name = 1;
35
+ string username = 2;
36
+ string password = 3;
37
+ optional string role = 4;
38
+ optional string branch_id = 5;
39
+ }
40
+
41
+ message RegisterResponse {
42
+ bool ok = 1;
43
+ }
44
+
45
+ message SendOtpRequest {
46
+ string identifier = 1;
47
+ string type = 2;
48
+ }
49
+
50
+ message SendOtpResponse {
51
+ bool ok = 1;
52
+ }
53
+
54
+ message VerifyOtpRequest {
55
+ string identifier = 1;
56
+ string type = 2;
57
+ string code = 3;
58
+ }
59
+
60
+ message VerifyOtpResponse {
61
+ string access_token = 1;
62
+ string refresh_token = 2;
63
+ }
64
+
65
+ message RefreshRequest {
66
+ string refresh_token = 1;
67
+ }
68
+
69
+ message RefreshResponse {
70
+ string access_token = 1;
71
+ string refresh_token = 2;
82
72
  }
@@ -1,64 +1,64 @@
1
- syntax = "proto3";
2
-
3
- package branch.v1;
4
-
5
- // Branch service for managing branches
6
- service BranchService {
7
- // Create a new branch
8
- rpc CreateBranch (CreateBranchRequest) returns (CreateBranchResponse);
9
-
10
- // Get branch details by ID
11
- rpc GetBranch (GetBranchRequest) returns (GetBranchResponse);
12
-
13
- // Update branch details
14
- rpc UpdateBranch (UpdateBranchRequest) returns (UpdateBranchResponse);
15
-
16
- // Delete a branch by ID
17
- rpc DeleteBranch (DeleteBranchRequest) returns (DeleteBranchResponse);
18
- }
19
-
20
- message CreateBranchRequest {
21
- string name = 1;
22
- string phone = 2;
23
- string address = 3;
24
- string lat = 4;
25
- string lng = 5;
26
- }
27
-
28
- message CreateBranchResponse {
29
- string id = 1;
30
- }
31
-
32
- message GetBranchRequest {
33
- string id = 1;
34
- }
35
-
36
- message GetBranchResponse {
37
- string id = 1;
38
- string name = 2;
39
- string phone = 3;
40
- string address = 4;
41
- string lat = 5;
42
- string lng = 6;
43
- }
44
-
45
- message UpdateBranchRequest {
46
- string id = 1;
47
- string name = 2;
48
- string phone = 3;
49
- string address = 4;
50
- string lat = 5;
51
- string lng = 6;
52
- }
53
-
54
- message UpdateBranchResponse {
55
- bool ok = 1;
56
- }
57
-
58
- message DeleteBranchRequest {
59
- string id = 1;
60
- }
61
-
62
- message DeleteBranchResponse {
63
- bool ok = 1;
64
- }
1
+ syntax = "proto3";
2
+
3
+ package branch.v1;
4
+
5
+ // Branch service for managing branches
6
+ service BranchService {
7
+ // Create a new branch
8
+ rpc CreateBranch (CreateBranchRequest) returns (CreateBranchResponse);
9
+
10
+ // Get branch details by ID
11
+ rpc GetBranch (GetBranchRequest) returns (GetBranchResponse);
12
+
13
+ // Update branch details
14
+ rpc UpdateBranch (UpdateBranchRequest) returns (UpdateBranchResponse);
15
+
16
+ // Delete a branch by ID
17
+ rpc DeleteBranch (DeleteBranchRequest) returns (DeleteBranchResponse);
18
+ }
19
+
20
+ message CreateBranchRequest {
21
+ string name = 1;
22
+ string phone = 2;
23
+ optional string address = 3;
24
+ optional string lat = 4;
25
+ optional string lng = 5;
26
+ }
27
+
28
+ message CreateBranchResponse {
29
+ string id = 1;
30
+ }
31
+
32
+ message GetBranchRequest {
33
+ string id = 1;
34
+ }
35
+
36
+ message GetBranchResponse {
37
+ string id = 1;
38
+ string name = 2;
39
+ string phone = 3;
40
+ optional string address = 4;
41
+ optional string lat = 5;
42
+ optional string lng = 6;
43
+ }
44
+
45
+ message UpdateBranchRequest {
46
+ string id = 1;
47
+ string name = 2;
48
+ string phone = 3;
49
+ optional string address = 4;
50
+ optional string lat = 5;
51
+ optional string lng = 6;
52
+ }
53
+
54
+ message UpdateBranchResponse {
55
+ bool ok = 1;
56
+ }
57
+
58
+ message DeleteBranchRequest {
59
+ string id = 1;
60
+ }
61
+
62
+ message DeleteBranchResponse {
63
+ bool ok = 1;
64
+ }