@prodoctors/contracts 1.0.2 → 1.0.4

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,302 @@
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
+ }
88
+
89
+ message ProductBarcode {
90
+ string id = 1;
91
+ string product_id = 2;
92
+ string barcode = 3;
93
+ bool is_primary = 4;
94
+ optional string package_type = 5;
95
+ optional string note = 6;
96
+ google.protobuf.Timestamp created_at = 7;
97
+ google.protobuf.Timestamp updated_at = 8;
98
+ }
99
+
100
+ message ProductBatch {
101
+ string id = 1;
102
+ string product_id = 2;
103
+ string branch_id = 3;
104
+ string batch_number = 4;
105
+ google.protobuf.Timestamp expiry_date = 5;
106
+ optional google.protobuf.Timestamp manufacture_date = 6;
107
+ string purchase_price = 7;
108
+ string selling_price = 8;
109
+ int32 initial_quantity = 9;
110
+ int32 remaining_quantity = 10;
111
+ BatchStatus status = 11;
112
+ optional string purchase_item_id = 12;
113
+ optional Product product = 13;
114
+ google.protobuf.Timestamp created_at = 14;
115
+ google.protobuf.Timestamp updated_at = 15;
116
+ }
117
+
118
+ message StockMovement {
119
+ string id = 1;
120
+ string branch_id = 2;
121
+ string product_id = 3;
122
+ string product_batch_id = 4;
123
+ StockMovementType type = 5;
124
+ int32 quantity = 6;
125
+ int32 balance_before = 7;
126
+ int32 balance_after = 8;
127
+ optional string reference_type = 9;
128
+ optional string reference_id = 10;
129
+ optional string performed_by_id = 11;
130
+ optional string note = 12;
131
+ google.protobuf.Timestamp created_at = 13;
132
+ }
133
+
134
+ message CreateProductRequest {
135
+ string name = 1;
136
+ string sku = 2;
137
+ optional string barcode = 3;
138
+ optional string dosage = 4;
139
+ optional string description = 5;
140
+ ProductForm form = 6;
141
+ UnitType unit = 7;
142
+ optional bool requires_prescription = 8;
143
+ optional ProductStatus status = 9;
144
+ optional string brand_id = 10;
145
+ optional string category_id = 11;
146
+ optional string international_name_id = 12;
147
+ optional string manufacturer_id = 13;
148
+ string price = 14;
149
+ optional string cost_price = 15;
150
+ }
151
+
152
+ message UpdateProductRequest {
153
+ string id = 1;
154
+ optional string name = 2;
155
+ optional string sku = 3;
156
+ optional string barcode = 4;
157
+ optional string dosage = 5;
158
+ optional string description = 6;
159
+ optional ProductForm form = 7;
160
+ optional UnitType unit = 8;
161
+ optional bool requires_prescription = 9;
162
+ optional ProductStatus status = 10;
163
+ optional string brand_id = 11;
164
+ optional string category_id = 12;
165
+ optional string international_name_id = 13;
166
+ optional string manufacturer_id = 14;
167
+ optional string price = 15;
168
+ optional string cost_price = 16;
169
+ }
170
+
171
+ message ListProductsRequest {
172
+ common.v1.PaginationRequest pagination = 1;
173
+ optional string search = 2;
174
+ optional string brand_id = 3;
175
+ optional string category_id = 4;
176
+ optional string international_name_id = 5;
177
+ optional string manufacturer_id = 6;
178
+ optional ProductStatus status = 7;
179
+ }
180
+
181
+ message ListProductsResponse {
182
+ repeated Product items = 1;
183
+ common.v1.PaginationMeta meta = 2;
184
+ }
185
+
186
+ message CreateProductBarcodeRequest {
187
+ string product_id = 1;
188
+ string barcode = 2;
189
+ optional bool is_primary = 3;
190
+ optional string package_type = 4;
191
+ optional string note = 5;
192
+ }
193
+
194
+ message UpdateProductBarcodeRequest {
195
+ string id = 1;
196
+ optional string barcode = 2;
197
+ optional bool is_primary = 3;
198
+ optional string package_type = 4;
199
+ optional string note = 5;
200
+ }
201
+
202
+ message ListProductBarcodesResponse {
203
+ repeated ProductBarcode items = 1;
204
+ }
205
+
206
+ message CreateProductBatchRequest {
207
+ string product_id = 1;
208
+ string branch_id = 2;
209
+ string batch_number = 3;
210
+ google.protobuf.Timestamp expiry_date = 4;
211
+ optional google.protobuf.Timestamp manufacture_date = 5;
212
+ string purchase_price = 6;
213
+ string selling_price = 7;
214
+ int32 initial_quantity = 8;
215
+ optional int32 remaining_quantity = 9;
216
+ optional BatchStatus status = 10;
217
+ optional string purchase_item_id = 11;
218
+ }
219
+
220
+ message UpdateProductBatchRequest {
221
+ string id = 1;
222
+ optional string batch_number = 2;
223
+ optional google.protobuf.Timestamp expiry_date = 3;
224
+ optional google.protobuf.Timestamp manufacture_date = 4;
225
+ optional string purchase_price = 5;
226
+ optional string selling_price = 6;
227
+ optional int32 initial_quantity = 7;
228
+ optional int32 remaining_quantity = 8;
229
+ optional BatchStatus status = 9;
230
+ }
231
+
232
+ message ListProductBatchesRequest {
233
+ common.v1.PaginationRequest pagination = 1;
234
+ optional string branch_id = 2;
235
+ optional string product_id = 3;
236
+ optional string batch_number = 4;
237
+ optional BatchStatus status = 5;
238
+ optional bool low_stock_only = 6;
239
+ optional bool expiring_soon_only = 7;
240
+ }
241
+
242
+ message ListProductBatchesResponse {
243
+ repeated ProductBatch items = 1;
244
+ common.v1.PaginationMeta meta = 2;
245
+ }
246
+
247
+ message CreateStockMovementRequest {
248
+ string branch_id = 1;
249
+ string product_id = 2;
250
+ string product_batch_id = 3;
251
+ StockMovementType type = 4;
252
+ int32 quantity = 5;
253
+ int32 balance_before = 6;
254
+ int32 balance_after = 7;
255
+ optional string reference_type = 8;
256
+ optional string reference_id = 9;
257
+ optional string performed_by_id = 10;
258
+ optional string note = 11;
259
+ }
260
+
261
+ message ListStockMovementsRequest {
262
+ common.v1.PaginationRequest pagination = 1;
263
+ optional string branch_id = 2;
264
+ optional string product_id = 3;
265
+ optional string product_batch_id = 4;
266
+ optional StockMovementType type = 5;
267
+ }
268
+
269
+ message ListStockMovementsResponse {
270
+ repeated StockMovement items = 1;
271
+ common.v1.PaginationMeta meta = 2;
272
+ }
273
+
274
+ service ProductService {
275
+ rpc CreateProduct(CreateProductRequest) returns (Product);
276
+ rpc UpdateProduct(UpdateProductRequest) returns (Product);
277
+ rpc GetProductById(common.v1.IdRequest) returns (Product);
278
+ rpc ListProducts(ListProductsRequest) returns (ListProductsResponse);
279
+ rpc DeleteProduct(common.v1.IdRequest) returns (common.v1.BoolResponse);
280
+ }
281
+
282
+ service ProductBarcodeService {
283
+ rpc CreateProductBarcode(CreateProductBarcodeRequest) returns (ProductBarcode);
284
+ rpc UpdateProductBarcode(UpdateProductBarcodeRequest) returns (ProductBarcode);
285
+ rpc GetProductBarcodeById(common.v1.IdRequest) returns (ProductBarcode);
286
+ rpc ListProductBarcodes(common.v1.IdRequest) returns (ListProductBarcodesResponse);
287
+ rpc DeleteProductBarcode(common.v1.IdRequest) returns (common.v1.BoolResponse);
288
+ }
289
+
290
+ service ProductBatchService {
291
+ rpc CreateProductBatch(CreateProductBatchRequest) returns (ProductBatch);
292
+ rpc UpdateProductBatch(UpdateProductBatchRequest) returns (ProductBatch);
293
+ rpc GetProductBatchById(common.v1.IdRequest) returns (ProductBatch);
294
+ rpc ListProductBatches(ListProductBatchesRequest) returns (ListProductBatchesResponse);
295
+ rpc DeleteProductBatch(common.v1.IdRequest) returns (common.v1.BoolResponse);
296
+ }
297
+
298
+ service StockMovementService {
299
+ rpc CreateStockMovement(CreateStockMovementRequest) returns (StockMovement);
300
+ rpc GetStockMovementById(common.v1.IdRequest) returns (StockMovement);
301
+ rpc ListStockMovements(ListStockMovementsRequest) returns (ListStockMovementsResponse);
302
+ }
@@ -0,0 +1,103 @@
1
+ syntax = "proto3";
2
+
3
+ package partner.v1;
4
+
5
+ import "google/protobuf/timestamp.proto";
6
+ import "common.proto";
7
+
8
+ message Supplier {
9
+ string id = 1;
10
+ string name = 2;
11
+ optional string phone = 3;
12
+ optional string email = 4;
13
+ optional string address = 5;
14
+ optional string tax_number = 6;
15
+ bool is_active = 7;
16
+ optional string note = 8;
17
+ google.protobuf.Timestamp created_at = 9;
18
+ google.protobuf.Timestamp updated_at = 10;
19
+ }
20
+
21
+ message Customer {
22
+ string id = 1;
23
+ optional string full_name = 2;
24
+ optional string phone = 3;
25
+ optional string code = 4;
26
+ optional string branch_id = 5;
27
+ google.protobuf.Timestamp created_at = 6;
28
+ google.protobuf.Timestamp updated_at = 7;
29
+ }
30
+
31
+ message CreateSupplierRequest {
32
+ string name = 1;
33
+ optional string phone = 2;
34
+ optional string email = 3;
35
+ optional string address = 4;
36
+ optional string tax_number = 5;
37
+ optional bool is_active = 6;
38
+ optional string note = 7;
39
+ }
40
+
41
+ message UpdateSupplierRequest {
42
+ string id = 1;
43
+ optional string name = 2;
44
+ optional string phone = 3;
45
+ optional string email = 4;
46
+ optional string address = 5;
47
+ optional string tax_number = 6;
48
+ optional bool is_active = 7;
49
+ optional string note = 8;
50
+ }
51
+
52
+ message ListSuppliersRequest {
53
+ common.v1.PaginationRequest pagination = 1;
54
+ optional bool is_active = 2;
55
+ optional string search = 3;
56
+ }
57
+
58
+ message ListSuppliersResponse {
59
+ repeated Supplier items = 1;
60
+ common.v1.PaginationMeta meta = 2;
61
+ }
62
+
63
+ message CreateCustomerRequest {
64
+ optional string full_name = 1;
65
+ optional string phone = 2;
66
+ optional string code = 3;
67
+ optional string branch_id = 4;
68
+ }
69
+
70
+ message UpdateCustomerRequest {
71
+ string id = 1;
72
+ optional string full_name = 2;
73
+ optional string phone = 3;
74
+ optional string code = 4;
75
+ optional string branch_id = 5;
76
+ }
77
+
78
+ message ListCustomersRequest {
79
+ common.v1.PaginationRequest pagination = 1;
80
+ optional string branch_id = 2;
81
+ optional string search = 3;
82
+ }
83
+
84
+ message ListCustomersResponse {
85
+ repeated Customer items = 1;
86
+ common.v1.PaginationMeta meta = 2;
87
+ }
88
+
89
+ service SupplierService {
90
+ rpc CreateSupplier(CreateSupplierRequest) returns (Supplier);
91
+ rpc UpdateSupplier(UpdateSupplierRequest) returns (Supplier);
92
+ rpc GetSupplierById(common.v1.IdRequest) returns (Supplier);
93
+ rpc ListSuppliers(ListSuppliersRequest) returns (ListSuppliersResponse);
94
+ rpc DeleteSupplier(common.v1.IdRequest) returns (common.v1.BoolResponse);
95
+ }
96
+
97
+ service CustomerService {
98
+ rpc CreateCustomer(CreateCustomerRequest) returns (Customer);
99
+ rpc UpdateCustomer(UpdateCustomerRequest) returns (Customer);
100
+ rpc GetCustomerById(common.v1.IdRequest) returns (Customer);
101
+ rpc ListCustomers(ListCustomersRequest) returns (ListCustomersResponse);
102
+ rpc DeleteCustomer(common.v1.IdRequest) returns (common.v1.BoolResponse);
103
+ }
@@ -0,0 +1,105 @@
1
+ syntax = "proto3";
2
+
3
+ package purchase.v1;
4
+
5
+ import "google/protobuf/timestamp.proto";
6
+ import "common.proto";
7
+ import "partner.proto";
8
+ import "inventory.proto";
9
+
10
+ enum PurchaseStatus {
11
+ PURCHASE_STATUS_UNSPECIFIED = 0;
12
+ PURCHASE_STATUS_DRAFT = 1;
13
+ PURCHASE_STATUS_RECEIVED = 2;
14
+ PURCHASE_STATUS_CANCELLED = 3;
15
+ }
16
+
17
+ message PurchaseItem {
18
+ string id = 1;
19
+ string purchase_id = 2;
20
+ string product_id = 3;
21
+ string batch_number = 4;
22
+ google.protobuf.Timestamp expiry_date = 5;
23
+ optional google.protobuf.Timestamp manufacture_date = 6;
24
+ string purchase_price = 7;
25
+ string selling_price = 8;
26
+ int32 quantity = 9;
27
+ string total_amount = 10;
28
+ optional string batch_id = 11;
29
+ optional inventory.v1.Product product = 12;
30
+ google.protobuf.Timestamp created_at = 13;
31
+ google.protobuf.Timestamp updated_at = 14;
32
+ }
33
+
34
+ message Purchase {
35
+ string id = 1;
36
+ optional string invoice_number = 2;
37
+ PurchaseStatus status = 3;
38
+ string branch_id = 4;
39
+ string supplier_id = 5;
40
+ optional string received_by_id = 6;
41
+ google.protobuf.Timestamp purchase_date = 7;
42
+ string total_amount = 8;
43
+ optional string note = 9;
44
+ optional partner.v1.Supplier supplier = 10;
45
+ repeated PurchaseItem items = 11;
46
+ google.protobuf.Timestamp created_at = 12;
47
+ google.protobuf.Timestamp updated_at = 13;
48
+ }
49
+
50
+ message CreatePurchaseItemInput {
51
+ string product_id = 1;
52
+ string batch_number = 2;
53
+ google.protobuf.Timestamp expiry_date = 3;
54
+ optional google.protobuf.Timestamp manufacture_date = 4;
55
+ string purchase_price = 5;
56
+ string selling_price = 6;
57
+ int32 quantity = 7;
58
+ string total_amount = 8;
59
+ }
60
+
61
+ message CreatePurchaseRequest {
62
+ optional string invoice_number = 1;
63
+ optional PurchaseStatus status = 2;
64
+ string branch_id = 3;
65
+ string supplier_id = 4;
66
+ optional string received_by_id = 5;
67
+ optional google.protobuf.Timestamp purchase_date = 6;
68
+ optional string total_amount = 7;
69
+ optional string note = 8;
70
+ repeated CreatePurchaseItemInput items = 9;
71
+ }
72
+
73
+ message UpdatePurchaseRequest {
74
+ string id = 1;
75
+ optional string invoice_number = 2;
76
+ optional PurchaseStatus status = 3;
77
+ optional string branch_id = 4;
78
+ optional string supplier_id = 5;
79
+ optional string received_by_id = 6;
80
+ optional google.protobuf.Timestamp purchase_date = 7;
81
+ optional string total_amount = 8;
82
+ optional string note = 9;
83
+ }
84
+
85
+ message ListPurchasesRequest {
86
+ common.v1.PaginationRequest pagination = 1;
87
+ optional string branch_id = 2;
88
+ optional string supplier_id = 3;
89
+ optional string received_by_id = 4;
90
+ optional PurchaseStatus status = 5;
91
+ optional string search = 6;
92
+ }
93
+
94
+ message ListPurchasesResponse {
95
+ repeated Purchase items = 1;
96
+ common.v1.PaginationMeta meta = 2;
97
+ }
98
+
99
+ service PurchaseService {
100
+ rpc CreatePurchase(CreatePurchaseRequest) returns (Purchase);
101
+ rpc UpdatePurchase(UpdatePurchaseRequest) returns (Purchase);
102
+ rpc GetPurchaseById(common.v1.IdRequest) returns (Purchase);
103
+ rpc ListPurchases(ListPurchasesRequest) returns (ListPurchasesResponse);
104
+ rpc DeletePurchase(common.v1.IdRequest) returns (common.v1.BoolResponse);
105
+ }