@prodoctors/contracts 1.7.0 → 1.8.0
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/analytics.ts +71 -0
- package/package.json +1 -1
- package/proto/analytics.proto +49 -0
package/gen/analytics.ts
CHANGED
|
@@ -159,6 +159,56 @@ export interface PharmaciesAnalyticsResponse {
|
|
|
159
159
|
pharmacies: PharmacyBreakdownItem[];
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
+
export interface SalesReportResponse {
|
|
163
|
+
summary: AnalyticsSummary | undefined;
|
|
164
|
+
series: AnalyticsSeriesPoint[];
|
|
165
|
+
topPharmacies: PharmacyBreakdownItem[];
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export interface OrderStatusCount {
|
|
169
|
+
/** SaleStatus */
|
|
170
|
+
status: string;
|
|
171
|
+
count: number;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export interface OrdersReportResponse {
|
|
175
|
+
total: number;
|
|
176
|
+
/** DRAFT */
|
|
177
|
+
processing: number;
|
|
178
|
+
/** COMPLETED */
|
|
179
|
+
completed: number;
|
|
180
|
+
/** CANCELLED + REFUNDED */
|
|
181
|
+
cancelled: number;
|
|
182
|
+
statuses: OrderStatusCount[];
|
|
183
|
+
recent: RecentOrder[];
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface InventoryCategoryCount {
|
|
187
|
+
id: string;
|
|
188
|
+
name: string;
|
|
189
|
+
count: number;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export interface InventoryRiskItem {
|
|
193
|
+
id: string;
|
|
194
|
+
nameRu: string;
|
|
195
|
+
nameUz: string;
|
|
196
|
+
/** LOW_STOCK | EXPIRING */
|
|
197
|
+
risk: string;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export interface InventoryReportResponse {
|
|
201
|
+
totalItems: number;
|
|
202
|
+
lowStock: number;
|
|
203
|
+
expiring: number;
|
|
204
|
+
branches: number;
|
|
205
|
+
categories: InventoryCategoryCount[];
|
|
206
|
+
risks: InventoryRiskItem[];
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export interface EmptyRequest {
|
|
210
|
+
}
|
|
211
|
+
|
|
162
212
|
export const ANALYTICS_V1_PACKAGE_NAME = "analytics.v1";
|
|
163
213
|
|
|
164
214
|
export interface AnalyticsServiceClient {
|
|
@@ -177,6 +227,12 @@ export interface AnalyticsServiceClient {
|
|
|
177
227
|
getProductsAnalytics(request: AnalyticsRangeRequest): Observable<ProductsAnalyticsResponse>;
|
|
178
228
|
|
|
179
229
|
getPharmaciesAnalytics(request: AnalyticsRangeRequest): Observable<PharmaciesAnalyticsResponse>;
|
|
230
|
+
|
|
231
|
+
getSalesReport(request: AnalyticsRangeRequest): Observable<SalesReportResponse>;
|
|
232
|
+
|
|
233
|
+
getOrdersReport(request: AnalyticsRangeRequest): Observable<OrdersReportResponse>;
|
|
234
|
+
|
|
235
|
+
getInventoryReport(request: EmptyRequest): Observable<InventoryReportResponse>;
|
|
180
236
|
}
|
|
181
237
|
|
|
182
238
|
export interface AnalyticsServiceController {
|
|
@@ -211,6 +267,18 @@ export interface AnalyticsServiceController {
|
|
|
211
267
|
getPharmaciesAnalytics(
|
|
212
268
|
request: AnalyticsRangeRequest,
|
|
213
269
|
): Promise<PharmaciesAnalyticsResponse> | Observable<PharmaciesAnalyticsResponse> | PharmaciesAnalyticsResponse;
|
|
270
|
+
|
|
271
|
+
getSalesReport(
|
|
272
|
+
request: AnalyticsRangeRequest,
|
|
273
|
+
): Promise<SalesReportResponse> | Observable<SalesReportResponse> | SalesReportResponse;
|
|
274
|
+
|
|
275
|
+
getOrdersReport(
|
|
276
|
+
request: AnalyticsRangeRequest,
|
|
277
|
+
): Promise<OrdersReportResponse> | Observable<OrdersReportResponse> | OrdersReportResponse;
|
|
278
|
+
|
|
279
|
+
getInventoryReport(
|
|
280
|
+
request: EmptyRequest,
|
|
281
|
+
): Promise<InventoryReportResponse> | Observable<InventoryReportResponse> | InventoryReportResponse;
|
|
214
282
|
}
|
|
215
283
|
|
|
216
284
|
export function AnalyticsServiceControllerMethods() {
|
|
@@ -224,6 +292,9 @@ export function AnalyticsServiceControllerMethods() {
|
|
|
224
292
|
"getSalesAnalytics",
|
|
225
293
|
"getProductsAnalytics",
|
|
226
294
|
"getPharmaciesAnalytics",
|
|
295
|
+
"getSalesReport",
|
|
296
|
+
"getOrdersReport",
|
|
297
|
+
"getInventoryReport",
|
|
227
298
|
];
|
|
228
299
|
for (const method of grpcMethods) {
|
|
229
300
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
package/package.json
CHANGED
package/proto/analytics.proto
CHANGED
|
@@ -146,6 +146,52 @@ message PharmaciesAnalyticsResponse {
|
|
|
146
146
|
repeated PharmacyBreakdownItem pharmacies = 3;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
+
// ---------------- Reports (hisobotlar) ----------------
|
|
150
|
+
|
|
151
|
+
message SalesReportResponse {
|
|
152
|
+
AnalyticsSummary summary = 1;
|
|
153
|
+
repeated AnalyticsSeriesPoint series = 2;
|
|
154
|
+
repeated PharmacyBreakdownItem top_pharmacies = 3;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
message OrderStatusCount {
|
|
158
|
+
string status = 1; // SaleStatus
|
|
159
|
+
int32 count = 2;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
message OrdersReportResponse {
|
|
163
|
+
int32 total = 1;
|
|
164
|
+
int32 processing = 2; // DRAFT
|
|
165
|
+
int32 completed = 3; // COMPLETED
|
|
166
|
+
int32 cancelled = 4; // CANCELLED + REFUNDED
|
|
167
|
+
repeated OrderStatusCount statuses = 5;
|
|
168
|
+
repeated RecentOrder recent = 6;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
message InventoryCategoryCount {
|
|
172
|
+
string id = 1;
|
|
173
|
+
string name = 2;
|
|
174
|
+
int32 count = 3;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
message InventoryRiskItem {
|
|
178
|
+
string id = 1;
|
|
179
|
+
string name_ru = 2;
|
|
180
|
+
string name_uz = 3;
|
|
181
|
+
string risk = 4; // LOW_STOCK | EXPIRING
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
message InventoryReportResponse {
|
|
185
|
+
int32 total_items = 1;
|
|
186
|
+
int32 low_stock = 2;
|
|
187
|
+
int32 expiring = 3;
|
|
188
|
+
int32 branches = 4;
|
|
189
|
+
repeated InventoryCategoryCount categories = 5;
|
|
190
|
+
repeated InventoryRiskItem risks = 6;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
message EmptyRequest {}
|
|
194
|
+
|
|
149
195
|
service AnalyticsService {
|
|
150
196
|
rpc GetDashboardStats(DashboardStatsRequest) returns (DashboardStatsResponse);
|
|
151
197
|
rpc GetSalesTrend(SalesTrendRequest) returns (SalesTrendResponse);
|
|
@@ -155,4 +201,7 @@ service AnalyticsService {
|
|
|
155
201
|
rpc GetSalesAnalytics(AnalyticsRangeRequest) returns (SalesAnalyticsResponse);
|
|
156
202
|
rpc GetProductsAnalytics(AnalyticsRangeRequest) returns (ProductsAnalyticsResponse);
|
|
157
203
|
rpc GetPharmaciesAnalytics(AnalyticsRangeRequest) returns (PharmaciesAnalyticsResponse);
|
|
204
|
+
rpc GetSalesReport(AnalyticsRangeRequest) returns (SalesReportResponse);
|
|
205
|
+
rpc GetOrdersReport(AnalyticsRangeRequest) returns (OrdersReportResponse);
|
|
206
|
+
rpc GetInventoryReport(EmptyRequest) returns (InventoryReportResponse);
|
|
158
207
|
}
|