@prodoctors/contracts 1.1.5 → 1.1.7

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.
@@ -8,4 +8,5 @@ export declare const PROTO_PATHS: {
8
8
  readonly PURCHASE: string;
9
9
  readonly SALES: string;
10
10
  readonly SHIFT: string;
11
+ readonly RESERVATION: string;
11
12
  };
@@ -12,4 +12,5 @@ exports.PROTO_PATHS = {
12
12
  PURCHASE: (0, path_1.join)(__dirname, "../../proto/purchase.proto"),
13
13
  SALES: (0, path_1.join)(__dirname, "../../proto/sales.proto"),
14
14
  SHIFT: (0, path_1.join)(__dirname, "../../proto/shift.proto"),
15
+ RESERVATION: (0, path_1.join)(__dirname, "../../proto/reservation.proto"),
15
16
  };
package/gen/inventory.ts CHANGED
@@ -135,6 +135,7 @@ export interface ProductBatch {
135
135
  purchasePackageQuantity: number;
136
136
  unitsPerPackage: number;
137
137
  sellingPricePerBaseUnit?: string | undefined;
138
+ reservedQuantity: number;
138
139
  }
139
140
 
140
141
  export interface StockMovement {
@@ -0,0 +1,253 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.5
4
+ // protoc v7.34.0
5
+ // source: reservation.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+ import { IdRequest, PaginationMeta, PaginationRequest } from "./common";
11
+ import { Timestamp } from "./google/protobuf/timestamp";
12
+
13
+ export const protobufPackage = "reservation.v1";
14
+
15
+ export enum WebReservationStatus {
16
+ WEB_RESERVATION_STATUS_UNSPECIFIED = 0,
17
+ WEB_RESERVATION_STATUS_CREATED = 1,
18
+ WEB_RESERVATION_STATUS_CONFIRMED = 2,
19
+ WEB_RESERVATION_STATUS_READY = 3,
20
+ WEB_RESERVATION_STATUS_COMPLETED = 4,
21
+ WEB_RESERVATION_STATUS_CANCELLED = 5,
22
+ WEB_RESERVATION_STATUS_EXPIRED = 6,
23
+ UNRECOGNIZED = -1,
24
+ }
25
+
26
+ export enum WebOrderStatus {
27
+ WEB_ORDER_STATUS_UNSPECIFIED = 0,
28
+ WEB_ORDER_STATUS_CREATED = 1,
29
+ WEB_ORDER_STATUS_CONFIRMED = 2,
30
+ WEB_ORDER_STATUS_READY = 3,
31
+ WEB_ORDER_STATUS_COMPLETED = 4,
32
+ WEB_ORDER_STATUS_CANCELLED = 5,
33
+ WEB_ORDER_STATUS_EXPIRED = 6,
34
+ UNRECOGNIZED = -1,
35
+ }
36
+
37
+ export interface WebReservation {
38
+ id: string;
39
+ reservationNumber: string;
40
+ status: WebReservationStatus;
41
+ productId: string;
42
+ productBatchId: string;
43
+ branchId: string;
44
+ customerId?: string | undefined;
45
+ orderId?: string | undefined;
46
+ productName: string;
47
+ pharmacyName: string;
48
+ customerName: string;
49
+ phone: string;
50
+ comment?: string | undefined;
51
+ city?: string | undefined;
52
+ quantity: number;
53
+ unitPrice: string;
54
+ totalPrice: string;
55
+ source: string;
56
+ createdAt: Timestamp | undefined;
57
+ expiresAt: Timestamp | undefined;
58
+ updatedAt: Timestamp | undefined;
59
+ }
60
+
61
+ export interface CreateWebReservationRequest {
62
+ productId: string;
63
+ productBatchId: string;
64
+ branchId: string;
65
+ orderId?: string | undefined;
66
+ productName: string;
67
+ pharmacyName: string;
68
+ customerName: string;
69
+ phone: string;
70
+ comment?: string | undefined;
71
+ city?: string | undefined;
72
+ quantity: number;
73
+ unitPrice: string;
74
+ totalPrice: string;
75
+ source?: string | undefined;
76
+ }
77
+
78
+ export interface ListWebReservationsRequest {
79
+ pagination: PaginationRequest | undefined;
80
+ status?: WebReservationStatus | undefined;
81
+ branchId?: string | undefined;
82
+ phone?: string | undefined;
83
+ reservationNumber?: string | undefined;
84
+ orderId?: string | undefined;
85
+ }
86
+
87
+ export interface ListWebReservationsResponse {
88
+ items: WebReservation[];
89
+ meta: PaginationMeta | undefined;
90
+ }
91
+
92
+ export interface UpdateWebReservationStatusRequest {
93
+ id: string;
94
+ status: WebReservationStatus;
95
+ }
96
+
97
+ export interface WebOrderItem {
98
+ id: string;
99
+ reservationId: string;
100
+ productId: string;
101
+ productBatchId: string;
102
+ branchId: string;
103
+ productName: string;
104
+ pharmacyName: string;
105
+ quantity: number;
106
+ unitPrice: string;
107
+ totalPrice: string;
108
+ status: WebReservationStatus;
109
+ }
110
+
111
+ export interface WebOrder {
112
+ id: string;
113
+ orderNumber: string;
114
+ status: WebOrderStatus;
115
+ customerName: string;
116
+ phone: string;
117
+ comment?: string | undefined;
118
+ city?: string | undefined;
119
+ source: string;
120
+ totalItems: number;
121
+ totalPrice: string;
122
+ createdAt: Timestamp | undefined;
123
+ expiresAt: Timestamp | undefined;
124
+ updatedAt: Timestamp | undefined;
125
+ items: WebOrderItem[];
126
+ }
127
+
128
+ export interface CreateWebOrderItem {
129
+ productId: string;
130
+ productBatchId: string;
131
+ branchId: string;
132
+ productName: string;
133
+ pharmacyName: string;
134
+ quantity: number;
135
+ unitPrice: string;
136
+ totalPrice: string;
137
+ }
138
+
139
+ export interface CreateWebOrderRequest {
140
+ customerName: string;
141
+ phone: string;
142
+ comment?: string | undefined;
143
+ city?: string | undefined;
144
+ source?: string | undefined;
145
+ items: CreateWebOrderItem[];
146
+ }
147
+
148
+ export interface ListWebOrdersRequest {
149
+ pagination: PaginationRequest | undefined;
150
+ status?: WebOrderStatus | undefined;
151
+ phone?: string | undefined;
152
+ orderNumber?: string | undefined;
153
+ branchId?: string | undefined;
154
+ }
155
+
156
+ export interface ListWebOrdersResponse {
157
+ items: WebOrder[];
158
+ meta: PaginationMeta | undefined;
159
+ }
160
+
161
+ export interface UpdateWebOrderStatusRequest {
162
+ id: string;
163
+ status: WebOrderStatus;
164
+ }
165
+
166
+ export const RESERVATION_V1_PACKAGE_NAME = "reservation.v1";
167
+
168
+ export interface WebReservationServiceClient {
169
+ createWebReservation(request: CreateWebReservationRequest): Observable<WebReservation>;
170
+
171
+ getWebReservation(request: IdRequest): Observable<WebReservation>;
172
+
173
+ listWebReservations(request: ListWebReservationsRequest): Observable<ListWebReservationsResponse>;
174
+
175
+ updateWebReservationStatus(request: UpdateWebReservationStatusRequest): Observable<WebReservation>;
176
+ }
177
+
178
+ export interface WebReservationServiceController {
179
+ createWebReservation(
180
+ request: CreateWebReservationRequest,
181
+ ): Promise<WebReservation> | Observable<WebReservation> | WebReservation;
182
+
183
+ getWebReservation(request: IdRequest): Promise<WebReservation> | Observable<WebReservation> | WebReservation;
184
+
185
+ listWebReservations(
186
+ request: ListWebReservationsRequest,
187
+ ): Promise<ListWebReservationsResponse> | Observable<ListWebReservationsResponse> | ListWebReservationsResponse;
188
+
189
+ updateWebReservationStatus(
190
+ request: UpdateWebReservationStatusRequest,
191
+ ): Promise<WebReservation> | Observable<WebReservation> | WebReservation;
192
+ }
193
+
194
+ export function WebReservationServiceControllerMethods() {
195
+ return function (constructor: Function) {
196
+ const grpcMethods: string[] = [
197
+ "createWebReservation",
198
+ "getWebReservation",
199
+ "listWebReservations",
200
+ "updateWebReservationStatus",
201
+ ];
202
+ for (const method of grpcMethods) {
203
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
204
+ GrpcMethod("WebReservationService", method)(constructor.prototype[method], method, descriptor);
205
+ }
206
+ const grpcStreamMethods: string[] = [];
207
+ for (const method of grpcStreamMethods) {
208
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
209
+ GrpcStreamMethod("WebReservationService", method)(constructor.prototype[method], method, descriptor);
210
+ }
211
+ };
212
+ }
213
+
214
+ export const WEB_RESERVATION_SERVICE_NAME = "WebReservationService";
215
+
216
+ export interface WebOrderServiceClient {
217
+ createWebOrder(request: CreateWebOrderRequest): Observable<WebOrder>;
218
+
219
+ getWebOrder(request: IdRequest): Observable<WebOrder>;
220
+
221
+ listWebOrders(request: ListWebOrdersRequest): Observable<ListWebOrdersResponse>;
222
+
223
+ updateWebOrderStatus(request: UpdateWebOrderStatusRequest): Observable<WebOrder>;
224
+ }
225
+
226
+ export interface WebOrderServiceController {
227
+ createWebOrder(request: CreateWebOrderRequest): Promise<WebOrder> | Observable<WebOrder> | WebOrder;
228
+
229
+ getWebOrder(request: IdRequest): Promise<WebOrder> | Observable<WebOrder> | WebOrder;
230
+
231
+ listWebOrders(
232
+ request: ListWebOrdersRequest,
233
+ ): Promise<ListWebOrdersResponse> | Observable<ListWebOrdersResponse> | ListWebOrdersResponse;
234
+
235
+ updateWebOrderStatus(request: UpdateWebOrderStatusRequest): Promise<WebOrder> | Observable<WebOrder> | WebOrder;
236
+ }
237
+
238
+ export function WebOrderServiceControllerMethods() {
239
+ return function (constructor: Function) {
240
+ const grpcMethods: string[] = ["createWebOrder", "getWebOrder", "listWebOrders", "updateWebOrderStatus"];
241
+ for (const method of grpcMethods) {
242
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
243
+ GrpcMethod("WebOrderService", method)(constructor.prototype[method], method, descriptor);
244
+ }
245
+ const grpcStreamMethods: string[] = [];
246
+ for (const method of grpcStreamMethods) {
247
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
248
+ GrpcStreamMethod("WebOrderService", method)(constructor.prototype[method], method, descriptor);
249
+ }
250
+ };
251
+ }
252
+
253
+ export const WEB_ORDER_SERVICE_NAME = "WebOrderService";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prodoctors/contracts",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "description": "Protobuf definitions and generated Typescript types for ProDoctors",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -25,4 +25,4 @@
25
25
  "@types/node": "^25.3.5",
26
26
  "typescript": "^5.9.3"
27
27
  }
28
- }
28
+ }
@@ -86,12 +86,12 @@ message Product {
86
86
  google.protobuf.Timestamp updated_at = 22;
87
87
  optional string image_url = 23;
88
88
  UnitType base_unit = 24;
89
- UnitType package_unit = 25;
90
- int32 units_per_package = 26;
91
- bool allow_fractional_sale = 27;
92
- optional string tax_mxik_code = 28;
93
- optional string tax_package_code = 29;
94
- }
89
+ UnitType package_unit = 25;
90
+ int32 units_per_package = 26;
91
+ bool allow_fractional_sale = 27;
92
+ optional string tax_mxik_code = 28;
93
+ optional string tax_package_code = 29;
94
+ }
95
95
 
96
96
  message ProductBarcode {
97
97
  string id = 1;
@@ -112,18 +112,19 @@ message ProductBatch {
112
112
  google.protobuf.Timestamp expiry_date = 5;
113
113
  optional google.protobuf.Timestamp manufacture_date = 6;
114
114
  string purchase_price = 7;
115
- string selling_price = 8;
116
- int32 initial_quantity = 9;
117
- int32 remaining_quantity = 10;
118
- BatchStatus status = 11;
119
- optional string purchase_item_id = 12;
120
- optional Product product = 13;
115
+ string selling_price = 8;
116
+ int32 initial_quantity = 9;
117
+ int32 remaining_quantity = 10;
118
+ BatchStatus status = 11;
119
+ optional string purchase_item_id = 12;
120
+ optional Product product = 13;
121
121
  google.protobuf.Timestamp created_at = 14;
122
122
  google.protobuf.Timestamp updated_at = 15;
123
- int32 purchase_package_quantity = 16;
124
- int32 units_per_package = 17;
125
- optional string selling_price_per_base_unit = 18;
126
- }
123
+ int32 purchase_package_quantity = 16;
124
+ int32 units_per_package = 17;
125
+ optional string selling_price_per_base_unit = 18;
126
+ int32 reserved_quantity = 19;
127
+ }
127
128
 
128
129
  message StockMovement {
129
130
  string id = 1;
@@ -159,12 +160,12 @@ message CreateProductRequest {
159
160
  optional string cost_price = 15;
160
161
  optional string image_url = 16;
161
162
  optional UnitType base_unit = 17;
162
- optional UnitType package_unit = 18;
163
- optional int32 units_per_package = 19;
164
- optional bool allow_fractional_sale = 20;
165
- optional string tax_mxik_code = 21;
166
- optional string tax_package_code = 22;
167
- }
163
+ optional UnitType package_unit = 18;
164
+ optional int32 units_per_package = 19;
165
+ optional bool allow_fractional_sale = 20;
166
+ optional string tax_mxik_code = 21;
167
+ optional string tax_package_code = 22;
168
+ }
168
169
 
169
170
  message UpdateProductRequest {
170
171
  string id = 1;
@@ -185,12 +186,12 @@ message UpdateProductRequest {
185
186
  optional string cost_price = 16;
186
187
  optional string image_url = 17;
187
188
  optional UnitType base_unit = 18;
188
- optional UnitType package_unit = 19;
189
- optional int32 units_per_package = 20;
190
- optional bool allow_fractional_sale = 21;
191
- optional string tax_mxik_code = 22;
192
- optional string tax_package_code = 23;
193
- }
189
+ optional UnitType package_unit = 19;
190
+ optional int32 units_per_package = 20;
191
+ optional bool allow_fractional_sale = 21;
192
+ optional string tax_mxik_code = 22;
193
+ optional string tax_package_code = 23;
194
+ }
194
195
 
195
196
  message ListProductsRequest {
196
197
  common.v1.PaginationRequest pagination = 1;
@@ -329,4 +330,4 @@ service StockMovementService {
329
330
  rpc CreateStockMovement(CreateStockMovementRequest) returns (StockMovement);
330
331
  rpc GetStockMovementById(common.v1.IdRequest) returns (StockMovement);
331
332
  rpc ListStockMovements(ListStockMovementsRequest) returns (ListStockMovementsResponse);
332
- }
333
+ }
@@ -0,0 +1,190 @@
1
+ syntax = "proto3";
2
+
3
+ package reservation.v1;
4
+
5
+ import "google/protobuf/timestamp.proto";
6
+ import "common.proto";
7
+
8
+ enum WebReservationStatus {
9
+ WEB_RESERVATION_STATUS_UNSPECIFIED = 0;
10
+ WEB_RESERVATION_STATUS_CREATED = 1;
11
+ WEB_RESERVATION_STATUS_CONFIRMED = 2;
12
+ WEB_RESERVATION_STATUS_READY = 3;
13
+ WEB_RESERVATION_STATUS_COMPLETED = 4;
14
+ WEB_RESERVATION_STATUS_CANCELLED = 5;
15
+ WEB_RESERVATION_STATUS_EXPIRED = 6;
16
+ }
17
+
18
+ enum WebOrderStatus {
19
+ WEB_ORDER_STATUS_UNSPECIFIED = 0;
20
+ WEB_ORDER_STATUS_CREATED = 1;
21
+ WEB_ORDER_STATUS_CONFIRMED = 2;
22
+ WEB_ORDER_STATUS_READY = 3;
23
+ WEB_ORDER_STATUS_COMPLETED = 4;
24
+ WEB_ORDER_STATUS_CANCELLED = 5;
25
+ WEB_ORDER_STATUS_EXPIRED = 6;
26
+ }
27
+
28
+ message WebReservation {
29
+ string id = 1;
30
+ string reservation_number = 2;
31
+ WebReservationStatus status = 3;
32
+
33
+ string product_id = 4;
34
+ string product_batch_id = 5;
35
+ string branch_id = 6;
36
+ optional string customer_id = 7;
37
+
38
+ optional string order_id = 8;
39
+
40
+ string product_name = 9;
41
+ string pharmacy_name = 10;
42
+
43
+ string customer_name = 11;
44
+ string phone = 12;
45
+ optional string comment = 13;
46
+ optional string city = 14;
47
+
48
+ int32 quantity = 15;
49
+ string unit_price = 16;
50
+ string total_price = 17;
51
+ string source = 18;
52
+
53
+ google.protobuf.Timestamp created_at = 19;
54
+ google.protobuf.Timestamp expires_at = 20;
55
+ google.protobuf.Timestamp updated_at = 21;
56
+ }
57
+
58
+ message CreateWebReservationRequest {
59
+ string product_id = 1;
60
+ string product_batch_id = 2;
61
+ string branch_id = 3;
62
+
63
+ optional string order_id = 4;
64
+
65
+ string product_name = 5;
66
+ string pharmacy_name = 6;
67
+
68
+ string customer_name = 7;
69
+ string phone = 8;
70
+ optional string comment = 9;
71
+ optional string city = 10;
72
+
73
+ int32 quantity = 11;
74
+ string unit_price = 12;
75
+ string total_price = 13;
76
+ optional string source = 14;
77
+ }
78
+
79
+ message ListWebReservationsRequest {
80
+ common.v1.PaginationRequest pagination = 1;
81
+ optional WebReservationStatus status = 2;
82
+ optional string branch_id = 3;
83
+ optional string phone = 4;
84
+ optional string reservation_number = 5;
85
+ optional string order_id = 6;
86
+ }
87
+
88
+ message ListWebReservationsResponse {
89
+ repeated WebReservation items = 1;
90
+ common.v1.PaginationMeta meta = 2;
91
+ }
92
+
93
+ message UpdateWebReservationStatusRequest {
94
+ string id = 1;
95
+ WebReservationStatus status = 2;
96
+ }
97
+
98
+ message WebOrderItem {
99
+ string id = 1;
100
+ string reservation_id = 2;
101
+
102
+ string product_id = 3;
103
+ string product_batch_id = 4;
104
+ string branch_id = 5;
105
+
106
+ string product_name = 6;
107
+ string pharmacy_name = 7;
108
+
109
+ int32 quantity = 8;
110
+ string unit_price = 9;
111
+ string total_price = 10;
112
+
113
+ WebReservationStatus status = 11;
114
+ }
115
+
116
+ message WebOrder {
117
+ string id = 1;
118
+ string order_number = 2;
119
+ WebOrderStatus status = 3;
120
+
121
+ string customer_name = 4;
122
+ string phone = 5;
123
+ optional string comment = 6;
124
+ optional string city = 7;
125
+
126
+ string source = 8;
127
+ int32 total_items = 9;
128
+ string total_price = 10;
129
+
130
+ google.protobuf.Timestamp created_at = 11;
131
+ google.protobuf.Timestamp expires_at = 12;
132
+ google.protobuf.Timestamp updated_at = 13;
133
+
134
+ repeated WebOrderItem items = 14;
135
+ }
136
+
137
+ message CreateWebOrderItem {
138
+ string product_id = 1;
139
+ string product_batch_id = 2;
140
+ string branch_id = 3;
141
+
142
+ string product_name = 4;
143
+ string pharmacy_name = 5;
144
+
145
+ int32 quantity = 6;
146
+ string unit_price = 7;
147
+ string total_price = 8;
148
+ }
149
+
150
+ message CreateWebOrderRequest {
151
+ string customer_name = 1;
152
+ string phone = 2;
153
+ optional string comment = 3;
154
+ optional string city = 4;
155
+ optional string source = 5;
156
+
157
+ repeated CreateWebOrderItem items = 6;
158
+ }
159
+
160
+ message ListWebOrdersRequest {
161
+ common.v1.PaginationRequest pagination = 1;
162
+ optional WebOrderStatus status = 2;
163
+ optional string phone = 3;
164
+ optional string order_number = 4;
165
+ optional string branch_id = 5;
166
+ }
167
+
168
+ message ListWebOrdersResponse {
169
+ repeated WebOrder items = 1;
170
+ common.v1.PaginationMeta meta = 2;
171
+ }
172
+
173
+ message UpdateWebOrderStatusRequest {
174
+ string id = 1;
175
+ WebOrderStatus status = 2;
176
+ }
177
+
178
+ service WebReservationService {
179
+ rpc CreateWebReservation(CreateWebReservationRequest) returns (WebReservation);
180
+ rpc GetWebReservation(common.v1.IdRequest) returns (WebReservation);
181
+ rpc ListWebReservations(ListWebReservationsRequest) returns (ListWebReservationsResponse);
182
+ rpc UpdateWebReservationStatus(UpdateWebReservationStatusRequest) returns (WebReservation);
183
+ }
184
+
185
+ service WebOrderService {
186
+ rpc CreateWebOrder(CreateWebOrderRequest) returns (WebOrder);
187
+ rpc GetWebOrder(common.v1.IdRequest) returns (WebOrder);
188
+ rpc ListWebOrders(ListWebOrdersRequest) returns (ListWebOrdersResponse);
189
+ rpc UpdateWebOrderStatus(UpdateWebOrderStatusRequest) returns (WebOrder);
190
+ }