@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
package/gen/rbac.ts
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
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: rbac.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "rbac.v1";
|
|
12
|
+
|
|
13
|
+
export interface RbacPermission {
|
|
14
|
+
id: string;
|
|
15
|
+
key: string;
|
|
16
|
+
groupKey: string;
|
|
17
|
+
label: string;
|
|
18
|
+
description: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface RbacRole {
|
|
22
|
+
id: string;
|
|
23
|
+
slug: string;
|
|
24
|
+
name: string;
|
|
25
|
+
description: string;
|
|
26
|
+
color: string;
|
|
27
|
+
isSystem: boolean;
|
|
28
|
+
isProtected: boolean;
|
|
29
|
+
usersCount: number;
|
|
30
|
+
permissionKeys: string[];
|
|
31
|
+
createdAt: string;
|
|
32
|
+
updatedAt: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface ListPermissionsRequest {
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface ListPermissionsResponse {
|
|
39
|
+
items: RbacPermission[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface ListRolesRequest {
|
|
43
|
+
search?: string | undefined;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface ListRolesResponse {
|
|
47
|
+
items: RbacRole[];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface GetRoleRequest {
|
|
51
|
+
id: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface CreateRoleRequest {
|
|
55
|
+
slug: string;
|
|
56
|
+
name: string;
|
|
57
|
+
description: string;
|
|
58
|
+
color: string;
|
|
59
|
+
permissionKeys: string[];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface UpdateRoleRequest {
|
|
63
|
+
id: string;
|
|
64
|
+
name?: string | undefined;
|
|
65
|
+
description?: string | undefined;
|
|
66
|
+
color?:
|
|
67
|
+
| string
|
|
68
|
+
| undefined;
|
|
69
|
+
/** Якщо передано — повна заміна; якщо не передано — без змін. */
|
|
70
|
+
permissionKeys: string[];
|
|
71
|
+
replacePermissions: boolean;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface DeleteRoleRequest {
|
|
75
|
+
id: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface DeleteRoleResponse {
|
|
79
|
+
ok: boolean;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface AssignAccountRoleRequest {
|
|
83
|
+
accountId: string;
|
|
84
|
+
/**
|
|
85
|
+
* Якщо custom_role_id порожній — користувач відвʼязується від кастомної ролі,
|
|
86
|
+
* і дозволи беруться з системної.
|
|
87
|
+
*/
|
|
88
|
+
customRoleId?: string | undefined;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface AssignAccountRoleResponse {
|
|
92
|
+
ok: boolean;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface GetAccountPermissionsRequest {
|
|
96
|
+
accountId: string;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface GetAccountPermissionsResponse {
|
|
100
|
+
/**
|
|
101
|
+
* Effective permissions з урахуванням system role + custom role override.
|
|
102
|
+
* Може містити "*" — повний доступ (ADMIN).
|
|
103
|
+
*/
|
|
104
|
+
permissionKeys: string[];
|
|
105
|
+
/** Слаг ефективної ролі (для UI/labels). */
|
|
106
|
+
roleSlug: string;
|
|
107
|
+
roleName: string;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export const RBAC_V1_PACKAGE_NAME = "rbac.v1";
|
|
111
|
+
|
|
112
|
+
export interface RbacServiceClient {
|
|
113
|
+
/** Permissions catalog (read-only, seeded). */
|
|
114
|
+
|
|
115
|
+
listPermissions(request: ListPermissionsRequest): Observable<ListPermissionsResponse>;
|
|
116
|
+
|
|
117
|
+
/** Roles CRUD. */
|
|
118
|
+
|
|
119
|
+
listRoles(request: ListRolesRequest): Observable<ListRolesResponse>;
|
|
120
|
+
|
|
121
|
+
getRole(request: GetRoleRequest): Observable<RbacRole>;
|
|
122
|
+
|
|
123
|
+
createRole(request: CreateRoleRequest): Observable<RbacRole>;
|
|
124
|
+
|
|
125
|
+
updateRole(request: UpdateRoleRequest): Observable<RbacRole>;
|
|
126
|
+
|
|
127
|
+
deleteRole(request: DeleteRoleRequest): Observable<DeleteRoleResponse>;
|
|
128
|
+
|
|
129
|
+
/** Account ↔ role bindings. */
|
|
130
|
+
|
|
131
|
+
assignAccountRole(request: AssignAccountRoleRequest): Observable<AssignAccountRoleResponse>;
|
|
132
|
+
|
|
133
|
+
getAccountPermissions(request: GetAccountPermissionsRequest): Observable<GetAccountPermissionsResponse>;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export interface RbacServiceController {
|
|
137
|
+
/** Permissions catalog (read-only, seeded). */
|
|
138
|
+
|
|
139
|
+
listPermissions(
|
|
140
|
+
request: ListPermissionsRequest,
|
|
141
|
+
): Promise<ListPermissionsResponse> | Observable<ListPermissionsResponse> | ListPermissionsResponse;
|
|
142
|
+
|
|
143
|
+
/** Roles CRUD. */
|
|
144
|
+
|
|
145
|
+
listRoles(request: ListRolesRequest): Promise<ListRolesResponse> | Observable<ListRolesResponse> | ListRolesResponse;
|
|
146
|
+
|
|
147
|
+
getRole(request: GetRoleRequest): Promise<RbacRole> | Observable<RbacRole> | RbacRole;
|
|
148
|
+
|
|
149
|
+
createRole(request: CreateRoleRequest): Promise<RbacRole> | Observable<RbacRole> | RbacRole;
|
|
150
|
+
|
|
151
|
+
updateRole(request: UpdateRoleRequest): Promise<RbacRole> | Observable<RbacRole> | RbacRole;
|
|
152
|
+
|
|
153
|
+
deleteRole(
|
|
154
|
+
request: DeleteRoleRequest,
|
|
155
|
+
): Promise<DeleteRoleResponse> | Observable<DeleteRoleResponse> | DeleteRoleResponse;
|
|
156
|
+
|
|
157
|
+
/** Account ↔ role bindings. */
|
|
158
|
+
|
|
159
|
+
assignAccountRole(
|
|
160
|
+
request: AssignAccountRoleRequest,
|
|
161
|
+
): Promise<AssignAccountRoleResponse> | Observable<AssignAccountRoleResponse> | AssignAccountRoleResponse;
|
|
162
|
+
|
|
163
|
+
getAccountPermissions(
|
|
164
|
+
request: GetAccountPermissionsRequest,
|
|
165
|
+
): Promise<GetAccountPermissionsResponse> | Observable<GetAccountPermissionsResponse> | GetAccountPermissionsResponse;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export function RbacServiceControllerMethods() {
|
|
169
|
+
return function (constructor: Function) {
|
|
170
|
+
const grpcMethods: string[] = [
|
|
171
|
+
"listPermissions",
|
|
172
|
+
"listRoles",
|
|
173
|
+
"getRole",
|
|
174
|
+
"createRole",
|
|
175
|
+
"updateRole",
|
|
176
|
+
"deleteRole",
|
|
177
|
+
"assignAccountRole",
|
|
178
|
+
"getAccountPermissions",
|
|
179
|
+
];
|
|
180
|
+
for (const method of grpcMethods) {
|
|
181
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
182
|
+
GrpcMethod("RbacService", method)(constructor.prototype[method], method, descriptor);
|
|
183
|
+
}
|
|
184
|
+
const grpcStreamMethods: string[] = [];
|
|
185
|
+
for (const method of grpcStreamMethods) {
|
|
186
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
187
|
+
GrpcStreamMethod("RbacService", method)(constructor.prototype[method], method, descriptor);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export const RBAC_SERVICE_NAME = "RbacService";
|
package/package.json
CHANGED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package audit.v1;
|
|
4
|
+
|
|
5
|
+
service AuditService {
|
|
6
|
+
rpc LogAction(LogActionRequest) returns (LogActionResponse);
|
|
7
|
+
rpc ListAudit(ListAuditRequest) returns (ListAuditResponse);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
message LogActionRequest {
|
|
11
|
+
optional string actor_id = 1;
|
|
12
|
+
optional string actor_name = 2;
|
|
13
|
+
optional string actor_email = 3;
|
|
14
|
+
string action = 4; // e.g. "order.cancelled", "product.price_changed"
|
|
15
|
+
string target_type = 5; // e.g. "order", "product", "role"
|
|
16
|
+
optional string target_id = 6;
|
|
17
|
+
optional string summary = 7; // human-readable summary
|
|
18
|
+
optional string before_json = 8; // serialized JSON snapshot (small!)
|
|
19
|
+
optional string after_json = 9;
|
|
20
|
+
optional string ip = 10;
|
|
21
|
+
optional string user_agent = 11;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
message LogActionResponse {
|
|
25
|
+
bool ok = 1;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
message ListAuditRequest {
|
|
29
|
+
optional int32 page = 1;
|
|
30
|
+
optional int32 limit = 2;
|
|
31
|
+
optional string actor_id = 3;
|
|
32
|
+
optional string target_type = 4;
|
|
33
|
+
optional string target_id = 5;
|
|
34
|
+
optional string action = 6;
|
|
35
|
+
optional string action_group = 7; // "orders" matches order.* etc
|
|
36
|
+
optional string from = 8; // ISO date
|
|
37
|
+
optional string to = 9;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
message AuditEntry {
|
|
41
|
+
string id = 1;
|
|
42
|
+
string actor_id = 2;
|
|
43
|
+
string actor_name = 3;
|
|
44
|
+
string actor_email = 4;
|
|
45
|
+
string action = 5;
|
|
46
|
+
string target_type = 6;
|
|
47
|
+
string target_id = 7;
|
|
48
|
+
string summary = 8;
|
|
49
|
+
string before_json = 9;
|
|
50
|
+
string after_json = 10;
|
|
51
|
+
string ip = 11;
|
|
52
|
+
string user_agent = 12;
|
|
53
|
+
string created_at = 13;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
message ListAuditResponse {
|
|
57
|
+
repeated AuditEntry items = 1;
|
|
58
|
+
int32 total = 2;
|
|
59
|
+
}
|
package/proto/cart.proto
CHANGED
|
@@ -100,6 +100,9 @@ message DeliveryDraft {
|
|
|
100
100
|
string pickup_point_id = 7;
|
|
101
101
|
double cost = 8;
|
|
102
102
|
bool free_shipping = 9;
|
|
103
|
+
// Область з City.region — клієнт передає при виборі міста, щоб
|
|
104
|
+
// потім order-service зміг записати в snapshot замовлення.
|
|
105
|
+
string region = 10;
|
|
103
106
|
}
|
|
104
107
|
|
|
105
108
|
message PaymentDraft {
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package manager.v1;
|
|
4
|
+
|
|
5
|
+
service ManagerService {
|
|
6
|
+
rpc ListManagers(ListManagersRequest) returns (ListManagersResponse);
|
|
7
|
+
rpc GetManager(GetManagerRequest) returns (ManagerProfileDto);
|
|
8
|
+
// Резолв account_id (з auth-service) → ManagerProfile. Використовується
|
|
9
|
+
// у gateway щоб з'ясувати ManagerProfile.id для логіну-під-менеджером —
|
|
10
|
+
// order.managerId зберігає ManagerProfile.id, а не Account.id.
|
|
11
|
+
rpc GetManagerByAccount(GetManagerByAccountRequest) returns (ManagerProfileDto);
|
|
12
|
+
rpc CreateManager(CreateManagerRequest) returns (ManagerProfileDto);
|
|
13
|
+
rpc UpdateManager(UpdateManagerRequest) returns (ManagerProfileDto);
|
|
14
|
+
rpc SetManagerActive(SetManagerActiveRequest) returns (ManagerProfileDto);
|
|
15
|
+
rpc TerminateManager(TerminateManagerRequest) returns (ManagerProfileDto);
|
|
16
|
+
rpc ReorderManagers(ReorderManagersRequest) returns (BoolResult);
|
|
17
|
+
rpc AddVacation(AddVacationRequest) returns (AddVacationResponse);
|
|
18
|
+
rpc DeleteVacation(DeleteVacationRequest) returns (BoolResult);
|
|
19
|
+
rpc ReassignUnassigned(ReassignUnassignedRequest) returns (ReassignUnassignedResponse);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
message Vacation {
|
|
23
|
+
string id = 1;
|
|
24
|
+
string starts_at = 2;
|
|
25
|
+
string ends_at = 3;
|
|
26
|
+
string reason = 4;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
message ManagerProfileDto {
|
|
30
|
+
string id = 1;
|
|
31
|
+
string account_id = 2;
|
|
32
|
+
string display_name = 3;
|
|
33
|
+
string email = 4;
|
|
34
|
+
bool is_active = 5;
|
|
35
|
+
int32 queue_order = 6;
|
|
36
|
+
int32 assigned_count = 7;
|
|
37
|
+
string terminated_at = 8;
|
|
38
|
+
string reassignment_strategy = 9;
|
|
39
|
+
repeated Vacation vacations = 10;
|
|
40
|
+
string created_at = 11;
|
|
41
|
+
string updated_at = 12;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
message ListManagersRequest {}
|
|
45
|
+
message ListManagersResponse {
|
|
46
|
+
repeated ManagerProfileDto items = 1;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
message GetManagerRequest { string id = 1; }
|
|
50
|
+
|
|
51
|
+
message GetManagerByAccountRequest { string account_id = 1; }
|
|
52
|
+
|
|
53
|
+
message CreateManagerRequest {
|
|
54
|
+
string account_id = 1;
|
|
55
|
+
optional string display_name = 2;
|
|
56
|
+
optional string email = 3;
|
|
57
|
+
optional string reassignment_strategy = 4; // URGENT_ONLY | ALL
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
message UpdateManagerRequest {
|
|
61
|
+
string id = 1;
|
|
62
|
+
optional string display_name = 2;
|
|
63
|
+
optional string email = 3;
|
|
64
|
+
optional string reassignment_strategy = 4;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
message SetManagerActiveRequest {
|
|
68
|
+
string id = 1;
|
|
69
|
+
bool is_active = 2;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
message TerminateManagerRequest { string id = 1; }
|
|
73
|
+
|
|
74
|
+
message ReorderManagersRequest {
|
|
75
|
+
repeated string ordered_ids = 1;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
message AddVacationRequest {
|
|
79
|
+
string manager_id = 1;
|
|
80
|
+
string starts_at = 2; // ISO date
|
|
81
|
+
string ends_at = 3;
|
|
82
|
+
optional string reason = 4;
|
|
83
|
+
}
|
|
84
|
+
message AddVacationResponse { string id = 1; }
|
|
85
|
+
|
|
86
|
+
message DeleteVacationRequest { string id = 1; }
|
|
87
|
+
|
|
88
|
+
message ReassignUnassignedRequest {}
|
|
89
|
+
message ReassignUnassignedResponse {
|
|
90
|
+
bool ok = 1;
|
|
91
|
+
int32 reassigned_count = 2;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
message BoolResult { bool ok = 1; }
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package notification.v1;
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
// Admin API для керування шаблонами нотифікацій, Telegram-чатами,
|
|
7
|
+
// надсилання test-пакета, перегляду логів.
|
|
8
|
+
|
|
9
|
+
service NotificationTemplateService {
|
|
10
|
+
rpc ListTemplates (ListTemplatesRequest) returns (ListTemplatesResponse);
|
|
11
|
+
rpc GetTemplate (GetTemplateRequest) returns (TemplateResponse);
|
|
12
|
+
rpc UpsertTemplate (UpsertTemplateRequest) returns (TemplateResponse);
|
|
13
|
+
rpc UpdateTemplate (UpdateTemplateRequest) returns (TemplateResponse);
|
|
14
|
+
rpc ToggleTemplate (ToggleTemplateRequest) returns (TemplateResponse);
|
|
15
|
+
rpc ListVersions (ListVersionsRequest) returns (ListVersionsResponse);
|
|
16
|
+
rpc RestoreVersion (RestoreVersionRequest) returns (TemplateResponse);
|
|
17
|
+
rpc RenderPreview (RenderPreviewRequest) returns (RenderPreviewResponse);
|
|
18
|
+
rpc SendTest (SendTestRequest) returns (SendTestResponse);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
service NotificationLogsService {
|
|
22
|
+
rpc ListLogs (ListLogsRequest) returns (ListLogsResponse);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
service TelegramChatsService {
|
|
26
|
+
rpc ListChats (ListChatsRequest) returns (ListChatsResponse);
|
|
27
|
+
rpc UpsertChat (UpsertChatRequest) returns (TelegramChatResponse);
|
|
28
|
+
rpc DeleteChat (DeleteChatRequest) returns (DeleteChatResponse);
|
|
29
|
+
rpc TestSendTelegram (TestSendTelegramRequest) returns (TestSendTelegramResponse);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
enum NotificationChannel {
|
|
34
|
+
NOTIFICATION_CHANNEL_UNSPECIFIED = 0;
|
|
35
|
+
EMAIL = 1;
|
|
36
|
+
SMS = 2;
|
|
37
|
+
TELEGRAM = 3;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
enum NotificationLocale {
|
|
41
|
+
NOTIFICATION_LOCALE_UNSPECIFIED = 0;
|
|
42
|
+
UK = 1;
|
|
43
|
+
RU = 2;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
enum NotificationCategory {
|
|
47
|
+
NOTIFICATION_CATEGORY_UNSPECIFIED = 0;
|
|
48
|
+
TRANSACTIONAL = 1;
|
|
49
|
+
ACCOUNT = 2;
|
|
50
|
+
MARKETING = 3;
|
|
51
|
+
ADMIN = 4;
|
|
52
|
+
OTP = 5;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
enum NotificationStatus {
|
|
56
|
+
NOTIFICATION_STATUS_UNSPECIFIED = 0;
|
|
57
|
+
PENDING = 1;
|
|
58
|
+
SENT = 2;
|
|
59
|
+
FAILED = 3;
|
|
60
|
+
SIMULATED = 4;
|
|
61
|
+
SUPPRESSED = 5;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
enum TelegramTopic {
|
|
65
|
+
TELEGRAM_TOPIC_UNSPECIFIED = 0;
|
|
66
|
+
ORDERS = 1;
|
|
67
|
+
ORDERS_ALERTS = 2;
|
|
68
|
+
PAYMENTS = 3;
|
|
69
|
+
WAREHOUSE = 4;
|
|
70
|
+
REVIEWS = 5;
|
|
71
|
+
CALLBACK = 6;
|
|
72
|
+
REPORTS = 7;
|
|
73
|
+
ALERTS = 8;
|
|
74
|
+
GENERAL = 9;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
message NotificationTemplate {
|
|
79
|
+
string id = 1;
|
|
80
|
+
string key = 2;
|
|
81
|
+
NotificationChannel channel = 3;
|
|
82
|
+
NotificationLocale locale = 4;
|
|
83
|
+
NotificationCategory category = 5;
|
|
84
|
+
string title = 6;
|
|
85
|
+
string subject = 7;
|
|
86
|
+
// JSON-stringified Tiptap content (передаємо як string щоб не
|
|
87
|
+
// використовувати proto google.protobuf.Struct).
|
|
88
|
+
string content_json = 8;
|
|
89
|
+
string body_html = 9;
|
|
90
|
+
string body_text = 10;
|
|
91
|
+
// JSON array of variable names (для autocomplete).
|
|
92
|
+
string variables_json = 11;
|
|
93
|
+
bool is_active = 12;
|
|
94
|
+
int32 version = 13;
|
|
95
|
+
int64 created_at = 14;
|
|
96
|
+
int64 updated_at = 15;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
message TemplateResponse {
|
|
100
|
+
bool ok = 1;
|
|
101
|
+
NotificationTemplate template = 2;
|
|
102
|
+
string error_message = 3;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
// ─── List ────────────────────────────────────────────────────────────
|
|
107
|
+
|
|
108
|
+
message ListTemplatesRequest {
|
|
109
|
+
optional NotificationChannel channel = 1;
|
|
110
|
+
optional NotificationLocale locale = 2;
|
|
111
|
+
optional NotificationCategory category = 3;
|
|
112
|
+
optional string search = 4;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
message ListTemplatesResponse {
|
|
116
|
+
repeated NotificationTemplate items = 1;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
// ─── Get ─────────────────────────────────────────────────────────────
|
|
121
|
+
|
|
122
|
+
message GetTemplateRequest {
|
|
123
|
+
string id = 1;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
// ─── Upsert (create new) ─────────────────────────────────────────────
|
|
128
|
+
|
|
129
|
+
message UpsertTemplateRequest {
|
|
130
|
+
string key = 1;
|
|
131
|
+
NotificationChannel channel = 2;
|
|
132
|
+
NotificationLocale locale = 3;
|
|
133
|
+
NotificationCategory category = 4;
|
|
134
|
+
string title = 5;
|
|
135
|
+
string subject = 6;
|
|
136
|
+
string content_json = 7;
|
|
137
|
+
string body_html = 8;
|
|
138
|
+
string body_text = 9;
|
|
139
|
+
string variables_json = 10;
|
|
140
|
+
bool is_active = 11;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
// ─── Update by id (з versioning) ─────────────────────────────────────
|
|
145
|
+
|
|
146
|
+
message UpdateTemplateRequest {
|
|
147
|
+
string id = 1;
|
|
148
|
+
optional string title = 2;
|
|
149
|
+
optional string subject = 3;
|
|
150
|
+
optional string content_json = 4;
|
|
151
|
+
string body_html = 5;
|
|
152
|
+
string body_text = 6;
|
|
153
|
+
optional string variables_json = 7;
|
|
154
|
+
optional bool is_active = 8;
|
|
155
|
+
// Admin id для audit (хто змінив).
|
|
156
|
+
optional string actor_id = 9;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
// ─── Toggle (вмикання/вимикання) ────────────────────────────────────
|
|
161
|
+
|
|
162
|
+
message ToggleTemplateRequest {
|
|
163
|
+
string id = 1;
|
|
164
|
+
bool is_active = 2;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
// ─── Versions ────────────────────────────────────────────────────────
|
|
169
|
+
|
|
170
|
+
message NotificationTemplateVersion {
|
|
171
|
+
string id = 1;
|
|
172
|
+
int32 version = 2;
|
|
173
|
+
string title = 3;
|
|
174
|
+
string subject = 4;
|
|
175
|
+
string content_json = 5;
|
|
176
|
+
string body_html = 6;
|
|
177
|
+
string body_text = 7;
|
|
178
|
+
string variables_json = 8;
|
|
179
|
+
optional string created_by_id = 9;
|
|
180
|
+
int64 created_at = 10;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
message ListVersionsRequest {
|
|
184
|
+
string template_id = 1;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
message ListVersionsResponse {
|
|
188
|
+
repeated NotificationTemplateVersion items = 1;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
message RestoreVersionRequest {
|
|
192
|
+
string template_id = 1;
|
|
193
|
+
int32 version = 2;
|
|
194
|
+
optional string actor_id = 3;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
// ─── Preview ────────────────────────────────────────────────────────
|
|
199
|
+
|
|
200
|
+
message RenderPreviewRequest {
|
|
201
|
+
string body_html = 1;
|
|
202
|
+
// JSON-stringified variables { "order.number": "MD-2026-0001", ... }
|
|
203
|
+
string variables_json = 2;
|
|
204
|
+
optional string subject = 3;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
message RenderPreviewResponse {
|
|
208
|
+
string html = 1;
|
|
209
|
+
string subject = 2;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
// ─── Test send ───────────────────────────────────────────────────────
|
|
214
|
+
|
|
215
|
+
message SendTestRequest {
|
|
216
|
+
string template_id = 1;
|
|
217
|
+
// email або phone (залежно від channel).
|
|
218
|
+
string recipient = 2;
|
|
219
|
+
// JSON-stringified test variables.
|
|
220
|
+
string variables_json = 3;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
message SendTestResponse {
|
|
224
|
+
bool ok = 1;
|
|
225
|
+
string error_message = 2;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
// ─── Logs ────────────────────────────────────────────────────────────
|
|
230
|
+
|
|
231
|
+
message NotificationLog {
|
|
232
|
+
string id = 1;
|
|
233
|
+
string template_key = 2;
|
|
234
|
+
NotificationChannel channel = 3;
|
|
235
|
+
NotificationLocale locale = 4;
|
|
236
|
+
string recipient = 5;
|
|
237
|
+
optional string order_id = 6;
|
|
238
|
+
optional string user_id = 7;
|
|
239
|
+
NotificationStatus status = 8;
|
|
240
|
+
optional string provider_message_id = 9;
|
|
241
|
+
optional string provider_name = 10;
|
|
242
|
+
optional string error = 11;
|
|
243
|
+
optional int64 sent_at = 12;
|
|
244
|
+
int64 created_at = 13;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
message ListLogsRequest {
|
|
248
|
+
optional NotificationChannel channel = 1;
|
|
249
|
+
optional NotificationStatus status = 2;
|
|
250
|
+
optional string template_key = 3;
|
|
251
|
+
optional string order_id = 4;
|
|
252
|
+
optional string user_id = 5;
|
|
253
|
+
optional string recipient = 6;
|
|
254
|
+
optional int64 date_from = 7;
|
|
255
|
+
optional int64 date_to = 8;
|
|
256
|
+
int32 page = 9;
|
|
257
|
+
int32 limit = 10;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
message ListLogsResponse {
|
|
261
|
+
repeated NotificationLog items = 1;
|
|
262
|
+
int32 total = 2;
|
|
263
|
+
int32 page = 3;
|
|
264
|
+
int32 limit = 4;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
// ─── Telegram chats ──────────────────────────────────────────────────
|
|
269
|
+
|
|
270
|
+
message TelegramChat {
|
|
271
|
+
string id = 1;
|
|
272
|
+
string chat_id = 2;
|
|
273
|
+
TelegramTopic topic = 3;
|
|
274
|
+
string label = 4;
|
|
275
|
+
optional string tag = 5;
|
|
276
|
+
bool is_active = 6;
|
|
277
|
+
int64 created_at = 7;
|
|
278
|
+
int64 updated_at = 8;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
message TelegramChatResponse {
|
|
282
|
+
bool ok = 1;
|
|
283
|
+
TelegramChat chat = 2;
|
|
284
|
+
string error_message = 3;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
message ListChatsRequest {}
|
|
288
|
+
|
|
289
|
+
message ListChatsResponse {
|
|
290
|
+
repeated TelegramChat items = 1;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
message UpsertChatRequest {
|
|
294
|
+
string chat_id = 1;
|
|
295
|
+
TelegramTopic topic = 2;
|
|
296
|
+
string label = 3;
|
|
297
|
+
optional string tag = 4;
|
|
298
|
+
bool is_active = 5;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
message DeleteChatRequest {
|
|
302
|
+
string id = 1;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
message DeleteChatResponse {
|
|
306
|
+
bool ok = 1;
|
|
307
|
+
string error_message = 2;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
message TestSendTelegramRequest {
|
|
311
|
+
string chat_id = 1;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
message TestSendTelegramResponse {
|
|
315
|
+
bool ok = 1;
|
|
316
|
+
string error_message = 2;
|
|
317
|
+
}
|
package/proto/order.proto
CHANGED
|
@@ -69,6 +69,9 @@ message OrderDelivery {
|
|
|
69
69
|
string tracking_url = 10;
|
|
70
70
|
string estimated_date = 11;
|
|
71
71
|
string shipment_status = 12;
|
|
72
|
+
// Адмін-облік: область/регіон з City.region від delivery-service.
|
|
73
|
+
// Старі замовлення можуть мати порожнє значення.
|
|
74
|
+
string region = 13;
|
|
72
75
|
}
|
|
73
76
|
|
|
74
77
|
message OrderPayment {
|
|
@@ -82,6 +85,10 @@ message OrderPayment {
|
|
|
82
85
|
int64 captured_at = 8;
|
|
83
86
|
int64 cancelled_at = 9;
|
|
84
87
|
int64 refunded_at = 10;
|
|
88
|
+
// Денормалізовано з payment-service для відображення в адмінці
|
|
89
|
+
// без додаткового gRPC дзвінка. Оновлюється з payment-events listener.
|
|
90
|
+
double captured_amount = 11;
|
|
91
|
+
double refunded_amount = 12;
|
|
85
92
|
}
|
|
86
93
|
|
|
87
94
|
message OrderNote {
|
|
@@ -153,6 +160,10 @@ message Order {
|
|
|
153
160
|
|
|
154
161
|
int64 created_at = 20;
|
|
155
162
|
int64 updated_at = 21;
|
|
163
|
+
|
|
164
|
+
// Внутрішні нотатки менеджерів (видимі тільки в адмінці).
|
|
165
|
+
// Сортуються від новіших до старіших — server-side.
|
|
166
|
+
repeated OrderNote notes = 22;
|
|
156
167
|
}
|
|
157
168
|
|
|
158
169
|
// ─── Requests ──────────────────────────────────────────────────
|