@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,34 @@
1
+ syntax = "proto3";
2
+
3
+
4
+ package common.v1;
5
+
6
+ import "google/protobuf/timestamp.proto";
7
+
8
+ message Empty {}
9
+
10
+ message PaginationRequest {
11
+ int32 page = 1;
12
+ int32 limit = 2;
13
+ }
14
+
15
+ message PaginationMeta {
16
+ int32 page = 1;
17
+ int32 limit = 2;
18
+ int64 total = 3;
19
+ int32 total_pages = 4;
20
+ }
21
+
22
+ message IdRequest {
23
+ string id = 1;
24
+ }
25
+
26
+ message BoolResponse {
27
+ bool success = 1;
28
+ string message = 2;
29
+ }
30
+
31
+ message DateRange {
32
+ google.protobuf.Timestamp from = 1;
33
+ google.protobuf.Timestamp to = 2;
34
+ }
@@ -0,0 +1,170 @@
1
+ syntax = "proto3";
2
+
3
+ package inventory.v1;
4
+
5
+ import "google/protobuf/timestamp.proto";
6
+ import "common.proto";
7
+
8
+
9
+ message Branch {
10
+ string id = 1;
11
+ string name = 2;
12
+ string phone = 3;
13
+ optional string address = 4;
14
+ optional string lat = 5;
15
+ optional string lng = 6;
16
+ google.protobuf.Timestamp created_at = 7;
17
+ google.protobuf.Timestamp updated_at = 8;
18
+ }
19
+
20
+ message Product {
21
+ string id = 1;
22
+ string name = 2;
23
+ string sku = 3;
24
+ string barcode = 4;
25
+ string price = 5;
26
+ optional string cost_price = 6;
27
+ google.protobuf.Timestamp created_at = 7;
28
+ google.protobuf.Timestamp updated_at = 8;
29
+ }
30
+
31
+ message InventoryItem {
32
+ string id = 1;
33
+ string branch_id = 2;
34
+ string product_id = 3;
35
+ int32 quantity = 4;
36
+ int32 min_quantity = 5;
37
+ optional google.protobuf.Timestamp expire_at = 6;
38
+ optional string batch_number = 7;
39
+ Branch branch = 8;
40
+ Product product = 9;
41
+ google.protobuf.Timestamp created_at = 10;
42
+ google.protobuf.Timestamp updated_at = 11;
43
+ }
44
+
45
+ message CreateBranchRequest {
46
+ string name = 1;
47
+ optional string address = 2;
48
+ optional string phone = 3;
49
+ }
50
+
51
+ message UpdateBranchRequest {
52
+ string id = 1;
53
+ optional string name = 2;
54
+ optional string address = 3;
55
+ optional string phone = 4;
56
+ }
57
+
58
+ message ListBranchesResponse {
59
+ repeated Branch items = 1;
60
+ }
61
+
62
+ message CreateProductRequest {
63
+ string name = 1;
64
+ string sku = 2;
65
+ string barcode = 3;
66
+
67
+ /// Kirim narxi
68
+ string cost_price = 4;
69
+
70
+ /// Sotuv narxi
71
+ optional string price = 5;
72
+ }
73
+
74
+ message UpdateProductRequest {
75
+ string id = 1;
76
+ optional string name = 2;
77
+ optional string sku = 3;
78
+ optional string barcode = 4;
79
+ optional string price = 5;
80
+ optional string cost_price = 6;
81
+ }
82
+
83
+ message GetProductByIdRequest {
84
+ string id = 1;
85
+ }
86
+
87
+ message ListProductsRequest {
88
+ common.v1.PaginationRequest pagination = 1;
89
+ optional string search = 2;
90
+ }
91
+
92
+ message ListProductsResponse {
93
+ repeated Product items = 1;
94
+ common.v1.PaginationMeta meta = 2;
95
+ }
96
+
97
+ message CreateInventoryRequest {
98
+ string branch_id = 1;
99
+ string product_id = 2;
100
+ int32 quantity = 3;
101
+ int32 min_quantity = 4;
102
+ optional google.protobuf.Timestamp expire_at = 5;
103
+ optional string batch_number = 6;
104
+ }
105
+
106
+ message UpdateInventoryRequest {
107
+ string id = 1;
108
+ optional int32 quantity = 2;
109
+ optional int32 min_quantity = 3;
110
+ optional google.protobuf.Timestamp expire_at = 4;
111
+ optional string batch_number = 5;
112
+ }
113
+
114
+ message AdjustInventoryQuantityRequest {
115
+ string inventory_id = 1;
116
+ int32 quantity_change = 2;
117
+ string reason = 3;
118
+ }
119
+
120
+ message TransferInventoryRequest {
121
+ string product_id = 1;
122
+ string from_branch_id = 2;
123
+ string to_branch_id = 3;
124
+ int32 quantity = 4;
125
+ optional string batch_number = 5;
126
+ }
127
+
128
+ message GetInventoryByIdRequest {
129
+ string id = 1;
130
+ }
131
+
132
+ message ListInventoryRequest {
133
+ common.v1.PaginationRequest pagination = 1;
134
+ optional string branch_id = 2;
135
+ optional string product_id = 3;
136
+ optional string search = 4;
137
+ optional bool low_stock_only = 5;
138
+ optional bool expiring_soon_only = 6;
139
+ }
140
+
141
+ message ListInventoryResponse {
142
+ repeated InventoryItem items = 1;
143
+ common.v1.PaginationMeta meta = 2;
144
+ }
145
+
146
+ service BranchService {
147
+ rpc CreateBranch(CreateBranchRequest) returns (Branch);
148
+ rpc UpdateBranch(UpdateBranchRequest) returns (Branch);
149
+ rpc GetBranchById(common.v1.IdRequest) returns (Branch);
150
+ rpc ListBranches(common.v1.Empty) returns (ListBranchesResponse);
151
+ rpc DeleteBranch(common.v1.IdRequest) returns (common.v1.BoolResponse);
152
+ }
153
+
154
+ service ProductService {
155
+ rpc CreateProduct(CreateProductRequest) returns (Product);
156
+ rpc UpdateProduct(UpdateProductRequest) returns (Product);
157
+ rpc GetProductById(GetProductByIdRequest) returns (Product);
158
+ rpc ListProducts(ListProductsRequest) returns (ListProductsResponse);
159
+ rpc DeleteProduct(common.v1.IdRequest) returns (common.v1.BoolResponse);
160
+ }
161
+
162
+ service InventoryService {
163
+ rpc CreateInventory(CreateInventoryRequest) returns (InventoryItem);
164
+ rpc UpdateInventory(UpdateInventoryRequest) returns (InventoryItem);
165
+ rpc AdjustQuantity(AdjustInventoryQuantityRequest) returns (InventoryItem);
166
+ rpc TransferInventory(TransferInventoryRequest) returns (common.v1.BoolResponse);
167
+ rpc GetInventoryById(GetInventoryByIdRequest) returns (InventoryItem);
168
+ rpc ListInventory(ListInventoryRequest) returns (ListInventoryResponse);
169
+ rpc DeleteInventory(common.v1.IdRequest) returns (common.v1.BoolResponse);
170
+ }