@mamindom/contracts 1.0.125 → 1.0.127
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/dist/events/auth/otp-requested.interface.d.ts +6 -2
- package/dist/events/index.d.ts +1 -0
- package/dist/events/index.js +1 -0
- package/dist/events/orders/order-cancelled.interface.d.ts +7 -0
- package/dist/events/orders/order-status-changed.interface.d.ts +9 -0
- package/dist/events/stock/index.d.ts +5 -0
- package/dist/events/stock/index.js +21 -0
- package/dist/events/stock/stock-confirm-requested.interface.d.ts +4 -0
- package/dist/events/stock/stock-confirm-requested.interface.js +2 -0
- package/dist/events/stock/stock-release-requested.interface.d.ts +9 -0
- package/dist/events/stock/stock-release-requested.interface.js +2 -0
- package/dist/events/stock/stock-reserve-failed.interface.d.ts +9 -0
- package/dist/events/stock/stock-reserve-failed.interface.js +2 -0
- package/dist/events/stock/stock-reserve-requested.interface.d.ts +10 -0
- package/dist/events/stock/stock-reserve-requested.interface.js +2 -0
- package/dist/events/stock/stock-reserved.interface.d.ts +11 -0
- package/dist/events/stock/stock-reserved.interface.js +2 -0
- package/dist/gen/audit.d.ts +65 -0
- package/dist/gen/audit.js +28 -0
- package/dist/gen/cart.d.ts +5 -0
- package/dist/gen/manager.d.ts +117 -0
- package/dist/gen/manager.js +40 -0
- package/dist/gen/notification.d.ts +279 -0
- package/dist/gen/notification.js +119 -0
- package/dist/gen/order.d.ts +16 -0
- package/dist/gen/payment.d.ts +16 -0
- package/dist/gen/payment.js +1 -0
- package/dist/gen/product.d.ts +16 -0
- package/dist/gen/rbac.d.ts +111 -0
- package/dist/gen/rbac.js +37 -0
- package/dist/proto/audit.proto +59 -0
- package/dist/proto/cart.proto +3 -0
- package/dist/proto/manager.proto +94 -0
- package/dist/proto/notification.proto +317 -0
- package/dist/proto/order.proto +11 -0
- package/dist/proto/payment.proto +10 -0
- package/dist/proto/product.proto +26 -9
- package/dist/proto/rbac.proto +109 -0
- package/dist/src/proto/paths.d.ts +4 -0
- package/dist/src/proto/paths.js +5 -1
- package/events/auth/otp-requested.interface.ts +10 -2
- package/events/index.ts +1 -0
- package/events/orders/order-cancelled.interface.ts +9 -0
- package/events/orders/order-status-changed.interface.ts +14 -0
- package/events/stock/index.ts +5 -0
- package/events/stock/stock-confirm-requested.interface.ts +6 -0
- package/events/stock/stock-release-requested.interface.ts +11 -0
- package/events/stock/stock-reserve-failed.interface.ts +8 -0
- package/events/stock/stock-reserve-requested.interface.ts +16 -0
- package/events/stock/stock-reserved.interface.ts +13 -0
- package/gen/audit.ts +109 -0
- package/gen/cart.ts +5 -0
- package/gen/manager.ts +215 -0
- package/gen/notification.ts +427 -0
- package/gen/order.ts +16 -0
- package/gen/payment.ts +24 -0
- package/gen/product.ts +31 -5
- package/gen/rbac.ts +192 -0
- package/package.json +1 -1
- package/proto/audit.proto +59 -0
- package/proto/cart.proto +3 -0
- package/proto/manager.proto +94 -0
- package/proto/notification.proto +317 -0
- package/proto/order.proto +11 -0
- package/proto/payment.proto +10 -0
- package/proto/product.proto +26 -9
- package/proto/rbac.proto +109 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package rbac.v1;
|
|
4
|
+
|
|
5
|
+
service RbacService {
|
|
6
|
+
// Permissions catalog (read-only, seeded).
|
|
7
|
+
rpc ListPermissions(ListPermissionsRequest) returns (ListPermissionsResponse);
|
|
8
|
+
|
|
9
|
+
// Roles CRUD.
|
|
10
|
+
rpc ListRoles(ListRolesRequest) returns (ListRolesResponse);
|
|
11
|
+
rpc GetRole(GetRoleRequest) returns (RbacRole);
|
|
12
|
+
rpc CreateRole(CreateRoleRequest) returns (RbacRole);
|
|
13
|
+
rpc UpdateRole(UpdateRoleRequest) returns (RbacRole);
|
|
14
|
+
rpc DeleteRole(DeleteRoleRequest) returns (DeleteRoleResponse);
|
|
15
|
+
|
|
16
|
+
// Account ↔ role bindings.
|
|
17
|
+
rpc AssignAccountRole(AssignAccountRoleRequest) returns (AssignAccountRoleResponse);
|
|
18
|
+
rpc GetAccountPermissions(GetAccountPermissionsRequest) returns (GetAccountPermissionsResponse);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
message RbacPermission {
|
|
22
|
+
string id = 1;
|
|
23
|
+
string key = 2;
|
|
24
|
+
string group_key = 3;
|
|
25
|
+
string label = 4;
|
|
26
|
+
string description = 5;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
message RbacRole {
|
|
30
|
+
string id = 1;
|
|
31
|
+
string slug = 2;
|
|
32
|
+
string name = 3;
|
|
33
|
+
string description = 4;
|
|
34
|
+
string color = 5;
|
|
35
|
+
bool is_system = 6;
|
|
36
|
+
bool is_protected = 7;
|
|
37
|
+
int32 users_count = 8;
|
|
38
|
+
repeated string permission_keys = 9;
|
|
39
|
+
string created_at = 10;
|
|
40
|
+
string updated_at = 11;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
message ListPermissionsRequest {}
|
|
44
|
+
|
|
45
|
+
message ListPermissionsResponse {
|
|
46
|
+
repeated RbacPermission items = 1;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
message ListRolesRequest {
|
|
50
|
+
optional string search = 1;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
message ListRolesResponse {
|
|
54
|
+
repeated RbacRole items = 1;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
message GetRoleRequest {
|
|
58
|
+
string id = 1;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
message CreateRoleRequest {
|
|
62
|
+
string slug = 1;
|
|
63
|
+
string name = 2;
|
|
64
|
+
string description = 3;
|
|
65
|
+
string color = 4;
|
|
66
|
+
repeated string permission_keys = 5;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
message UpdateRoleRequest {
|
|
70
|
+
string id = 1;
|
|
71
|
+
optional string name = 2;
|
|
72
|
+
optional string description = 3;
|
|
73
|
+
optional string color = 4;
|
|
74
|
+
// Якщо передано — повна заміна; якщо не передано — без змін.
|
|
75
|
+
repeated string permission_keys = 5;
|
|
76
|
+
bool replace_permissions = 6;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
message DeleteRoleRequest {
|
|
80
|
+
string id = 1;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
message DeleteRoleResponse {
|
|
84
|
+
bool ok = 1;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
message AssignAccountRoleRequest {
|
|
88
|
+
string account_id = 1;
|
|
89
|
+
// Якщо custom_role_id порожній — користувач відвʼязується від кастомної ролі,
|
|
90
|
+
// і дозволи беруться з системної.
|
|
91
|
+
optional string custom_role_id = 2;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
message AssignAccountRoleResponse {
|
|
95
|
+
bool ok = 1;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
message GetAccountPermissionsRequest {
|
|
99
|
+
string account_id = 1;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
message GetAccountPermissionsResponse {
|
|
103
|
+
// Effective permissions з урахуванням system role + custom role override.
|
|
104
|
+
// Може містити "*" — повний доступ (ADMIN).
|
|
105
|
+
repeated string permission_keys = 1;
|
|
106
|
+
// Слаг ефективної ролі (для UI/labels).
|
|
107
|
+
string role_slug = 2;
|
|
108
|
+
string role_name = 3;
|
|
109
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export declare const PROTO_PATHS: {
|
|
2
2
|
readonly AUTH: string;
|
|
3
3
|
readonly ACCOUNT: string;
|
|
4
|
+
readonly RBAC: string;
|
|
5
|
+
readonly AUDIT: string;
|
|
4
6
|
readonly USERS: string;
|
|
5
7
|
readonly COMMON: string;
|
|
6
8
|
readonly CATEGORY: string;
|
|
@@ -32,7 +34,9 @@ export declare const PROTO_PATHS: {
|
|
|
32
34
|
readonly SITE_SETTINGS: string;
|
|
33
35
|
readonly CART: string;
|
|
34
36
|
readonly ORDER: string;
|
|
37
|
+
readonly MANAGER: string;
|
|
35
38
|
readonly PAYMENT: string;
|
|
36
39
|
readonly DELIVERY: string;
|
|
37
40
|
readonly DELIVERY_SETTINGS: string;
|
|
41
|
+
readonly NOTIFICATION: string;
|
|
38
42
|
};
|
package/dist/src/proto/paths.js
CHANGED
|
@@ -5,6 +5,8 @@ const node_path_1 = require("node:path");
|
|
|
5
5
|
exports.PROTO_PATHS = {
|
|
6
6
|
AUTH: (0, node_path_1.join)(__dirname, '../../proto/auth.proto'),
|
|
7
7
|
ACCOUNT: (0, node_path_1.join)(__dirname, '../../proto/account.proto'),
|
|
8
|
+
RBAC: (0, node_path_1.join)(__dirname, '../../proto/rbac.proto'),
|
|
9
|
+
AUDIT: (0, node_path_1.join)(__dirname, '../../proto/audit.proto'),
|
|
8
10
|
USERS: (0, node_path_1.join)(__dirname, '../../proto/users.proto'),
|
|
9
11
|
COMMON: (0, node_path_1.join)(__dirname, '../../proto/common.proto'),
|
|
10
12
|
CATEGORY: (0, node_path_1.join)(__dirname, '../../proto/category.proto'),
|
|
@@ -36,7 +38,9 @@ exports.PROTO_PATHS = {
|
|
|
36
38
|
SITE_SETTINGS: (0, node_path_1.join)(__dirname, '../../proto/site_settings.proto'),
|
|
37
39
|
CART: (0, node_path_1.join)(__dirname, '../../proto/cart.proto'),
|
|
38
40
|
ORDER: (0, node_path_1.join)(__dirname, '../../proto/order.proto'),
|
|
41
|
+
MANAGER: (0, node_path_1.join)(__dirname, '../../proto/manager.proto'),
|
|
39
42
|
PAYMENT: (0, node_path_1.join)(__dirname, '../../proto/payment.proto'),
|
|
40
43
|
DELIVERY: (0, node_path_1.join)(__dirname, '../../proto/delivery.proto'),
|
|
41
|
-
DELIVERY_SETTINGS: (0, node_path_1.join)(__dirname, '../../proto/delivery_settings.proto')
|
|
44
|
+
DELIVERY_SETTINGS: (0, node_path_1.join)(__dirname, '../../proto/delivery_settings.proto'),
|
|
45
|
+
NOTIFICATION: (0, node_path_1.join)(__dirname, '../../proto/notification.proto')
|
|
42
46
|
};
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
export interface OtpRequestedEvent {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
// Target: email або phone (визначається за наявності '@').
|
|
3
|
+
target: string
|
|
4
|
+
// Категорія: 'login' | 'verify' | 'password_reset'.
|
|
5
|
+
purpose: string
|
|
4
6
|
code: string
|
|
7
|
+
// TTL (ms epoch).
|
|
8
|
+
expiresAt: number
|
|
9
|
+
userId?: string
|
|
10
|
+
// Backward-compat: deprecated alias для target.
|
|
11
|
+
identifier?: string
|
|
12
|
+
type?: string
|
|
5
13
|
}
|
package/events/index.ts
CHANGED
|
@@ -7,4 +7,13 @@ export interface OrderCancelledEvent {
|
|
|
7
7
|
wasPaid: boolean
|
|
8
8
|
releaseStock: boolean
|
|
9
9
|
cancelledAt: number
|
|
10
|
+
|
|
11
|
+
// Опціональний customer-snapshot для нотифікацій.
|
|
12
|
+
userId?: string
|
|
13
|
+
customer?: {
|
|
14
|
+
firstName: string
|
|
15
|
+
lastName: string
|
|
16
|
+
email: string
|
|
17
|
+
phone: string
|
|
18
|
+
}
|
|
10
19
|
}
|
|
@@ -7,4 +7,18 @@ export interface OrderStatusChangedEvent {
|
|
|
7
7
|
actorId?: string
|
|
8
8
|
actorName?: string
|
|
9
9
|
changedAt: number
|
|
10
|
+
|
|
11
|
+
// Опціональний customer-snapshot для нотифікацій (щоб
|
|
12
|
+
// notification-service не робив додатковий lookup в order-service).
|
|
13
|
+
userId?: string
|
|
14
|
+
customer?: {
|
|
15
|
+
firstName: string
|
|
16
|
+
lastName: string
|
|
17
|
+
email: string
|
|
18
|
+
phone: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// На переходах у shipped — ТТН + tracking URL.
|
|
22
|
+
trackingNumber?: string
|
|
23
|
+
trackingUrl?: string
|
|
10
24
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Подія від order-service: cancel/відмова → catalog скасовує всі резерви
|
|
2
|
+
// замовлення (по reference_type='order', reference_id=orderId).
|
|
3
|
+
export interface StockReleaseRequestedEvent {
|
|
4
|
+
orderId: string
|
|
5
|
+
orderNumber: string
|
|
6
|
+
items: Array<{
|
|
7
|
+
productId: string
|
|
8
|
+
variantId?: string
|
|
9
|
+
quantity: number
|
|
10
|
+
}>
|
|
11
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Подія від catalog-service: catalog НЕ зміг зарезервувати (insufficient
|
|
2
|
+
// stock, product disappeared). Order-service кенселить замовлення з reason.
|
|
3
|
+
export interface StockReserveFailedEvent {
|
|
4
|
+
orderId: string
|
|
5
|
+
orderNumber: string
|
|
6
|
+
reason: string
|
|
7
|
+
missing?: Array<{ productId: string; needed: number }>
|
|
8
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Подія від order-service: catalog має зарезервувати stock для замовлення.
|
|
2
|
+
// Catalog сам обирає warehouse(и) (auto-pick first-available, greedy
|
|
3
|
+
// fill через product_warehouses ORDER BY created_at).
|
|
4
|
+
//
|
|
5
|
+
// TTL у мс — після його закінчення UnpaidOrdersCron у order-service
|
|
6
|
+
// автоматично скасує замовлення → catalog отримає stock.release_requested.
|
|
7
|
+
export interface StockReserveRequestedEvent {
|
|
8
|
+
orderId: string
|
|
9
|
+
orderNumber: string
|
|
10
|
+
ttlMs: number
|
|
11
|
+
items: Array<{
|
|
12
|
+
productId: string
|
|
13
|
+
variantId?: string
|
|
14
|
+
quantity: number
|
|
15
|
+
}>
|
|
16
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Подія від catalog-service: успішний резерв → order-service зберігає
|
|
2
|
+
// reservationId/reservedUntil у OrderItem (для admin UI і traceability).
|
|
3
|
+
export interface StockReservedEvent {
|
|
4
|
+
orderId: string
|
|
5
|
+
orderNumber: string
|
|
6
|
+
reservedUntil: number
|
|
7
|
+
allocations: Array<{
|
|
8
|
+
productId: string
|
|
9
|
+
variantId?: string
|
|
10
|
+
warehouseId: string
|
|
11
|
+
quantity: number
|
|
12
|
+
}>
|
|
13
|
+
}
|
package/gen/audit.ts
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.4
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: audit.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "audit.v1";
|
|
12
|
+
|
|
13
|
+
export interface LogActionRequest {
|
|
14
|
+
actorId?: string | undefined;
|
|
15
|
+
actorName?: string | undefined;
|
|
16
|
+
actorEmail?:
|
|
17
|
+
| string
|
|
18
|
+
| undefined;
|
|
19
|
+
/** e.g. "order.cancelled", "product.price_changed" */
|
|
20
|
+
action: string;
|
|
21
|
+
/** e.g. "order", "product", "role" */
|
|
22
|
+
targetType: string;
|
|
23
|
+
targetId?:
|
|
24
|
+
| string
|
|
25
|
+
| undefined;
|
|
26
|
+
/** human-readable summary */
|
|
27
|
+
summary?:
|
|
28
|
+
| string
|
|
29
|
+
| undefined;
|
|
30
|
+
/** serialized JSON snapshot (small!) */
|
|
31
|
+
beforeJson?: string | undefined;
|
|
32
|
+
afterJson?: string | undefined;
|
|
33
|
+
ip?: string | undefined;
|
|
34
|
+
userAgent?: string | undefined;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface LogActionResponse {
|
|
38
|
+
ok: boolean;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface ListAuditRequest {
|
|
42
|
+
page?: number | undefined;
|
|
43
|
+
limit?: number | undefined;
|
|
44
|
+
actorId?: string | undefined;
|
|
45
|
+
targetType?: string | undefined;
|
|
46
|
+
targetId?: string | undefined;
|
|
47
|
+
action?:
|
|
48
|
+
| string
|
|
49
|
+
| undefined;
|
|
50
|
+
/** "orders" matches order.* etc */
|
|
51
|
+
actionGroup?:
|
|
52
|
+
| string
|
|
53
|
+
| undefined;
|
|
54
|
+
/** ISO date */
|
|
55
|
+
from?: string | undefined;
|
|
56
|
+
to?: string | undefined;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface AuditEntry {
|
|
60
|
+
id: string;
|
|
61
|
+
actorId: string;
|
|
62
|
+
actorName: string;
|
|
63
|
+
actorEmail: string;
|
|
64
|
+
action: string;
|
|
65
|
+
targetType: string;
|
|
66
|
+
targetId: string;
|
|
67
|
+
summary: string;
|
|
68
|
+
beforeJson: string;
|
|
69
|
+
afterJson: string;
|
|
70
|
+
ip: string;
|
|
71
|
+
userAgent: string;
|
|
72
|
+
createdAt: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface ListAuditResponse {
|
|
76
|
+
items: AuditEntry[];
|
|
77
|
+
total: number;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export const AUDIT_V1_PACKAGE_NAME = "audit.v1";
|
|
81
|
+
|
|
82
|
+
export interface AuditServiceClient {
|
|
83
|
+
logAction(request: LogActionRequest): Observable<LogActionResponse>;
|
|
84
|
+
|
|
85
|
+
listAudit(request: ListAuditRequest): Observable<ListAuditResponse>;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface AuditServiceController {
|
|
89
|
+
logAction(request: LogActionRequest): Promise<LogActionResponse> | Observable<LogActionResponse> | LogActionResponse;
|
|
90
|
+
|
|
91
|
+
listAudit(request: ListAuditRequest): Promise<ListAuditResponse> | Observable<ListAuditResponse> | ListAuditResponse;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function AuditServiceControllerMethods() {
|
|
95
|
+
return function (constructor: Function) {
|
|
96
|
+
const grpcMethods: string[] = ["logAction", "listAudit"];
|
|
97
|
+
for (const method of grpcMethods) {
|
|
98
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
99
|
+
GrpcMethod("AuditService", method)(constructor.prototype[method], method, descriptor);
|
|
100
|
+
}
|
|
101
|
+
const grpcStreamMethods: string[] = [];
|
|
102
|
+
for (const method of grpcStreamMethods) {
|
|
103
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
104
|
+
GrpcStreamMethod("AuditService", method)(constructor.prototype[method], method, descriptor);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export const AUDIT_SERVICE_NAME = "AuditService";
|
package/gen/cart.ts
CHANGED
|
@@ -73,6 +73,11 @@ export interface DeliveryDraft {
|
|
|
73
73
|
pickupPointId: string;
|
|
74
74
|
cost: number;
|
|
75
75
|
freeShipping: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Область з City.region — клієнт передає при виборі міста, щоб
|
|
78
|
+
* потім order-service зміг записати в snapshot замовлення.
|
|
79
|
+
*/
|
|
80
|
+
region: string;
|
|
76
81
|
}
|
|
77
82
|
|
|
78
83
|
export interface PaymentDraft {
|
package/gen/manager.ts
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.4
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: manager.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "manager.v1";
|
|
12
|
+
|
|
13
|
+
export interface Vacation {
|
|
14
|
+
id: string;
|
|
15
|
+
startsAt: string;
|
|
16
|
+
endsAt: string;
|
|
17
|
+
reason: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface ManagerProfileDto {
|
|
21
|
+
id: string;
|
|
22
|
+
accountId: string;
|
|
23
|
+
displayName: string;
|
|
24
|
+
email: string;
|
|
25
|
+
isActive: boolean;
|
|
26
|
+
queueOrder: number;
|
|
27
|
+
assignedCount: number;
|
|
28
|
+
terminatedAt: string;
|
|
29
|
+
reassignmentStrategy: string;
|
|
30
|
+
vacations: Vacation[];
|
|
31
|
+
createdAt: string;
|
|
32
|
+
updatedAt: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface ListManagersRequest {
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface ListManagersResponse {
|
|
39
|
+
items: ManagerProfileDto[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface GetManagerRequest {
|
|
43
|
+
id: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface GetManagerByAccountRequest {
|
|
47
|
+
accountId: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface CreateManagerRequest {
|
|
51
|
+
accountId: string;
|
|
52
|
+
displayName?: string | undefined;
|
|
53
|
+
email?:
|
|
54
|
+
| string
|
|
55
|
+
| undefined;
|
|
56
|
+
/** URGENT_ONLY | ALL */
|
|
57
|
+
reassignmentStrategy?: string | undefined;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface UpdateManagerRequest {
|
|
61
|
+
id: string;
|
|
62
|
+
displayName?: string | undefined;
|
|
63
|
+
email?: string | undefined;
|
|
64
|
+
reassignmentStrategy?: string | undefined;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface SetManagerActiveRequest {
|
|
68
|
+
id: string;
|
|
69
|
+
isActive: boolean;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface TerminateManagerRequest {
|
|
73
|
+
id: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface ReorderManagersRequest {
|
|
77
|
+
orderedIds: string[];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface AddVacationRequest {
|
|
81
|
+
managerId: string;
|
|
82
|
+
/** ISO date */
|
|
83
|
+
startsAt: string;
|
|
84
|
+
endsAt: string;
|
|
85
|
+
reason?: string | undefined;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface AddVacationResponse {
|
|
89
|
+
id: string;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface DeleteVacationRequest {
|
|
93
|
+
id: string;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface ReassignUnassignedRequest {
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface ReassignUnassignedResponse {
|
|
100
|
+
ok: boolean;
|
|
101
|
+
reassignedCount: number;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface BoolResult {
|
|
105
|
+
ok: boolean;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export const MANAGER_V1_PACKAGE_NAME = "manager.v1";
|
|
109
|
+
|
|
110
|
+
export interface ManagerServiceClient {
|
|
111
|
+
listManagers(request: ListManagersRequest): Observable<ListManagersResponse>;
|
|
112
|
+
|
|
113
|
+
getManager(request: GetManagerRequest): Observable<ManagerProfileDto>;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Резолв account_id (з auth-service) → ManagerProfile. Використовується
|
|
117
|
+
* у gateway щоб з'ясувати ManagerProfile.id для логіну-під-менеджером —
|
|
118
|
+
* order.managerId зберігає ManagerProfile.id, а не Account.id.
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
getManagerByAccount(request: GetManagerByAccountRequest): Observable<ManagerProfileDto>;
|
|
122
|
+
|
|
123
|
+
createManager(request: CreateManagerRequest): Observable<ManagerProfileDto>;
|
|
124
|
+
|
|
125
|
+
updateManager(request: UpdateManagerRequest): Observable<ManagerProfileDto>;
|
|
126
|
+
|
|
127
|
+
setManagerActive(request: SetManagerActiveRequest): Observable<ManagerProfileDto>;
|
|
128
|
+
|
|
129
|
+
terminateManager(request: TerminateManagerRequest): Observable<ManagerProfileDto>;
|
|
130
|
+
|
|
131
|
+
reorderManagers(request: ReorderManagersRequest): Observable<BoolResult>;
|
|
132
|
+
|
|
133
|
+
addVacation(request: AddVacationRequest): Observable<AddVacationResponse>;
|
|
134
|
+
|
|
135
|
+
deleteVacation(request: DeleteVacationRequest): Observable<BoolResult>;
|
|
136
|
+
|
|
137
|
+
reassignUnassigned(request: ReassignUnassignedRequest): Observable<ReassignUnassignedResponse>;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface ManagerServiceController {
|
|
141
|
+
listManagers(
|
|
142
|
+
request: ListManagersRequest,
|
|
143
|
+
): Promise<ListManagersResponse> | Observable<ListManagersResponse> | ListManagersResponse;
|
|
144
|
+
|
|
145
|
+
getManager(
|
|
146
|
+
request: GetManagerRequest,
|
|
147
|
+
): Promise<ManagerProfileDto> | Observable<ManagerProfileDto> | ManagerProfileDto;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Резолв account_id (з auth-service) → ManagerProfile. Використовується
|
|
151
|
+
* у gateway щоб з'ясувати ManagerProfile.id для логіну-під-менеджером —
|
|
152
|
+
* order.managerId зберігає ManagerProfile.id, а не Account.id.
|
|
153
|
+
*/
|
|
154
|
+
|
|
155
|
+
getManagerByAccount(
|
|
156
|
+
request: GetManagerByAccountRequest,
|
|
157
|
+
): Promise<ManagerProfileDto> | Observable<ManagerProfileDto> | ManagerProfileDto;
|
|
158
|
+
|
|
159
|
+
createManager(
|
|
160
|
+
request: CreateManagerRequest,
|
|
161
|
+
): Promise<ManagerProfileDto> | Observable<ManagerProfileDto> | ManagerProfileDto;
|
|
162
|
+
|
|
163
|
+
updateManager(
|
|
164
|
+
request: UpdateManagerRequest,
|
|
165
|
+
): Promise<ManagerProfileDto> | Observable<ManagerProfileDto> | ManagerProfileDto;
|
|
166
|
+
|
|
167
|
+
setManagerActive(
|
|
168
|
+
request: SetManagerActiveRequest,
|
|
169
|
+
): Promise<ManagerProfileDto> | Observable<ManagerProfileDto> | ManagerProfileDto;
|
|
170
|
+
|
|
171
|
+
terminateManager(
|
|
172
|
+
request: TerminateManagerRequest,
|
|
173
|
+
): Promise<ManagerProfileDto> | Observable<ManagerProfileDto> | ManagerProfileDto;
|
|
174
|
+
|
|
175
|
+
reorderManagers(request: ReorderManagersRequest): Promise<BoolResult> | Observable<BoolResult> | BoolResult;
|
|
176
|
+
|
|
177
|
+
addVacation(
|
|
178
|
+
request: AddVacationRequest,
|
|
179
|
+
): Promise<AddVacationResponse> | Observable<AddVacationResponse> | AddVacationResponse;
|
|
180
|
+
|
|
181
|
+
deleteVacation(request: DeleteVacationRequest): Promise<BoolResult> | Observable<BoolResult> | BoolResult;
|
|
182
|
+
|
|
183
|
+
reassignUnassigned(
|
|
184
|
+
request: ReassignUnassignedRequest,
|
|
185
|
+
): Promise<ReassignUnassignedResponse> | Observable<ReassignUnassignedResponse> | ReassignUnassignedResponse;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export function ManagerServiceControllerMethods() {
|
|
189
|
+
return function (constructor: Function) {
|
|
190
|
+
const grpcMethods: string[] = [
|
|
191
|
+
"listManagers",
|
|
192
|
+
"getManager",
|
|
193
|
+
"getManagerByAccount",
|
|
194
|
+
"createManager",
|
|
195
|
+
"updateManager",
|
|
196
|
+
"setManagerActive",
|
|
197
|
+
"terminateManager",
|
|
198
|
+
"reorderManagers",
|
|
199
|
+
"addVacation",
|
|
200
|
+
"deleteVacation",
|
|
201
|
+
"reassignUnassigned",
|
|
202
|
+
];
|
|
203
|
+
for (const method of grpcMethods) {
|
|
204
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
205
|
+
GrpcMethod("ManagerService", method)(constructor.prototype[method], method, descriptor);
|
|
206
|
+
}
|
|
207
|
+
const grpcStreamMethods: string[] = [];
|
|
208
|
+
for (const method of grpcStreamMethods) {
|
|
209
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
210
|
+
GrpcStreamMethod("ManagerService", method)(constructor.prototype[method], method, descriptor);
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export const MANAGER_SERVICE_NAME = "ManagerService";
|