@prodoctors/contracts 1.0.5 → 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/gen/inventory.ts +3 -0
- package/package.json +27 -27
- package/proto/inventory.proto +304 -304
package/gen/inventory.ts
CHANGED
|
@@ -96,6 +96,7 @@ export interface Product {
|
|
|
96
96
|
manufacturer?: Manufacturer | undefined;
|
|
97
97
|
createdAt: Timestamp | undefined;
|
|
98
98
|
updatedAt: Timestamp | undefined;
|
|
99
|
+
imageUrl?: string | undefined;
|
|
99
100
|
}
|
|
100
101
|
|
|
101
102
|
export interface ProductBarcode {
|
|
@@ -159,6 +160,7 @@ export interface CreateProductRequest {
|
|
|
159
160
|
manufacturerId?: string | undefined;
|
|
160
161
|
price: string;
|
|
161
162
|
costPrice?: string | undefined;
|
|
163
|
+
imageUrl?: string | undefined;
|
|
162
164
|
}
|
|
163
165
|
|
|
164
166
|
export interface UpdateProductRequest {
|
|
@@ -178,6 +180,7 @@ export interface UpdateProductRequest {
|
|
|
178
180
|
manufacturerId?: string | undefined;
|
|
179
181
|
price?: string | undefined;
|
|
180
182
|
costPrice?: string | undefined;
|
|
183
|
+
imageUrl?: string | undefined;
|
|
181
184
|
}
|
|
182
185
|
|
|
183
186
|
export interface ListProductsRequest {
|
package/package.json
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@prodoctors/contracts",
|
|
3
|
-
"version": "1.0.
|
|
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.6",
|
|
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
|
}
|
package/proto/inventory.proto
CHANGED
|
@@ -1,305 +1,305 @@
|
|
|
1
|
-
syntax = "proto3";
|
|
2
|
-
|
|
3
|
-
package inventory.v1;
|
|
4
|
-
|
|
5
|
-
import "google/protobuf/timestamp.proto";
|
|
6
|
-
import "common.proto";
|
|
7
|
-
import "catalog.proto";
|
|
8
|
-
|
|
9
|
-
enum ProductStatus {
|
|
10
|
-
PRODUCT_STATUS_UNSPECIFIED = 0;
|
|
11
|
-
PRODUCT_STATUS_ACTIVE = 1;
|
|
12
|
-
PRODUCT_STATUS_INACTIVE = 2;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
enum UnitType {
|
|
16
|
-
UNIT_TYPE_UNSPECIFIED = 0;
|
|
17
|
-
UNIT_TYPE_PIECE = 1;
|
|
18
|
-
UNIT_TYPE_BOX = 2;
|
|
19
|
-
UNIT_TYPE_BOTTLE = 3;
|
|
20
|
-
UNIT_TYPE_PACK = 4;
|
|
21
|
-
UNIT_TYPE_BLISTER = 5;
|
|
22
|
-
UNIT_TYPE_TUBE = 6;
|
|
23
|
-
UNIT_TYPE_AMPULE = 7;
|
|
24
|
-
UNIT_TYPE_VIAL = 8;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
enum ProductForm {
|
|
28
|
-
PRODUCT_FORM_UNSPECIFIED = 0;
|
|
29
|
-
PRODUCT_FORM_TABLET = 1;
|
|
30
|
-
PRODUCT_FORM_CAPSULE = 2;
|
|
31
|
-
PRODUCT_FORM_SYRUP = 3;
|
|
32
|
-
PRODUCT_FORM_INJECTION = 4;
|
|
33
|
-
PRODUCT_FORM_OINTMENT = 5;
|
|
34
|
-
PRODUCT_FORM_CREAM = 6;
|
|
35
|
-
PRODUCT_FORM_GEL = 7;
|
|
36
|
-
PRODUCT_FORM_DROPS = 8;
|
|
37
|
-
PRODUCT_FORM_SPRAY = 9;
|
|
38
|
-
PRODUCT_FORM_POWDER = 10;
|
|
39
|
-
PRODUCT_FORM_SOLUTION = 11;
|
|
40
|
-
PRODUCT_FORM_SUPPOSITORY = 12;
|
|
41
|
-
PRODUCT_FORM_OTHER = 13;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
enum BatchStatus {
|
|
45
|
-
BATCH_STATUS_UNSPECIFIED = 0;
|
|
46
|
-
BATCH_STATUS_ACTIVE = 1;
|
|
47
|
-
BATCH_STATUS_EXPIRED = 2;
|
|
48
|
-
BATCH_STATUS_DEPLETED = 3;
|
|
49
|
-
BATCH_STATUS_BLOCKED = 4;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
enum StockMovementType {
|
|
53
|
-
STOCK_MOVEMENT_TYPE_UNSPECIFIED = 0;
|
|
54
|
-
STOCK_MOVEMENT_TYPE_IN = 1;
|
|
55
|
-
STOCK_MOVEMENT_TYPE_OUT = 2;
|
|
56
|
-
STOCK_MOVEMENT_TYPE_RETURN_IN = 3;
|
|
57
|
-
STOCK_MOVEMENT_TYPE_RETURN_OUT = 4;
|
|
58
|
-
STOCK_MOVEMENT_TYPE_WRITE_OFF = 5;
|
|
59
|
-
STOCK_MOVEMENT_TYPE_ADJUSTMENT = 6;
|
|
60
|
-
STOCK_MOVEMENT_TYPE_TRANSFER_OUT = 7;
|
|
61
|
-
STOCK_MOVEMENT_TYPE_TRANSFER_IN = 8;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
message Product {
|
|
65
|
-
string id = 1;
|
|
66
|
-
string name = 2;
|
|
67
|
-
string sku = 3;
|
|
68
|
-
optional string barcode = 4;
|
|
69
|
-
optional string dosage = 5;
|
|
70
|
-
optional string description = 6;
|
|
71
|
-
ProductForm form = 7;
|
|
72
|
-
UnitType unit = 8;
|
|
73
|
-
bool requires_prescription = 9;
|
|
74
|
-
ProductStatus status = 10;
|
|
75
|
-
optional string brand_id = 11;
|
|
76
|
-
optional string category_id = 12;
|
|
77
|
-
optional string international_name_id = 13;
|
|
78
|
-
optional string manufacturer_id = 14;
|
|
79
|
-
string price = 15;
|
|
80
|
-
optional string cost_price = 16;
|
|
81
|
-
optional catalog.v1.Brand brand = 17;
|
|
82
|
-
optional catalog.v1.Category category = 18;
|
|
83
|
-
optional catalog.v1.InternationalName international_name = 19;
|
|
84
|
-
optional catalog.v1.Manufacturer manufacturer = 20;
|
|
85
|
-
google.protobuf.Timestamp created_at = 21;
|
|
86
|
-
google.protobuf.Timestamp updated_at = 22;
|
|
87
|
-
optional string image_url = 23;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
message ProductBarcode {
|
|
91
|
-
string id = 1;
|
|
92
|
-
string product_id = 2;
|
|
93
|
-
string barcode = 3;
|
|
94
|
-
bool is_primary = 4;
|
|
95
|
-
optional string package_type = 5;
|
|
96
|
-
optional string note = 6;
|
|
97
|
-
google.protobuf.Timestamp created_at = 7;
|
|
98
|
-
google.protobuf.Timestamp updated_at = 8;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
message ProductBatch {
|
|
102
|
-
string id = 1;
|
|
103
|
-
string product_id = 2;
|
|
104
|
-
string branch_id = 3;
|
|
105
|
-
string batch_number = 4;
|
|
106
|
-
google.protobuf.Timestamp expiry_date = 5;
|
|
107
|
-
optional google.protobuf.Timestamp manufacture_date = 6;
|
|
108
|
-
string purchase_price = 7;
|
|
109
|
-
string selling_price = 8;
|
|
110
|
-
int32 initial_quantity = 9;
|
|
111
|
-
int32 remaining_quantity = 10;
|
|
112
|
-
BatchStatus status = 11;
|
|
113
|
-
optional string purchase_item_id = 12;
|
|
114
|
-
optional Product product = 13;
|
|
115
|
-
google.protobuf.Timestamp created_at = 14;
|
|
116
|
-
google.protobuf.Timestamp updated_at = 15;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
message StockMovement {
|
|
120
|
-
string id = 1;
|
|
121
|
-
string branch_id = 2;
|
|
122
|
-
string product_id = 3;
|
|
123
|
-
string product_batch_id = 4;
|
|
124
|
-
StockMovementType type = 5;
|
|
125
|
-
int32 quantity = 6;
|
|
126
|
-
int32 balance_before = 7;
|
|
127
|
-
int32 balance_after = 8;
|
|
128
|
-
optional string reference_type = 9;
|
|
129
|
-
optional string reference_id = 10;
|
|
130
|
-
optional string performed_by_id = 11;
|
|
131
|
-
optional string note = 12;
|
|
132
|
-
google.protobuf.Timestamp created_at = 13;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
message CreateProductRequest {
|
|
136
|
-
string name = 1;
|
|
137
|
-
string sku = 2;
|
|
138
|
-
optional string barcode = 3;
|
|
139
|
-
optional string dosage = 4;
|
|
140
|
-
optional string description = 5;
|
|
141
|
-
ProductForm form = 6;
|
|
142
|
-
UnitType unit = 7;
|
|
143
|
-
optional bool requires_prescription = 8;
|
|
144
|
-
optional ProductStatus status = 9;
|
|
145
|
-
optional string brand_id = 10;
|
|
146
|
-
optional string category_id = 11;
|
|
147
|
-
optional string international_name_id = 12;
|
|
148
|
-
optional string manufacturer_id = 13;
|
|
149
|
-
string price = 14;
|
|
150
|
-
optional string cost_price = 15;
|
|
151
|
-
optional string image_url = 16;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
message UpdateProductRequest {
|
|
155
|
-
string id = 1;
|
|
156
|
-
optional string name = 2;
|
|
157
|
-
optional string sku = 3;
|
|
158
|
-
optional string barcode = 4;
|
|
159
|
-
optional string dosage = 5;
|
|
160
|
-
optional string description = 6;
|
|
161
|
-
optional ProductForm form = 7;
|
|
162
|
-
optional UnitType unit = 8;
|
|
163
|
-
optional bool requires_prescription = 9;
|
|
164
|
-
optional ProductStatus status = 10;
|
|
165
|
-
optional string brand_id = 11;
|
|
166
|
-
optional string category_id = 12;
|
|
167
|
-
optional string international_name_id = 13;
|
|
168
|
-
optional string manufacturer_id = 14;
|
|
169
|
-
optional string price = 15;
|
|
170
|
-
optional string cost_price = 16;
|
|
171
|
-
optional string image_url = 17;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
message ListProductsRequest {
|
|
175
|
-
common.v1.PaginationRequest pagination = 1;
|
|
176
|
-
optional string search = 2;
|
|
177
|
-
optional string brand_id = 3;
|
|
178
|
-
optional string category_id = 4;
|
|
179
|
-
optional string international_name_id = 5;
|
|
180
|
-
optional string manufacturer_id = 6;
|
|
181
|
-
optional ProductStatus status = 7;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
message ListProductsResponse {
|
|
185
|
-
repeated Product items = 1;
|
|
186
|
-
common.v1.PaginationMeta meta = 2;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
message CreateProductBarcodeRequest {
|
|
190
|
-
string product_id = 1;
|
|
191
|
-
string barcode = 2;
|
|
192
|
-
optional bool is_primary = 3;
|
|
193
|
-
optional string package_type = 4;
|
|
194
|
-
optional string note = 5;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
message UpdateProductBarcodeRequest {
|
|
198
|
-
string id = 1;
|
|
199
|
-
optional string barcode = 2;
|
|
200
|
-
optional bool is_primary = 3;
|
|
201
|
-
optional string package_type = 4;
|
|
202
|
-
optional string note = 5;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
message ListProductBarcodesResponse {
|
|
206
|
-
repeated ProductBarcode items = 1;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
message CreateProductBatchRequest {
|
|
210
|
-
string product_id = 1;
|
|
211
|
-
string branch_id = 2;
|
|
212
|
-
string batch_number = 3;
|
|
213
|
-
google.protobuf.Timestamp expiry_date = 4;
|
|
214
|
-
optional google.protobuf.Timestamp manufacture_date = 5;
|
|
215
|
-
string purchase_price = 6;
|
|
216
|
-
string selling_price = 7;
|
|
217
|
-
int32 initial_quantity = 8;
|
|
218
|
-
optional int32 remaining_quantity = 9;
|
|
219
|
-
optional BatchStatus status = 10;
|
|
220
|
-
optional string purchase_item_id = 11;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
message UpdateProductBatchRequest {
|
|
224
|
-
string id = 1;
|
|
225
|
-
optional string batch_number = 2;
|
|
226
|
-
optional google.protobuf.Timestamp expiry_date = 3;
|
|
227
|
-
optional google.protobuf.Timestamp manufacture_date = 4;
|
|
228
|
-
optional string purchase_price = 5;
|
|
229
|
-
optional string selling_price = 6;
|
|
230
|
-
optional int32 initial_quantity = 7;
|
|
231
|
-
optional int32 remaining_quantity = 8;
|
|
232
|
-
optional BatchStatus status = 9;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
message ListProductBatchesRequest {
|
|
236
|
-
common.v1.PaginationRequest pagination = 1;
|
|
237
|
-
optional string branch_id = 2;
|
|
238
|
-
optional string product_id = 3;
|
|
239
|
-
optional string batch_number = 4;
|
|
240
|
-
optional BatchStatus status = 5;
|
|
241
|
-
optional bool low_stock_only = 6;
|
|
242
|
-
optional bool expiring_soon_only = 7;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
message ListProductBatchesResponse {
|
|
246
|
-
repeated ProductBatch items = 1;
|
|
247
|
-
common.v1.PaginationMeta meta = 2;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
message CreateStockMovementRequest {
|
|
251
|
-
string branch_id = 1;
|
|
252
|
-
string product_id = 2;
|
|
253
|
-
string product_batch_id = 3;
|
|
254
|
-
StockMovementType type = 4;
|
|
255
|
-
int32 quantity = 5;
|
|
256
|
-
int32 balance_before = 6;
|
|
257
|
-
int32 balance_after = 7;
|
|
258
|
-
optional string reference_type = 8;
|
|
259
|
-
optional string reference_id = 9;
|
|
260
|
-
optional string performed_by_id = 10;
|
|
261
|
-
optional string note = 11;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
message ListStockMovementsRequest {
|
|
265
|
-
common.v1.PaginationRequest pagination = 1;
|
|
266
|
-
optional string branch_id = 2;
|
|
267
|
-
optional string product_id = 3;
|
|
268
|
-
optional string product_batch_id = 4;
|
|
269
|
-
optional StockMovementType type = 5;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
message ListStockMovementsResponse {
|
|
273
|
-
repeated StockMovement items = 1;
|
|
274
|
-
common.v1.PaginationMeta meta = 2;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
service ProductService {
|
|
278
|
-
rpc CreateProduct(CreateProductRequest) returns (Product);
|
|
279
|
-
rpc UpdateProduct(UpdateProductRequest) returns (Product);
|
|
280
|
-
rpc GetProductById(common.v1.IdRequest) returns (Product);
|
|
281
|
-
rpc ListProducts(ListProductsRequest) returns (ListProductsResponse);
|
|
282
|
-
rpc DeleteProduct(common.v1.IdRequest) returns (common.v1.BoolResponse);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
service ProductBarcodeService {
|
|
286
|
-
rpc CreateProductBarcode(CreateProductBarcodeRequest) returns (ProductBarcode);
|
|
287
|
-
rpc UpdateProductBarcode(UpdateProductBarcodeRequest) returns (ProductBarcode);
|
|
288
|
-
rpc GetProductBarcodeById(common.v1.IdRequest) returns (ProductBarcode);
|
|
289
|
-
rpc ListProductBarcodes(common.v1.IdRequest) returns (ListProductBarcodesResponse);
|
|
290
|
-
rpc DeleteProductBarcode(common.v1.IdRequest) returns (common.v1.BoolResponse);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
service ProductBatchService {
|
|
294
|
-
rpc CreateProductBatch(CreateProductBatchRequest) returns (ProductBatch);
|
|
295
|
-
rpc UpdateProductBatch(UpdateProductBatchRequest) returns (ProductBatch);
|
|
296
|
-
rpc GetProductBatchById(common.v1.IdRequest) returns (ProductBatch);
|
|
297
|
-
rpc ListProductBatches(ListProductBatchesRequest) returns (ListProductBatchesResponse);
|
|
298
|
-
rpc DeleteProductBatch(common.v1.IdRequest) returns (common.v1.BoolResponse);
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
service StockMovementService {
|
|
302
|
-
rpc CreateStockMovement(CreateStockMovementRequest) returns (StockMovement);
|
|
303
|
-
rpc GetStockMovementById(common.v1.IdRequest) returns (StockMovement);
|
|
304
|
-
rpc ListStockMovements(ListStockMovementsRequest) returns (ListStockMovementsResponse);
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package inventory.v1;
|
|
4
|
+
|
|
5
|
+
import "google/protobuf/timestamp.proto";
|
|
6
|
+
import "common.proto";
|
|
7
|
+
import "catalog.proto";
|
|
8
|
+
|
|
9
|
+
enum ProductStatus {
|
|
10
|
+
PRODUCT_STATUS_UNSPECIFIED = 0;
|
|
11
|
+
PRODUCT_STATUS_ACTIVE = 1;
|
|
12
|
+
PRODUCT_STATUS_INACTIVE = 2;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
enum UnitType {
|
|
16
|
+
UNIT_TYPE_UNSPECIFIED = 0;
|
|
17
|
+
UNIT_TYPE_PIECE = 1;
|
|
18
|
+
UNIT_TYPE_BOX = 2;
|
|
19
|
+
UNIT_TYPE_BOTTLE = 3;
|
|
20
|
+
UNIT_TYPE_PACK = 4;
|
|
21
|
+
UNIT_TYPE_BLISTER = 5;
|
|
22
|
+
UNIT_TYPE_TUBE = 6;
|
|
23
|
+
UNIT_TYPE_AMPULE = 7;
|
|
24
|
+
UNIT_TYPE_VIAL = 8;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
enum ProductForm {
|
|
28
|
+
PRODUCT_FORM_UNSPECIFIED = 0;
|
|
29
|
+
PRODUCT_FORM_TABLET = 1;
|
|
30
|
+
PRODUCT_FORM_CAPSULE = 2;
|
|
31
|
+
PRODUCT_FORM_SYRUP = 3;
|
|
32
|
+
PRODUCT_FORM_INJECTION = 4;
|
|
33
|
+
PRODUCT_FORM_OINTMENT = 5;
|
|
34
|
+
PRODUCT_FORM_CREAM = 6;
|
|
35
|
+
PRODUCT_FORM_GEL = 7;
|
|
36
|
+
PRODUCT_FORM_DROPS = 8;
|
|
37
|
+
PRODUCT_FORM_SPRAY = 9;
|
|
38
|
+
PRODUCT_FORM_POWDER = 10;
|
|
39
|
+
PRODUCT_FORM_SOLUTION = 11;
|
|
40
|
+
PRODUCT_FORM_SUPPOSITORY = 12;
|
|
41
|
+
PRODUCT_FORM_OTHER = 13;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
enum BatchStatus {
|
|
45
|
+
BATCH_STATUS_UNSPECIFIED = 0;
|
|
46
|
+
BATCH_STATUS_ACTIVE = 1;
|
|
47
|
+
BATCH_STATUS_EXPIRED = 2;
|
|
48
|
+
BATCH_STATUS_DEPLETED = 3;
|
|
49
|
+
BATCH_STATUS_BLOCKED = 4;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
enum StockMovementType {
|
|
53
|
+
STOCK_MOVEMENT_TYPE_UNSPECIFIED = 0;
|
|
54
|
+
STOCK_MOVEMENT_TYPE_IN = 1;
|
|
55
|
+
STOCK_MOVEMENT_TYPE_OUT = 2;
|
|
56
|
+
STOCK_MOVEMENT_TYPE_RETURN_IN = 3;
|
|
57
|
+
STOCK_MOVEMENT_TYPE_RETURN_OUT = 4;
|
|
58
|
+
STOCK_MOVEMENT_TYPE_WRITE_OFF = 5;
|
|
59
|
+
STOCK_MOVEMENT_TYPE_ADJUSTMENT = 6;
|
|
60
|
+
STOCK_MOVEMENT_TYPE_TRANSFER_OUT = 7;
|
|
61
|
+
STOCK_MOVEMENT_TYPE_TRANSFER_IN = 8;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
message Product {
|
|
65
|
+
string id = 1;
|
|
66
|
+
string name = 2;
|
|
67
|
+
string sku = 3;
|
|
68
|
+
optional string barcode = 4;
|
|
69
|
+
optional string dosage = 5;
|
|
70
|
+
optional string description = 6;
|
|
71
|
+
ProductForm form = 7;
|
|
72
|
+
UnitType unit = 8;
|
|
73
|
+
bool requires_prescription = 9;
|
|
74
|
+
ProductStatus status = 10;
|
|
75
|
+
optional string brand_id = 11;
|
|
76
|
+
optional string category_id = 12;
|
|
77
|
+
optional string international_name_id = 13;
|
|
78
|
+
optional string manufacturer_id = 14;
|
|
79
|
+
string price = 15;
|
|
80
|
+
optional string cost_price = 16;
|
|
81
|
+
optional catalog.v1.Brand brand = 17;
|
|
82
|
+
optional catalog.v1.Category category = 18;
|
|
83
|
+
optional catalog.v1.InternationalName international_name = 19;
|
|
84
|
+
optional catalog.v1.Manufacturer manufacturer = 20;
|
|
85
|
+
google.protobuf.Timestamp created_at = 21;
|
|
86
|
+
google.protobuf.Timestamp updated_at = 22;
|
|
87
|
+
optional string image_url = 23;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
message ProductBarcode {
|
|
91
|
+
string id = 1;
|
|
92
|
+
string product_id = 2;
|
|
93
|
+
string barcode = 3;
|
|
94
|
+
bool is_primary = 4;
|
|
95
|
+
optional string package_type = 5;
|
|
96
|
+
optional string note = 6;
|
|
97
|
+
google.protobuf.Timestamp created_at = 7;
|
|
98
|
+
google.protobuf.Timestamp updated_at = 8;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
message ProductBatch {
|
|
102
|
+
string id = 1;
|
|
103
|
+
string product_id = 2;
|
|
104
|
+
string branch_id = 3;
|
|
105
|
+
string batch_number = 4;
|
|
106
|
+
google.protobuf.Timestamp expiry_date = 5;
|
|
107
|
+
optional google.protobuf.Timestamp manufacture_date = 6;
|
|
108
|
+
string purchase_price = 7;
|
|
109
|
+
string selling_price = 8;
|
|
110
|
+
int32 initial_quantity = 9;
|
|
111
|
+
int32 remaining_quantity = 10;
|
|
112
|
+
BatchStatus status = 11;
|
|
113
|
+
optional string purchase_item_id = 12;
|
|
114
|
+
optional Product product = 13;
|
|
115
|
+
google.protobuf.Timestamp created_at = 14;
|
|
116
|
+
google.protobuf.Timestamp updated_at = 15;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
message StockMovement {
|
|
120
|
+
string id = 1;
|
|
121
|
+
string branch_id = 2;
|
|
122
|
+
string product_id = 3;
|
|
123
|
+
string product_batch_id = 4;
|
|
124
|
+
StockMovementType type = 5;
|
|
125
|
+
int32 quantity = 6;
|
|
126
|
+
int32 balance_before = 7;
|
|
127
|
+
int32 balance_after = 8;
|
|
128
|
+
optional string reference_type = 9;
|
|
129
|
+
optional string reference_id = 10;
|
|
130
|
+
optional string performed_by_id = 11;
|
|
131
|
+
optional string note = 12;
|
|
132
|
+
google.protobuf.Timestamp created_at = 13;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
message CreateProductRequest {
|
|
136
|
+
string name = 1;
|
|
137
|
+
string sku = 2;
|
|
138
|
+
optional string barcode = 3;
|
|
139
|
+
optional string dosage = 4;
|
|
140
|
+
optional string description = 5;
|
|
141
|
+
ProductForm form = 6;
|
|
142
|
+
UnitType unit = 7;
|
|
143
|
+
optional bool requires_prescription = 8;
|
|
144
|
+
optional ProductStatus status = 9;
|
|
145
|
+
optional string brand_id = 10;
|
|
146
|
+
optional string category_id = 11;
|
|
147
|
+
optional string international_name_id = 12;
|
|
148
|
+
optional string manufacturer_id = 13;
|
|
149
|
+
string price = 14;
|
|
150
|
+
optional string cost_price = 15;
|
|
151
|
+
optional string image_url = 16;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
message UpdateProductRequest {
|
|
155
|
+
string id = 1;
|
|
156
|
+
optional string name = 2;
|
|
157
|
+
optional string sku = 3;
|
|
158
|
+
optional string barcode = 4;
|
|
159
|
+
optional string dosage = 5;
|
|
160
|
+
optional string description = 6;
|
|
161
|
+
optional ProductForm form = 7;
|
|
162
|
+
optional UnitType unit = 8;
|
|
163
|
+
optional bool requires_prescription = 9;
|
|
164
|
+
optional ProductStatus status = 10;
|
|
165
|
+
optional string brand_id = 11;
|
|
166
|
+
optional string category_id = 12;
|
|
167
|
+
optional string international_name_id = 13;
|
|
168
|
+
optional string manufacturer_id = 14;
|
|
169
|
+
optional string price = 15;
|
|
170
|
+
optional string cost_price = 16;
|
|
171
|
+
optional string image_url = 17;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
message ListProductsRequest {
|
|
175
|
+
common.v1.PaginationRequest pagination = 1;
|
|
176
|
+
optional string search = 2;
|
|
177
|
+
optional string brand_id = 3;
|
|
178
|
+
optional string category_id = 4;
|
|
179
|
+
optional string international_name_id = 5;
|
|
180
|
+
optional string manufacturer_id = 6;
|
|
181
|
+
optional ProductStatus status = 7;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
message ListProductsResponse {
|
|
185
|
+
repeated Product items = 1;
|
|
186
|
+
common.v1.PaginationMeta meta = 2;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
message CreateProductBarcodeRequest {
|
|
190
|
+
string product_id = 1;
|
|
191
|
+
string barcode = 2;
|
|
192
|
+
optional bool is_primary = 3;
|
|
193
|
+
optional string package_type = 4;
|
|
194
|
+
optional string note = 5;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
message UpdateProductBarcodeRequest {
|
|
198
|
+
string id = 1;
|
|
199
|
+
optional string barcode = 2;
|
|
200
|
+
optional bool is_primary = 3;
|
|
201
|
+
optional string package_type = 4;
|
|
202
|
+
optional string note = 5;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
message ListProductBarcodesResponse {
|
|
206
|
+
repeated ProductBarcode items = 1;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
message CreateProductBatchRequest {
|
|
210
|
+
string product_id = 1;
|
|
211
|
+
string branch_id = 2;
|
|
212
|
+
string batch_number = 3;
|
|
213
|
+
google.protobuf.Timestamp expiry_date = 4;
|
|
214
|
+
optional google.protobuf.Timestamp manufacture_date = 5;
|
|
215
|
+
string purchase_price = 6;
|
|
216
|
+
string selling_price = 7;
|
|
217
|
+
int32 initial_quantity = 8;
|
|
218
|
+
optional int32 remaining_quantity = 9;
|
|
219
|
+
optional BatchStatus status = 10;
|
|
220
|
+
optional string purchase_item_id = 11;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
message UpdateProductBatchRequest {
|
|
224
|
+
string id = 1;
|
|
225
|
+
optional string batch_number = 2;
|
|
226
|
+
optional google.protobuf.Timestamp expiry_date = 3;
|
|
227
|
+
optional google.protobuf.Timestamp manufacture_date = 4;
|
|
228
|
+
optional string purchase_price = 5;
|
|
229
|
+
optional string selling_price = 6;
|
|
230
|
+
optional int32 initial_quantity = 7;
|
|
231
|
+
optional int32 remaining_quantity = 8;
|
|
232
|
+
optional BatchStatus status = 9;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
message ListProductBatchesRequest {
|
|
236
|
+
common.v1.PaginationRequest pagination = 1;
|
|
237
|
+
optional string branch_id = 2;
|
|
238
|
+
optional string product_id = 3;
|
|
239
|
+
optional string batch_number = 4;
|
|
240
|
+
optional BatchStatus status = 5;
|
|
241
|
+
optional bool low_stock_only = 6;
|
|
242
|
+
optional bool expiring_soon_only = 7;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
message ListProductBatchesResponse {
|
|
246
|
+
repeated ProductBatch items = 1;
|
|
247
|
+
common.v1.PaginationMeta meta = 2;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
message CreateStockMovementRequest {
|
|
251
|
+
string branch_id = 1;
|
|
252
|
+
string product_id = 2;
|
|
253
|
+
string product_batch_id = 3;
|
|
254
|
+
StockMovementType type = 4;
|
|
255
|
+
int32 quantity = 5;
|
|
256
|
+
int32 balance_before = 6;
|
|
257
|
+
int32 balance_after = 7;
|
|
258
|
+
optional string reference_type = 8;
|
|
259
|
+
optional string reference_id = 9;
|
|
260
|
+
optional string performed_by_id = 10;
|
|
261
|
+
optional string note = 11;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
message ListStockMovementsRequest {
|
|
265
|
+
common.v1.PaginationRequest pagination = 1;
|
|
266
|
+
optional string branch_id = 2;
|
|
267
|
+
optional string product_id = 3;
|
|
268
|
+
optional string product_batch_id = 4;
|
|
269
|
+
optional StockMovementType type = 5;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
message ListStockMovementsResponse {
|
|
273
|
+
repeated StockMovement items = 1;
|
|
274
|
+
common.v1.PaginationMeta meta = 2;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
service ProductService {
|
|
278
|
+
rpc CreateProduct(CreateProductRequest) returns (Product);
|
|
279
|
+
rpc UpdateProduct(UpdateProductRequest) returns (Product);
|
|
280
|
+
rpc GetProductById(common.v1.IdRequest) returns (Product);
|
|
281
|
+
rpc ListProducts(ListProductsRequest) returns (ListProductsResponse);
|
|
282
|
+
rpc DeleteProduct(common.v1.IdRequest) returns (common.v1.BoolResponse);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
service ProductBarcodeService {
|
|
286
|
+
rpc CreateProductBarcode(CreateProductBarcodeRequest) returns (ProductBarcode);
|
|
287
|
+
rpc UpdateProductBarcode(UpdateProductBarcodeRequest) returns (ProductBarcode);
|
|
288
|
+
rpc GetProductBarcodeById(common.v1.IdRequest) returns (ProductBarcode);
|
|
289
|
+
rpc ListProductBarcodes(common.v1.IdRequest) returns (ListProductBarcodesResponse);
|
|
290
|
+
rpc DeleteProductBarcode(common.v1.IdRequest) returns (common.v1.BoolResponse);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
service ProductBatchService {
|
|
294
|
+
rpc CreateProductBatch(CreateProductBatchRequest) returns (ProductBatch);
|
|
295
|
+
rpc UpdateProductBatch(UpdateProductBatchRequest) returns (ProductBatch);
|
|
296
|
+
rpc GetProductBatchById(common.v1.IdRequest) returns (ProductBatch);
|
|
297
|
+
rpc ListProductBatches(ListProductBatchesRequest) returns (ListProductBatchesResponse);
|
|
298
|
+
rpc DeleteProductBatch(common.v1.IdRequest) returns (common.v1.BoolResponse);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
service StockMovementService {
|
|
302
|
+
rpc CreateStockMovement(CreateStockMovementRequest) returns (StockMovement);
|
|
303
|
+
rpc GetStockMovementById(common.v1.IdRequest) returns (StockMovement);
|
|
304
|
+
rpc ListStockMovements(ListStockMovementsRequest) returns (ListStockMovementsResponse);
|
|
305
305
|
}
|