@prodoctors/contracts 1.4.0 → 1.6.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.
@@ -9,4 +9,5 @@ export declare const PROTO_PATHS: {
9
9
  readonly SALES: string;
10
10
  readonly SHIFT: string;
11
11
  readonly RESERVATION: string;
12
+ readonly ANALYTICS: string;
12
13
  };
@@ -13,4 +13,5 @@ exports.PROTO_PATHS = {
13
13
  SALES: (0, path_1.join)(__dirname, "../../proto/sales.proto"),
14
14
  SHIFT: (0, path_1.join)(__dirname, "../../proto/shift.proto"),
15
15
  RESERVATION: (0, path_1.join)(__dirname, "../../proto/reservation.proto"),
16
+ ANALYTICS: (0, path_1.join)(__dirname, "../../proto/analytics.proto"),
16
17
  };
package/gen/account.ts CHANGED
@@ -65,6 +65,30 @@ export interface ListAccountsResponse {
65
65
  meta: PaginationMeta | undefined;
66
66
  }
67
67
 
68
+ /** Web storefront: foydalanuvchining sevimli mahsulotlari (wishlist). */
69
+ export interface Favorite {
70
+ productId: string;
71
+ createdAt: Timestamp | undefined;
72
+ }
73
+
74
+ export interface AddFavoriteRequest {
75
+ accountId: string;
76
+ productId: string;
77
+ }
78
+
79
+ export interface RemoveFavoriteRequest {
80
+ accountId: string;
81
+ productId: string;
82
+ }
83
+
84
+ export interface ListFavoritesRequest {
85
+ accountId: string;
86
+ }
87
+
88
+ export interface FavoriteListResponse {
89
+ items: Favorite[];
90
+ }
91
+
68
92
  export const ACCOUNT_V1_PACKAGE_NAME = "account.v1";
69
93
 
70
94
  export interface AccountServiceClient {
@@ -120,3 +144,46 @@ export function AccountServiceControllerMethods() {
120
144
  }
121
145
 
122
146
  export const ACCOUNT_SERVICE_NAME = "AccountService";
147
+
148
+ export interface FavoriteServiceClient {
149
+ /** Add/Remove yangilangan to'liq ro'yxatni qaytaradi (klient bitta so'rovda sinxronlansin). */
150
+
151
+ addFavorite(request: AddFavoriteRequest): Observable<FavoriteListResponse>;
152
+
153
+ removeFavorite(request: RemoveFavoriteRequest): Observable<FavoriteListResponse>;
154
+
155
+ listFavorites(request: ListFavoritesRequest): Observable<FavoriteListResponse>;
156
+ }
157
+
158
+ export interface FavoriteServiceController {
159
+ /** Add/Remove yangilangan to'liq ro'yxatni qaytaradi (klient bitta so'rovda sinxronlansin). */
160
+
161
+ addFavorite(
162
+ request: AddFavoriteRequest,
163
+ ): Promise<FavoriteListResponse> | Observable<FavoriteListResponse> | FavoriteListResponse;
164
+
165
+ removeFavorite(
166
+ request: RemoveFavoriteRequest,
167
+ ): Promise<FavoriteListResponse> | Observable<FavoriteListResponse> | FavoriteListResponse;
168
+
169
+ listFavorites(
170
+ request: ListFavoritesRequest,
171
+ ): Promise<FavoriteListResponse> | Observable<FavoriteListResponse> | FavoriteListResponse;
172
+ }
173
+
174
+ export function FavoriteServiceControllerMethods() {
175
+ return function (constructor: Function) {
176
+ const grpcMethods: string[] = ["addFavorite", "removeFavorite", "listFavorites"];
177
+ for (const method of grpcMethods) {
178
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
179
+ GrpcMethod("FavoriteService", method)(constructor.prototype[method], method, descriptor);
180
+ }
181
+ const grpcStreamMethods: string[] = [];
182
+ for (const method of grpcStreamMethods) {
183
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
184
+ GrpcStreamMethod("FavoriteService", method)(constructor.prototype[method], method, descriptor);
185
+ }
186
+ };
187
+ }
188
+
189
+ export const FAVORITE_SERVICE_NAME = "FavoriteService";
@@ -0,0 +1,127 @@
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: analytics.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+
11
+ export const protobufPackage = "analytics.v1";
12
+
13
+ export interface DashboardStatsRequest {
14
+ /** today | 7days | 30days | 12months (default: today) */
15
+ range?: string | undefined;
16
+ }
17
+
18
+ export interface DashboardStatsResponse {
19
+ revenue: number;
20
+ /** % oldingi teng davrga nisbatan */
21
+ revenueGrowth: number;
22
+ orders: number;
23
+ ordersGrowth: number;
24
+ users: number;
25
+ usersGrowth: number;
26
+ products: number;
27
+ productsGrowth: number;
28
+ }
29
+
30
+ export interface SalesTrendRequest {
31
+ /** default 12 */
32
+ months?: number | undefined;
33
+ }
34
+
35
+ export interface SalesTrendPoint {
36
+ /** "YYYY-MM" */
37
+ period: string;
38
+ revenue: number;
39
+ }
40
+
41
+ export interface SalesTrendResponse {
42
+ points: SalesTrendPoint[];
43
+ }
44
+
45
+ export interface RecentOrdersRequest {
46
+ /** default 10 */
47
+ limit?: number | undefined;
48
+ }
49
+
50
+ export interface RecentOrder {
51
+ id: string;
52
+ orderNumber: string;
53
+ pharmacy: string;
54
+ city: string;
55
+ amount: number;
56
+ /** SaleStatus (admin UI holatga o'giradi) */
57
+ status: string;
58
+ }
59
+
60
+ export interface RecentOrdersResponse {
61
+ items: RecentOrder[];
62
+ }
63
+
64
+ export interface TopProductsRequest {
65
+ /** default 5 */
66
+ limit?: number | undefined;
67
+ }
68
+
69
+ export interface TopProduct {
70
+ id: string;
71
+ name: string;
72
+ category: string;
73
+ stock: number;
74
+ price: number;
75
+ soldQuantity: number;
76
+ }
77
+
78
+ export interface TopProductsResponse {
79
+ items: TopProduct[];
80
+ }
81
+
82
+ export const ANALYTICS_V1_PACKAGE_NAME = "analytics.v1";
83
+
84
+ export interface AnalyticsServiceClient {
85
+ getDashboardStats(request: DashboardStatsRequest): Observable<DashboardStatsResponse>;
86
+
87
+ getSalesTrend(request: SalesTrendRequest): Observable<SalesTrendResponse>;
88
+
89
+ getRecentOrders(request: RecentOrdersRequest): Observable<RecentOrdersResponse>;
90
+
91
+ getTopProducts(request: TopProductsRequest): Observable<TopProductsResponse>;
92
+ }
93
+
94
+ export interface AnalyticsServiceController {
95
+ getDashboardStats(
96
+ request: DashboardStatsRequest,
97
+ ): Promise<DashboardStatsResponse> | Observable<DashboardStatsResponse> | DashboardStatsResponse;
98
+
99
+ getSalesTrend(
100
+ request: SalesTrendRequest,
101
+ ): Promise<SalesTrendResponse> | Observable<SalesTrendResponse> | SalesTrendResponse;
102
+
103
+ getRecentOrders(
104
+ request: RecentOrdersRequest,
105
+ ): Promise<RecentOrdersResponse> | Observable<RecentOrdersResponse> | RecentOrdersResponse;
106
+
107
+ getTopProducts(
108
+ request: TopProductsRequest,
109
+ ): Promise<TopProductsResponse> | Observable<TopProductsResponse> | TopProductsResponse;
110
+ }
111
+
112
+ export function AnalyticsServiceControllerMethods() {
113
+ return function (constructor: Function) {
114
+ const grpcMethods: string[] = ["getDashboardStats", "getSalesTrend", "getRecentOrders", "getTopProducts"];
115
+ for (const method of grpcMethods) {
116
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
117
+ GrpcMethod("AnalyticsService", method)(constructor.prototype[method], method, descriptor);
118
+ }
119
+ const grpcStreamMethods: string[] = [];
120
+ for (const method of grpcStreamMethods) {
121
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
122
+ GrpcStreamMethod("AnalyticsService", method)(constructor.prototype[method], method, descriptor);
123
+ }
124
+ };
125
+ }
126
+
127
+ export const ANALYTICS_SERVICE_NAME = "AnalyticsService";
package/package.json CHANGED
@@ -1,28 +1,28 @@
1
- {
2
- "name": "@prodoctors/contracts",
3
- "version": "1.4.0",
4
- "description": "Protobuf definitions and generated Typescript types for ProDoctors",
5
- "main": "./dist/index.js",
6
- "types": "./dist/index.d.ts",
7
- "scripts": {
8
- "build": "tsc -p tsconfig.build.json",
9
- "generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
10
- },
11
- "files": [
12
- "proto",
13
- "gen",
14
- "dist"
15
- ],
16
- "publishConfig": {
17
- "access": "public"
18
- },
19
- "dependencies": {
20
- "@nestjs/microservices": "^11.1.15",
21
- "rxjs": "^7.8.2",
22
- "ts-proto": "^2.11.4"
23
- },
24
- "devDependencies": {
25
- "@types/node": "^25.3.5",
26
- "typescript": "^5.9.3"
27
- }
28
- }
1
+ {
2
+ "name": "@prodoctors/contracts",
3
+ "version": "1.6.0",
4
+ "description": "Protobuf definitions and generated Typescript types for ProDoctors",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc -p tsconfig.build.json",
9
+ "generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
10
+ },
11
+ "files": [
12
+ "proto",
13
+ "gen",
14
+ "dist"
15
+ ],
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "dependencies": {
20
+ "@nestjs/microservices": "^11.1.15",
21
+ "rxjs": "^7.8.2",
22
+ "ts-proto": "^2.11.4"
23
+ },
24
+ "devDependencies": {
25
+ "@types/node": "^25.3.5",
26
+ "typescript": "^5.9.3"
27
+ }
28
+ }
@@ -66,3 +66,34 @@ service AccountService {
66
66
  rpc ListAccounts(ListAccountsRequest) returns (ListAccountsResponse);
67
67
  rpc DeleteAccount(common.v1.IdRequest) returns (common.v1.BoolResponse);
68
68
  }
69
+
70
+ // Web storefront: foydalanuvchining sevimli mahsulotlari (wishlist).
71
+ message Favorite {
72
+ string product_id = 1;
73
+ google.protobuf.Timestamp created_at = 2;
74
+ }
75
+
76
+ message AddFavoriteRequest {
77
+ string account_id = 1;
78
+ string product_id = 2;
79
+ }
80
+
81
+ message RemoveFavoriteRequest {
82
+ string account_id = 1;
83
+ string product_id = 2;
84
+ }
85
+
86
+ message ListFavoritesRequest {
87
+ string account_id = 1;
88
+ }
89
+
90
+ message FavoriteListResponse {
91
+ repeated Favorite items = 1;
92
+ }
93
+
94
+ service FavoriteService {
95
+ // Add/Remove yangilangan to'liq ro'yxatni qaytaradi (klient bitta so'rovda sinxronlansin).
96
+ rpc AddFavorite(AddFavoriteRequest) returns (FavoriteListResponse);
97
+ rpc RemoveFavorite(RemoveFavoriteRequest) returns (FavoriteListResponse);
98
+ rpc ListFavorites(ListFavoritesRequest) returns (FavoriteListResponse);
99
+ }
@@ -0,0 +1,77 @@
1
+ syntax = "proto3";
2
+
3
+ package analytics.v1;
4
+
5
+ // Admin analitikasi: xom aggregatlar (POS SaleOrder asosida). Display
6
+ // formatlash (i18n kalitlar, valyuta) frontend zimmasida.
7
+
8
+ // ---------------- Dashboard (admin bosh sahifa) ----------------
9
+
10
+ message DashboardStatsRequest {
11
+ optional string range = 1; // today | 7days | 30days | 12months (default: today)
12
+ }
13
+
14
+ message DashboardStatsResponse {
15
+ double revenue = 1;
16
+ double revenue_growth = 2; // % oldingi teng davrga nisbatan
17
+ int32 orders = 3;
18
+ double orders_growth = 4;
19
+ int32 users = 5;
20
+ double users_growth = 6;
21
+ int32 products = 7;
22
+ double products_growth = 8;
23
+ }
24
+
25
+ message SalesTrendRequest {
26
+ optional int32 months = 1; // default 12
27
+ }
28
+
29
+ message SalesTrendPoint {
30
+ string period = 1; // "YYYY-MM"
31
+ double revenue = 2;
32
+ }
33
+
34
+ message SalesTrendResponse {
35
+ repeated SalesTrendPoint points = 1;
36
+ }
37
+
38
+ message RecentOrdersRequest {
39
+ optional int32 limit = 1; // default 10
40
+ }
41
+
42
+ message RecentOrder {
43
+ string id = 1;
44
+ string order_number = 2;
45
+ string pharmacy = 3;
46
+ string city = 4;
47
+ double amount = 5;
48
+ string status = 6; // SaleStatus (admin UI holatga o'giradi)
49
+ }
50
+
51
+ message RecentOrdersResponse {
52
+ repeated RecentOrder items = 1;
53
+ }
54
+
55
+ message TopProductsRequest {
56
+ optional int32 limit = 1; // default 5
57
+ }
58
+
59
+ message TopProduct {
60
+ string id = 1;
61
+ string name = 2;
62
+ string category = 3;
63
+ int32 stock = 4;
64
+ double price = 5;
65
+ double sold_quantity = 6;
66
+ }
67
+
68
+ message TopProductsResponse {
69
+ repeated TopProduct items = 1;
70
+ }
71
+
72
+ service AnalyticsService {
73
+ rpc GetDashboardStats(DashboardStatsRequest) returns (DashboardStatsResponse);
74
+ rpc GetSalesTrend(SalesTrendRequest) returns (SalesTrendResponse);
75
+ rpc GetRecentOrders(RecentOrdersRequest) returns (RecentOrdersResponse);
76
+ rpc GetTopProducts(TopProductsRequest) returns (TopProductsResponse);
77
+ }