@prodoctors/contracts 1.1.3 → 1.1.5
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/sales.ts +60 -0
- package/package.json +1 -1
- package/proto/sales.proto +53 -0
package/gen/sales.ts
CHANGED
|
@@ -23,6 +23,14 @@ export enum SaleStatus {
|
|
|
23
23
|
UNRECOGNIZED = -1,
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
export enum SaleSource {
|
|
27
|
+
SALE_SOURCE_UNSPECIFIED = 0,
|
|
28
|
+
SALE_SOURCE_POS = 1,
|
|
29
|
+
SALE_SOURCE_WEB = 2,
|
|
30
|
+
SALE_SOURCE_ADMIN = 3,
|
|
31
|
+
UNRECOGNIZED = -1,
|
|
32
|
+
}
|
|
33
|
+
|
|
26
34
|
export enum PaymentMethod {
|
|
27
35
|
PAYMENT_METHOD_UNSPECIFIED = 0,
|
|
28
36
|
PAYMENT_METHOD_CASH = 1,
|
|
@@ -81,6 +89,7 @@ export interface SaleOrder {
|
|
|
81
89
|
createdAt: Timestamp | undefined;
|
|
82
90
|
updatedAt: Timestamp | undefined;
|
|
83
91
|
shiftId?: string | undefined;
|
|
92
|
+
source: SaleSource;
|
|
84
93
|
}
|
|
85
94
|
|
|
86
95
|
export interface SaleReturnItem {
|
|
@@ -174,6 +183,7 @@ export interface CreateSaleOrderRequest {
|
|
|
174
183
|
soldAt?: Timestamp | undefined;
|
|
175
184
|
items: CreateSaleItemInput[];
|
|
176
185
|
shiftId?: string | undefined;
|
|
186
|
+
source?: SaleSource | undefined;
|
|
177
187
|
}
|
|
178
188
|
|
|
179
189
|
export interface UpdateSaleOrderRequest {
|
|
@@ -203,6 +213,7 @@ export interface ListSaleOrdersRequest {
|
|
|
203
213
|
status?: SaleStatus | undefined;
|
|
204
214
|
receiptNumber?: string | undefined;
|
|
205
215
|
shiftId?: string | undefined;
|
|
216
|
+
source?: SaleSource | undefined;
|
|
206
217
|
}
|
|
207
218
|
|
|
208
219
|
export interface ListSaleOrdersResponse {
|
|
@@ -210,6 +221,48 @@ export interface ListSaleOrdersResponse {
|
|
|
210
221
|
meta: PaginationMeta | undefined;
|
|
211
222
|
}
|
|
212
223
|
|
|
224
|
+
export interface CashierSalesSummaryRequest {
|
|
225
|
+
shiftId: string;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export interface CashierSalesPaymentSummary {
|
|
229
|
+
paymentMethod: PaymentMethod;
|
|
230
|
+
totalOrders: number;
|
|
231
|
+
totalAmount: string;
|
|
232
|
+
paidAmount: string;
|
|
233
|
+
changeAmount: string;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export interface CashierSalesProductSummary {
|
|
237
|
+
productId: string;
|
|
238
|
+
productName: string;
|
|
239
|
+
sku?: string | undefined;
|
|
240
|
+
totalQuantity: number;
|
|
241
|
+
totalBaseQuantity: number;
|
|
242
|
+
totalAmount: string;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export interface CashierSalesSummaryResponse {
|
|
246
|
+
shiftId: string;
|
|
247
|
+
branchId: string;
|
|
248
|
+
cashierId: string;
|
|
249
|
+
terminalId: string;
|
|
250
|
+
status: string;
|
|
251
|
+
openedAt: Timestamp | undefined;
|
|
252
|
+
closedAt?: Timestamp | undefined;
|
|
253
|
+
totalOrders: number;
|
|
254
|
+
totalQuantity: number;
|
|
255
|
+
totalBaseQuantity: number;
|
|
256
|
+
subtotal: string;
|
|
257
|
+
discountAmount: string;
|
|
258
|
+
taxAmount: string;
|
|
259
|
+
totalAmount: string;
|
|
260
|
+
paidAmount: string;
|
|
261
|
+
changeAmount: string;
|
|
262
|
+
paymentMethods: CashierSalesPaymentSummary[];
|
|
263
|
+
products: CashierSalesProductSummary[];
|
|
264
|
+
}
|
|
265
|
+
|
|
213
266
|
export interface CreateSaleReturnItemInput {
|
|
214
267
|
productId: string;
|
|
215
268
|
productBatchId: string;
|
|
@@ -312,6 +365,8 @@ export interface SaleOrderServiceClient {
|
|
|
312
365
|
|
|
313
366
|
listSaleOrders(request: ListSaleOrdersRequest): Observable<ListSaleOrdersResponse>;
|
|
314
367
|
|
|
368
|
+
getCashierSalesSummary(request: CashierSalesSummaryRequest): Observable<CashierSalesSummaryResponse>;
|
|
369
|
+
|
|
315
370
|
deleteSaleOrder(request: IdRequest): Observable<BoolResponse>;
|
|
316
371
|
}
|
|
317
372
|
|
|
@@ -326,6 +381,10 @@ export interface SaleOrderServiceController {
|
|
|
326
381
|
request: ListSaleOrdersRequest,
|
|
327
382
|
): Promise<ListSaleOrdersResponse> | Observable<ListSaleOrdersResponse> | ListSaleOrdersResponse;
|
|
328
383
|
|
|
384
|
+
getCashierSalesSummary(
|
|
385
|
+
request: CashierSalesSummaryRequest,
|
|
386
|
+
): Promise<CashierSalesSummaryResponse> | Observable<CashierSalesSummaryResponse> | CashierSalesSummaryResponse;
|
|
387
|
+
|
|
329
388
|
deleteSaleOrder(request: IdRequest): Promise<BoolResponse> | Observable<BoolResponse> | BoolResponse;
|
|
330
389
|
}
|
|
331
390
|
|
|
@@ -336,6 +395,7 @@ export function SaleOrderServiceControllerMethods() {
|
|
|
336
395
|
"updateSaleOrder",
|
|
337
396
|
"getSaleOrderById",
|
|
338
397
|
"listSaleOrders",
|
|
398
|
+
"getCashierSalesSummary",
|
|
339
399
|
"deleteSaleOrder",
|
|
340
400
|
];
|
|
341
401
|
for (const method of grpcMethods) {
|
package/package.json
CHANGED
package/proto/sales.proto
CHANGED
|
@@ -15,6 +15,13 @@ enum SaleStatus {
|
|
|
15
15
|
SALE_STATUS_REFUNDED = 4;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
enum SaleSource {
|
|
19
|
+
SALE_SOURCE_UNSPECIFIED = 0;
|
|
20
|
+
SALE_SOURCE_POS = 1;
|
|
21
|
+
SALE_SOURCE_WEB = 2;
|
|
22
|
+
SALE_SOURCE_ADMIN = 3;
|
|
23
|
+
}
|
|
24
|
+
|
|
18
25
|
enum PaymentMethod {
|
|
19
26
|
PAYMENT_METHOD_UNSPECIFIED = 0;
|
|
20
27
|
PAYMENT_METHOD_CASH = 1;
|
|
@@ -71,6 +78,7 @@ message SaleOrder {
|
|
|
71
78
|
google.protobuf.Timestamp created_at = 18;
|
|
72
79
|
google.protobuf.Timestamp updated_at = 19;
|
|
73
80
|
optional string shift_id = 20;
|
|
81
|
+
SaleSource source = 21;
|
|
74
82
|
}
|
|
75
83
|
|
|
76
84
|
message SaleReturnItem {
|
|
@@ -164,6 +172,7 @@ message CreateSaleOrderRequest {
|
|
|
164
172
|
optional google.protobuf.Timestamp sold_at = 14;
|
|
165
173
|
repeated CreateSaleItemInput items = 15;
|
|
166
174
|
optional string shift_id = 16;
|
|
175
|
+
optional SaleSource source = 17;
|
|
167
176
|
}
|
|
168
177
|
|
|
169
178
|
message UpdateSaleOrderRequest {
|
|
@@ -193,6 +202,7 @@ message ListSaleOrdersRequest {
|
|
|
193
202
|
optional SaleStatus status = 5;
|
|
194
203
|
optional string receipt_number = 6;
|
|
195
204
|
optional string shift_id = 7;
|
|
205
|
+
optional SaleSource source = 8;
|
|
196
206
|
}
|
|
197
207
|
|
|
198
208
|
message ListSaleOrdersResponse {
|
|
@@ -200,6 +210,48 @@ message ListSaleOrdersResponse {
|
|
|
200
210
|
common.v1.PaginationMeta meta = 2;
|
|
201
211
|
}
|
|
202
212
|
|
|
213
|
+
message CashierSalesSummaryRequest {
|
|
214
|
+
string shift_id = 1;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
message CashierSalesPaymentSummary {
|
|
218
|
+
PaymentMethod payment_method = 1;
|
|
219
|
+
int32 total_orders = 2;
|
|
220
|
+
string total_amount = 3;
|
|
221
|
+
string paid_amount = 4;
|
|
222
|
+
string change_amount = 5;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
message CashierSalesProductSummary {
|
|
226
|
+
string product_id = 1;
|
|
227
|
+
string product_name = 2;
|
|
228
|
+
optional string sku = 3;
|
|
229
|
+
int32 total_quantity = 4;
|
|
230
|
+
int32 total_base_quantity = 5;
|
|
231
|
+
string total_amount = 6;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
message CashierSalesSummaryResponse {
|
|
235
|
+
string shift_id = 1;
|
|
236
|
+
string branch_id = 2;
|
|
237
|
+
string cashier_id = 3;
|
|
238
|
+
string terminal_id = 4;
|
|
239
|
+
string status = 5;
|
|
240
|
+
google.protobuf.Timestamp opened_at = 6;
|
|
241
|
+
optional google.protobuf.Timestamp closed_at = 7;
|
|
242
|
+
int32 total_orders = 8;
|
|
243
|
+
int32 total_quantity = 9;
|
|
244
|
+
int32 total_base_quantity = 10;
|
|
245
|
+
string subtotal = 11;
|
|
246
|
+
string discount_amount = 12;
|
|
247
|
+
string tax_amount = 13;
|
|
248
|
+
string total_amount = 14;
|
|
249
|
+
string paid_amount = 15;
|
|
250
|
+
string change_amount = 16;
|
|
251
|
+
repeated CashierSalesPaymentSummary payment_methods = 17;
|
|
252
|
+
repeated CashierSalesProductSummary products = 18;
|
|
253
|
+
}
|
|
254
|
+
|
|
203
255
|
message CreateSaleReturnItemInput {
|
|
204
256
|
string product_id = 1;
|
|
205
257
|
string product_batch_id = 2;
|
|
@@ -296,6 +348,7 @@ service SaleOrderService {
|
|
|
296
348
|
rpc UpdateSaleOrder(UpdateSaleOrderRequest) returns (SaleOrder);
|
|
297
349
|
rpc GetSaleOrderById(common.v1.IdRequest) returns (SaleOrder);
|
|
298
350
|
rpc ListSaleOrders(ListSaleOrdersRequest) returns (ListSaleOrdersResponse);
|
|
351
|
+
rpc GetCashierSalesSummary(CashierSalesSummaryRequest) returns (CashierSalesSummaryResponse);
|
|
299
352
|
rpc DeleteSaleOrder(common.v1.IdRequest) returns (common.v1.BoolResponse);
|
|
300
353
|
}
|
|
301
354
|
|