@aepstore-dev/contracts 1.0.5 → 1.1.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/dist/proto/paths.d.ts +15 -0
- package/dist/proto/paths.js +18 -2
- package/gen/activity.ts +281 -0
- package/gen/auth.ts +171 -13
- package/gen/mail.ts +91 -0
- package/gen/products.ts +452 -0
- package/gen/taxonomy.ts +131 -0
- package/gen/upload.ts +98 -0
- package/gen/users.ts +269 -0
- package/package.json +8 -5
- package/proto/activity.proto +201 -0
- package/proto/auth.proto +106 -13
- package/proto/mail.proto +42 -0
- package/proto/products.proto +327 -0
- package/proto/taxonomy.proto +78 -0
- package/proto/upload.proto +49 -0
- package/proto/users.proto +222 -0
package/gen/users.ts
ADDED
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.10.1
|
|
4
|
+
// protoc v7.35.0
|
|
5
|
+
// source: users.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "users.v1";
|
|
12
|
+
|
|
13
|
+
export enum UserFieldsType {
|
|
14
|
+
USER_FIELDS_TYPE_UNSPECIFIED = 0,
|
|
15
|
+
USER_FIELDS_TYPE_VIDEOS = 1,
|
|
16
|
+
USER_FIELDS_TYPE_PRODUCTS = 2,
|
|
17
|
+
USER_FIELDS_TYPE_SUBSCRIPTIONS = 3,
|
|
18
|
+
USER_FIELDS_TYPE_SUBSCRIBERS = 4,
|
|
19
|
+
UNRECOGNIZED = -1,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface User {
|
|
23
|
+
id: string;
|
|
24
|
+
email: string;
|
|
25
|
+
username: string;
|
|
26
|
+
avatarUrl: string;
|
|
27
|
+
roles: string[];
|
|
28
|
+
/** primary role for backwards compat */
|
|
29
|
+
role: string;
|
|
30
|
+
/** ISO 8601 */
|
|
31
|
+
createdAt: string;
|
|
32
|
+
updatedAt: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface Country {
|
|
36
|
+
id: string;
|
|
37
|
+
code: string;
|
|
38
|
+
name: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface SocialMedia {
|
|
42
|
+
id: string;
|
|
43
|
+
platform: string;
|
|
44
|
+
url: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface CreateSocialMedia {
|
|
48
|
+
platform: string;
|
|
49
|
+
url: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface Product {
|
|
53
|
+
id: string;
|
|
54
|
+
name: string;
|
|
55
|
+
description: string;
|
|
56
|
+
/** Decimal as string (D7) */
|
|
57
|
+
price: string;
|
|
58
|
+
createdAt: string;
|
|
59
|
+
updatedAt: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface Video {
|
|
63
|
+
id: string;
|
|
64
|
+
title: string;
|
|
65
|
+
description: string;
|
|
66
|
+
url: string;
|
|
67
|
+
createdAt: string;
|
|
68
|
+
updatedAt: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface ActiveDevice {
|
|
72
|
+
id: string;
|
|
73
|
+
userAgent: string;
|
|
74
|
+
ip: string;
|
|
75
|
+
createdAt: string;
|
|
76
|
+
lastUsedAt: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface ProfileStats {
|
|
80
|
+
subscribersCount: number;
|
|
81
|
+
subscriptionsCount: number;
|
|
82
|
+
productsCount: number;
|
|
83
|
+
videosCount: number;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface GetPublicProfileRequest {
|
|
87
|
+
username: string;
|
|
88
|
+
/** optional — present when caller is authenticated */
|
|
89
|
+
viewerUserId: string;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface PublicProfileResponse {
|
|
93
|
+
id: string;
|
|
94
|
+
username: string;
|
|
95
|
+
fullName: string;
|
|
96
|
+
/** Decimal as string */
|
|
97
|
+
rating: string;
|
|
98
|
+
aboutMe: string;
|
|
99
|
+
socialMedia: SocialMedia[];
|
|
100
|
+
stats: ProfileStats | undefined;
|
|
101
|
+
videos: Video[];
|
|
102
|
+
products: Product[];
|
|
103
|
+
country: Country | undefined;
|
|
104
|
+
avatarUrl: string;
|
|
105
|
+
bannerUrl: string;
|
|
106
|
+
role: string;
|
|
107
|
+
createdAt: string;
|
|
108
|
+
hideSubscriptions: boolean;
|
|
109
|
+
/** Either populated lists or empty depending on hide_subscriptions */
|
|
110
|
+
subscriptions: User[];
|
|
111
|
+
subscribers: User[];
|
|
112
|
+
isOwner: boolean;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface UpdateProfileRequest {
|
|
116
|
+
userId: string;
|
|
117
|
+
fullName: string;
|
|
118
|
+
aboutMe: string;
|
|
119
|
+
newsletterSubscription: boolean;
|
|
120
|
+
hideSubscriptions: boolean;
|
|
121
|
+
avatarUrl: string;
|
|
122
|
+
bannerUrl: string;
|
|
123
|
+
countryId: string;
|
|
124
|
+
timezone: string;
|
|
125
|
+
socialMedia: CreateSocialMedia[];
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface UpdateUserRequest {
|
|
129
|
+
userId: string;
|
|
130
|
+
username: string;
|
|
131
|
+
email: string;
|
|
132
|
+
/** confirmation code when changing email/username */
|
|
133
|
+
code: string;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export interface UserResponse {
|
|
137
|
+
user: User | undefined;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface UpdateUserRoleRequest {
|
|
141
|
+
adminId: string;
|
|
142
|
+
userId: string;
|
|
143
|
+
role: string;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export interface GetUsersRequest {
|
|
147
|
+
page: string;
|
|
148
|
+
limit: string;
|
|
149
|
+
search: string;
|
|
150
|
+
roleName: string;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export interface GetUsersResponse {
|
|
154
|
+
items: User[];
|
|
155
|
+
total: number;
|
|
156
|
+
page: number;
|
|
157
|
+
limit: number;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface GetActiveDevicesRequest {
|
|
161
|
+
userId: string;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface GetActiveDevicesResponse {
|
|
165
|
+
devices: ActiveDevice[];
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export interface ManageDevicesRequest {
|
|
169
|
+
userId: string;
|
|
170
|
+
deviceIdsToRemove: string[];
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export interface ManageDevicesResponse {
|
|
174
|
+
ok: boolean;
|
|
175
|
+
removedCount: number;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export interface GetUserFieldsRequest {
|
|
179
|
+
username: string;
|
|
180
|
+
type: UserFieldsType;
|
|
181
|
+
page: number;
|
|
182
|
+
limit: number;
|
|
183
|
+
/** optional */
|
|
184
|
+
viewerUserId: string;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export interface GetUserFieldsResponse {
|
|
188
|
+
videos: Video[];
|
|
189
|
+
products: Product[];
|
|
190
|
+
subscriptions: User[];
|
|
191
|
+
subscribers: User[];
|
|
192
|
+
total: number;
|
|
193
|
+
page: number;
|
|
194
|
+
limit: number;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export const USERS_V1_PACKAGE_NAME = "users.v1";
|
|
198
|
+
|
|
199
|
+
export interface UsersServiceClient {
|
|
200
|
+
getPublicProfile(request: GetPublicProfileRequest): Observable<PublicProfileResponse>;
|
|
201
|
+
|
|
202
|
+
updateProfile(request: UpdateProfileRequest): Observable<PublicProfileResponse>;
|
|
203
|
+
|
|
204
|
+
updateUser(request: UpdateUserRequest): Observable<UserResponse>;
|
|
205
|
+
|
|
206
|
+
updateUserRole(request: UpdateUserRoleRequest): Observable<UserResponse>;
|
|
207
|
+
|
|
208
|
+
getUsers(request: GetUsersRequest): Observable<GetUsersResponse>;
|
|
209
|
+
|
|
210
|
+
getActiveDevices(request: GetActiveDevicesRequest): Observable<GetActiveDevicesResponse>;
|
|
211
|
+
|
|
212
|
+
manageDevices(request: ManageDevicesRequest): Observable<ManageDevicesResponse>;
|
|
213
|
+
|
|
214
|
+
getUserFields(request: GetUserFieldsRequest): Observable<GetUserFieldsResponse>;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export interface UsersServiceController {
|
|
218
|
+
getPublicProfile(
|
|
219
|
+
request: GetPublicProfileRequest,
|
|
220
|
+
): Promise<PublicProfileResponse> | Observable<PublicProfileResponse> | PublicProfileResponse;
|
|
221
|
+
|
|
222
|
+
updateProfile(
|
|
223
|
+
request: UpdateProfileRequest,
|
|
224
|
+
): Promise<PublicProfileResponse> | Observable<PublicProfileResponse> | PublicProfileResponse;
|
|
225
|
+
|
|
226
|
+
updateUser(request: UpdateUserRequest): Promise<UserResponse> | Observable<UserResponse> | UserResponse;
|
|
227
|
+
|
|
228
|
+
updateUserRole(request: UpdateUserRoleRequest): Promise<UserResponse> | Observable<UserResponse> | UserResponse;
|
|
229
|
+
|
|
230
|
+
getUsers(request: GetUsersRequest): Promise<GetUsersResponse> | Observable<GetUsersResponse> | GetUsersResponse;
|
|
231
|
+
|
|
232
|
+
getActiveDevices(
|
|
233
|
+
request: GetActiveDevicesRequest,
|
|
234
|
+
): Promise<GetActiveDevicesResponse> | Observable<GetActiveDevicesResponse> | GetActiveDevicesResponse;
|
|
235
|
+
|
|
236
|
+
manageDevices(
|
|
237
|
+
request: ManageDevicesRequest,
|
|
238
|
+
): Promise<ManageDevicesResponse> | Observable<ManageDevicesResponse> | ManageDevicesResponse;
|
|
239
|
+
|
|
240
|
+
getUserFields(
|
|
241
|
+
request: GetUserFieldsRequest,
|
|
242
|
+
): Promise<GetUserFieldsResponse> | Observable<GetUserFieldsResponse> | GetUserFieldsResponse;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export function UsersServiceControllerMethods() {
|
|
246
|
+
return function (constructor: Function) {
|
|
247
|
+
const grpcMethods: string[] = [
|
|
248
|
+
"getPublicProfile",
|
|
249
|
+
"updateProfile",
|
|
250
|
+
"updateUser",
|
|
251
|
+
"updateUserRole",
|
|
252
|
+
"getUsers",
|
|
253
|
+
"getActiveDevices",
|
|
254
|
+
"manageDevices",
|
|
255
|
+
"getUserFields",
|
|
256
|
+
];
|
|
257
|
+
for (const method of grpcMethods) {
|
|
258
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
259
|
+
GrpcMethod("UsersService", method)(constructor.prototype[method], method, descriptor);
|
|
260
|
+
}
|
|
261
|
+
const grpcStreamMethods: string[] = [];
|
|
262
|
+
for (const method of grpcStreamMethods) {
|
|
263
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
264
|
+
GrpcStreamMethod("UsersService", method)(constructor.prototype[method], method, descriptor);
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export const USERS_SERVICE_NAME = "UsersService";
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aepstore-dev/contracts",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Protobuf definitions for aepstore microservices",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"generate": "
|
|
8
|
+
"generate": "node scripts/generate.cjs",
|
|
9
9
|
"build": "tsc -p tsconfig.build.json"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
@@ -20,13 +20,16 @@
|
|
|
20
20
|
"name": "torroixq",
|
|
21
21
|
"email": "cato.ixq@gmail.com"
|
|
22
22
|
},
|
|
23
|
-
"
|
|
23
|
+
"peerDependencies": {
|
|
24
24
|
"@nestjs/microservices": "^11.1.11",
|
|
25
|
-
"rxjs": "^7.8.2"
|
|
26
|
-
"ts-proto": "^2.10.1"
|
|
25
|
+
"rxjs": "^7.8.2"
|
|
27
26
|
},
|
|
28
27
|
"devDependencies": {
|
|
28
|
+
"@nestjs/microservices": "^11.1.11",
|
|
29
|
+
"@protobuf-ts/protoc": "^2.9.4",
|
|
29
30
|
"@types/node": "^25.0.3",
|
|
31
|
+
"rxjs": "^7.8.2",
|
|
32
|
+
"ts-proto": "^2.10.1",
|
|
30
33
|
"typescript": "^5.9.3"
|
|
31
34
|
}
|
|
32
35
|
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package activity.v1;
|
|
4
|
+
|
|
5
|
+
service ActivityService {
|
|
6
|
+
// Reports
|
|
7
|
+
rpc ReportCreate(CreateReportRequest) returns (ReportResponse);
|
|
8
|
+
rpc ReportList(ListReportsRequest) returns (ReportsListResponse);
|
|
9
|
+
rpc ReportGet(ReportIdRequest) returns (ReportResponse);
|
|
10
|
+
rpc ReportModerate(ModerateReportRequest) returns (ReportResponse);
|
|
11
|
+
|
|
12
|
+
// Report categories
|
|
13
|
+
rpc ReportCategoryCreate(CreateReportCategoryRequest) returns (ReportCategoryResponse);
|
|
14
|
+
rpc ReportCategoryList(ListReportCategoriesRequest) returns (ReportCategoriesListResponse);
|
|
15
|
+
rpc ReportCategoryGet(ReportCategoryIdRequest) returns (ReportCategoryResponse);
|
|
16
|
+
rpc ReportCategoryUpdate(UpdateReportCategoryRequest) returns (ReportCategoryResponse);
|
|
17
|
+
rpc ReportCategoryDelete(ReportCategoryIdRequest) returns (Ok);
|
|
18
|
+
|
|
19
|
+
// Reviews
|
|
20
|
+
rpc ReviewCreate(CreateReviewRequest) returns (ReviewResponse);
|
|
21
|
+
rpc GetProductReviews(GetProductReviewsRequest) returns (ReviewsListResponse);
|
|
22
|
+
|
|
23
|
+
// Subscriptions
|
|
24
|
+
rpc ToggleSubscription(ToggleSubscriptionRequest) returns (ToggleSubscriptionResponse);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// =================================================================
|
|
28
|
+
// Enums
|
|
29
|
+
// =================================================================
|
|
30
|
+
|
|
31
|
+
enum ReportType {
|
|
32
|
+
REPORT_TYPE_UNSPECIFIED = 0;
|
|
33
|
+
REPORT_TYPE_PRODUCT = 1;
|
|
34
|
+
REPORT_TYPE_PROFILE = 2;
|
|
35
|
+
REPORT_TYPE_REVIEW = 3;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
enum ReportStatus {
|
|
39
|
+
REPORT_STATUS_UNSPECIFIED = 0;
|
|
40
|
+
REPORT_STATUS_PENDING = 1;
|
|
41
|
+
REPORT_STATUS_IN_PROGRESS = 2;
|
|
42
|
+
REPORT_STATUS_RESOLVED = 3;
|
|
43
|
+
REPORT_STATUS_DISMISSED = 4;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// =================================================================
|
|
47
|
+
// Reports
|
|
48
|
+
// =================================================================
|
|
49
|
+
|
|
50
|
+
message Report {
|
|
51
|
+
string id = 1;
|
|
52
|
+
ReportType type = 2;
|
|
53
|
+
string object_id = 3;
|
|
54
|
+
string user_id = 4;
|
|
55
|
+
string product_id = 5;
|
|
56
|
+
repeated ReportCategory categories = 6;
|
|
57
|
+
string message = 7;
|
|
58
|
+
ReportStatus status = 8;
|
|
59
|
+
string created_at = 9;
|
|
60
|
+
string updated_at = 10;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
message ReportResponse {
|
|
64
|
+
Report report = 1;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
message CreateReportRequest {
|
|
68
|
+
string user_id = 1;
|
|
69
|
+
ReportType type = 2;
|
|
70
|
+
string object_id = 3;
|
|
71
|
+
repeated string categories = 4; // names
|
|
72
|
+
string message = 5;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
message ListReportsRequest {
|
|
76
|
+
ReportType type = 1;
|
|
77
|
+
ReportStatus status = 2;
|
|
78
|
+
string user_id = 3;
|
|
79
|
+
string object_id = 4;
|
|
80
|
+
int32 page = 5;
|
|
81
|
+
int32 limit = 6;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
message ReportsListResponse {
|
|
85
|
+
repeated Report items = 1;
|
|
86
|
+
int32 total = 2;
|
|
87
|
+
int32 page = 3;
|
|
88
|
+
int32 limit = 4;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
message ReportIdRequest {
|
|
92
|
+
string id = 1;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
message ModerateReportRequest {
|
|
96
|
+
string id = 1;
|
|
97
|
+
string action = 2; // 'accept' | 'reject'
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// =================================================================
|
|
101
|
+
// Report categories
|
|
102
|
+
// =================================================================
|
|
103
|
+
|
|
104
|
+
message ReportCategory {
|
|
105
|
+
string id = 1;
|
|
106
|
+
string name = 2;
|
|
107
|
+
ReportType type = 3;
|
|
108
|
+
string icon = 4;
|
|
109
|
+
string description = 5;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
message ReportCategoryResponse {
|
|
113
|
+
ReportCategory category = 1;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
message CreateReportCategoryRequest {
|
|
117
|
+
string name = 1;
|
|
118
|
+
ReportType type = 2;
|
|
119
|
+
string icon = 3;
|
|
120
|
+
string description = 4;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
message UpdateReportCategoryRequest {
|
|
124
|
+
string id = 1;
|
|
125
|
+
string name = 2;
|
|
126
|
+
string icon = 3;
|
|
127
|
+
string description = 4;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
message ListReportCategoriesRequest {
|
|
131
|
+
ReportType type = 1;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
message ReportCategoriesListResponse {
|
|
135
|
+
repeated ReportCategory items = 1;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
message ReportCategoryIdRequest {
|
|
139
|
+
string id = 1;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// =================================================================
|
|
143
|
+
// Reviews
|
|
144
|
+
// =================================================================
|
|
145
|
+
|
|
146
|
+
message Review {
|
|
147
|
+
string id = 1;
|
|
148
|
+
int32 rating = 2;
|
|
149
|
+
string text = 3;
|
|
150
|
+
string user_id = 4;
|
|
151
|
+
string product_id = 5;
|
|
152
|
+
string created_at = 6;
|
|
153
|
+
string updated_at = 7;
|
|
154
|
+
string user_username = 8;
|
|
155
|
+
string user_avatar_url = 9;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
message ReviewResponse {
|
|
159
|
+
Review review = 1;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
message CreateReviewRequest {
|
|
163
|
+
string user_id = 1;
|
|
164
|
+
string product_id = 2;
|
|
165
|
+
int32 rating = 3;
|
|
166
|
+
string text = 4;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
message GetProductReviewsRequest {
|
|
170
|
+
string product_id = 1;
|
|
171
|
+
int32 page = 2;
|
|
172
|
+
int32 limit = 3;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
message ReviewsListResponse {
|
|
176
|
+
repeated Review items = 1;
|
|
177
|
+
int32 total = 2;
|
|
178
|
+
int32 page = 3;
|
|
179
|
+
int32 limit = 4;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// =================================================================
|
|
183
|
+
// Subscriptions
|
|
184
|
+
// =================================================================
|
|
185
|
+
|
|
186
|
+
message ToggleSubscriptionRequest {
|
|
187
|
+
string user_id = 1;
|
|
188
|
+
string target_username = 2;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
message ToggleSubscriptionResponse {
|
|
192
|
+
bool subscribed = 1;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// =================================================================
|
|
196
|
+
// Misc
|
|
197
|
+
// =================================================================
|
|
198
|
+
|
|
199
|
+
message Ok {
|
|
200
|
+
bool ok = 1;
|
|
201
|
+
}
|
package/proto/auth.proto
CHANGED
|
@@ -2,27 +2,120 @@ syntax = "proto3";
|
|
|
2
2
|
|
|
3
3
|
package auth.v1;
|
|
4
4
|
|
|
5
|
+
// Ported from legacy auth-service (@MessagePattern → @GrpcMethod).
|
|
6
|
+
// All tokens are HMAC primitives minted by @aepstore-dev/passport;
|
|
7
|
+
// the access token only carries `userId`. Username / roles / 2FA state
|
|
8
|
+
// must be looked up via Prisma or RbacService on the consumer side.
|
|
5
9
|
service AuthService {
|
|
6
|
-
rpc
|
|
7
|
-
rpc
|
|
10
|
+
rpc Login(LoginRequest) returns (AuthResponse);
|
|
11
|
+
rpc Register(RegisterRequest) returns (AuthResponse);
|
|
12
|
+
rpc CreateCode(CreateCodeRequest) returns (CreateCodeResponse);
|
|
13
|
+
rpc VerifyCode(VerifyCodeRequest) returns (VerifyCodeResponse);
|
|
14
|
+
rpc CheckToken(CheckTokenRequest) returns (CheckTokenResponse);
|
|
15
|
+
rpc RefreshToken(RefreshTokenRequest) returns (AuthResponse);
|
|
16
|
+
rpc Get2faStatus(Get2faStatusRequest) returns (Get2faStatusResponse);
|
|
17
|
+
rpc GetProfile(GetProfileRequest) returns (UserProfileResponse);
|
|
18
|
+
rpc CleanupExpiredTotpSetups(Empty) returns (Empty);
|
|
8
19
|
}
|
|
9
20
|
|
|
10
|
-
|
|
11
|
-
|
|
21
|
+
// Login by username OR email (one of the two must be set).
|
|
22
|
+
message LoginRequest {
|
|
23
|
+
string password = 1;
|
|
24
|
+
string username = 2; // optional
|
|
25
|
+
string email = 3; // optional
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
message RegisterRequest {
|
|
29
|
+
string email = 1;
|
|
30
|
+
string username = 2;
|
|
31
|
+
string password = 3;
|
|
32
|
+
string ip = 4; // optional, attached by gateway from req
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Standard tokens-plus-user payload returned by Login / Register / RefreshToken.
|
|
36
|
+
message AuthResponse {
|
|
37
|
+
string access_token = 1;
|
|
38
|
+
string refresh_token = 2;
|
|
39
|
+
AuthUser user = 3;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
message AuthUser {
|
|
43
|
+
string id = 1;
|
|
44
|
+
string email = 2;
|
|
45
|
+
string username = 3;
|
|
46
|
+
string role = 4; // primary role for backwards compat ("User" / "Administrator" / "Moderator")
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Code types: '2fa', 'reset', 'confirm', 'totp' (legacy strings preserved as-is).
|
|
50
|
+
message CreateCodeRequest {
|
|
51
|
+
string email = 1;
|
|
12
52
|
string type = 2;
|
|
13
53
|
}
|
|
14
54
|
|
|
15
|
-
message
|
|
55
|
+
message CreateCodeResponse {
|
|
16
56
|
bool ok = 1;
|
|
17
57
|
}
|
|
18
58
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
string
|
|
22
|
-
string code =
|
|
59
|
+
// `new_password` is only used by the 'reset' flow.
|
|
60
|
+
message VerifyCodeRequest {
|
|
61
|
+
string email = 1;
|
|
62
|
+
string code = 2;
|
|
63
|
+
string type = 3;
|
|
64
|
+
string new_password = 4; // optional
|
|
23
65
|
}
|
|
24
66
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
67
|
+
// Some verification flows (e.g. confirm-on-register) issue tokens immediately;
|
|
68
|
+
// others just return ok=true.
|
|
69
|
+
message VerifyCodeResponse {
|
|
70
|
+
bool ok = 1;
|
|
71
|
+
string access_token = 2; // optional
|
|
72
|
+
string refresh_token = 3; // optional
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
message CheckTokenRequest {
|
|
76
|
+
string token = 1;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
message CheckTokenResponse {
|
|
80
|
+
bool valid = 1;
|
|
81
|
+
string user_id = 2;
|
|
82
|
+
string reason = 3; // populated when valid=false
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
message RefreshTokenRequest {
|
|
86
|
+
string refresh_token = 1;
|
|
87
|
+
string user_agent = 2; // optional
|
|
88
|
+
string ip = 3; // optional
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
message Get2faStatusRequest {
|
|
92
|
+
string username = 1;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
message Get2faStatusResponse {
|
|
96
|
+
bool enabled = 1;
|
|
97
|
+
TwoFactorType type = 2;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
enum TwoFactorType {
|
|
101
|
+
NONE = 0;
|
|
102
|
+
APP = 1;
|
|
103
|
+
EMAIL = 2;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
message GetProfileRequest {
|
|
107
|
+
string user_id = 1;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
message UserProfileResponse {
|
|
111
|
+
string id = 1;
|
|
112
|
+
string email = 2;
|
|
113
|
+
string username = 3;
|
|
114
|
+
string full_name = 4;
|
|
115
|
+
bool is_verified = 5;
|
|
116
|
+
bool two_factor_enabled = 6;
|
|
117
|
+
TwoFactorType two_factor_type = 7;
|
|
118
|
+
repeated string roles = 8;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
message Empty {}
|
package/proto/mail.proto
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package mail.v1;
|
|
4
|
+
|
|
5
|
+
// Legacy mail-service used @EventPattern (fire-and-forget). In the new gRPC
|
|
6
|
+
// stack each becomes a unary RPC that returns an Ack. Callers ignore the
|
|
7
|
+
// response if they don't care about delivery.
|
|
8
|
+
service MailService {
|
|
9
|
+
rpc SendReg(SendRegRequest) returns (MailAck);
|
|
10
|
+
rpc Send2fa(Send2faRequest) returns (MailAck);
|
|
11
|
+
rpc SendPasswordReset(SendPasswordResetRequest) returns (MailAck);
|
|
12
|
+
rpc SendRegistrationConfirm(SendRegistrationConfirmRequest) returns (MailAck);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
message MailAck {
|
|
16
|
+
bool queued = 1;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
message SendRegRequest {
|
|
20
|
+
string user_id = 1;
|
|
21
|
+
string email = 2;
|
|
22
|
+
string username = 3;
|
|
23
|
+
string full_name = 4;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
message Send2faRequest {
|
|
27
|
+
string email = 1;
|
|
28
|
+
string code = 2;
|
|
29
|
+
string username = 3;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
message SendPasswordResetRequest {
|
|
33
|
+
string email = 1;
|
|
34
|
+
string code = 2;
|
|
35
|
+
string username = 3;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
message SendRegistrationConfirmRequest {
|
|
39
|
+
string email = 1;
|
|
40
|
+
string code = 2;
|
|
41
|
+
string username = 3;
|
|
42
|
+
}
|