@aepstore-dev/contracts 1.0.6 → 1.2.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 +164 -19
- package/gen/mail.ts +91 -0
- package/gen/products.ts +452 -0
- package/gen/taxonomy.ts +131 -0
- package/gen/upload.ts +217 -0
- package/gen/users.ts +269 -0
- package/package.json +8 -5
- package/proto/activity.proto +201 -0
- package/proto/auth.proto +101 -18
- package/proto/mail.proto +42 -0
- package/proto/products.proto +327 -0
- package/proto/taxonomy.proto +78 -0
- package/proto/upload.proto +135 -0
- package/proto/users.proto +222 -0
package/gen/upload.ts
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
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: upload.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "upload.v1";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Determines the object key prefix (and future ACL/privacy policy).
|
|
15
|
+
* ATTACHMENT = paid product deliverable (private; presigned GET only after purchase).
|
|
16
|
+
* MEDIA / AVATAR / BANNER = preview assets.
|
|
17
|
+
*/
|
|
18
|
+
export enum UploadKind {
|
|
19
|
+
UPLOAD_KIND_UNSPECIFIED = 0,
|
|
20
|
+
UPLOAD_KIND_ATTACHMENT = 1,
|
|
21
|
+
UPLOAD_KIND_MEDIA = 2,
|
|
22
|
+
UPLOAD_KIND_AVATAR = 3,
|
|
23
|
+
UPLOAD_KIND_BANNER = 4,
|
|
24
|
+
UNRECOGNIZED = -1,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface Ok {
|
|
28
|
+
ok: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface CreateMultipartUploadRequest {
|
|
32
|
+
fileName: string;
|
|
33
|
+
mimeType: string;
|
|
34
|
+
fileSize: number;
|
|
35
|
+
kind: UploadKind;
|
|
36
|
+
/** user initiating, for key namespacing + audit */
|
|
37
|
+
ownerId: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface CreateMultipartUploadResponse {
|
|
41
|
+
/** S3 multipart UploadId */
|
|
42
|
+
uploadId: string;
|
|
43
|
+
/** object key this service generated */
|
|
44
|
+
fileKey: string;
|
|
45
|
+
/** recommended part size (bytes) the client should slice with */
|
|
46
|
+
partSize: number;
|
|
47
|
+
/** number of parts for file_size at part_size */
|
|
48
|
+
partCount: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface SignPartRequest {
|
|
52
|
+
fileKey: string;
|
|
53
|
+
uploadId: string;
|
|
54
|
+
/** 1-based */
|
|
55
|
+
partNumber: number;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface SignPartResponse {
|
|
59
|
+
/** presigned PUT URL for this single part */
|
|
60
|
+
url: string;
|
|
61
|
+
expiresIn: number;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface CompletedPart {
|
|
65
|
+
partNumber: number;
|
|
66
|
+
/** ETag the client received in the S3 PUT response header for this part */
|
|
67
|
+
etag: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface CompleteMultipartUploadRequest {
|
|
71
|
+
fileKey: string;
|
|
72
|
+
uploadId: string;
|
|
73
|
+
parts: CompletedPart[];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface CompleteMultipartUploadResponse {
|
|
77
|
+
fileKey: string;
|
|
78
|
+
/** final object location (internal reference) */
|
|
79
|
+
location: string;
|
|
80
|
+
fileSize: number;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface AbortMultipartUploadRequest {
|
|
84
|
+
fileKey: string;
|
|
85
|
+
uploadId: string;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface CreateUploadUrlRequest {
|
|
89
|
+
fileName: string;
|
|
90
|
+
mimeType: string;
|
|
91
|
+
kind: UploadKind;
|
|
92
|
+
ownerId: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface CreateUploadUrlResponse {
|
|
96
|
+
/** presigned PUT URL (client PUTs the whole file) */
|
|
97
|
+
url: string;
|
|
98
|
+
fileKey: string;
|
|
99
|
+
expiresIn: number;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface SignedUrlRequest {
|
|
103
|
+
fileKey: string;
|
|
104
|
+
/** optional, default 3600 */
|
|
105
|
+
expiresIn: number;
|
|
106
|
+
/** optional: forces Content-Disposition attachment filename */
|
|
107
|
+
downloadFileName: string;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface SignedUrlResponse {
|
|
111
|
+
signedUrl: string;
|
|
112
|
+
expiresIn: number;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface DeleteObjectRequest {
|
|
116
|
+
fileKey: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export const UPLOAD_V1_PACKAGE_NAME = "upload.v1";
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Thin signing service. File bytes NEVER pass through this service — clients
|
|
123
|
+
* upload/download directly to/from S3 (Yandex Object Storage) using presigned
|
|
124
|
+
* URLs this service mints. Memory/bandwidth flat regardless of file size.
|
|
125
|
+
*
|
|
126
|
+
* Large files (product deliverables, up to ~1GB) use the multipart flow:
|
|
127
|
+
* CreateMultipartUpload → (SignPart × N, client PUTs each part to S3) →
|
|
128
|
+
* CompleteMultipartUpload (or AbortMultipartUpload on failure)
|
|
129
|
+
*
|
|
130
|
+
* Small files (preview images, avatars) use the single-PUT flow: CreateUploadUrl.
|
|
131
|
+
*
|
|
132
|
+
* Downloads are gated elsewhere (products-service verifies purchase, then calls
|
|
133
|
+
* GenerateSignedUrl). This service does not know about purchases.
|
|
134
|
+
*/
|
|
135
|
+
|
|
136
|
+
export interface UploadServiceClient {
|
|
137
|
+
createMultipartUpload(request: CreateMultipartUploadRequest): Observable<CreateMultipartUploadResponse>;
|
|
138
|
+
|
|
139
|
+
signPart(request: SignPartRequest): Observable<SignPartResponse>;
|
|
140
|
+
|
|
141
|
+
completeMultipartUpload(request: CompleteMultipartUploadRequest): Observable<CompleteMultipartUploadResponse>;
|
|
142
|
+
|
|
143
|
+
abortMultipartUpload(request: AbortMultipartUploadRequest): Observable<Ok>;
|
|
144
|
+
|
|
145
|
+
createUploadUrl(request: CreateUploadUrlRequest): Observable<CreateUploadUrlResponse>;
|
|
146
|
+
|
|
147
|
+
generateSignedUrl(request: SignedUrlRequest): Observable<SignedUrlResponse>;
|
|
148
|
+
|
|
149
|
+
deleteObject(request: DeleteObjectRequest): Observable<Ok>;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Thin signing service. File bytes NEVER pass through this service — clients
|
|
154
|
+
* upload/download directly to/from S3 (Yandex Object Storage) using presigned
|
|
155
|
+
* URLs this service mints. Memory/bandwidth flat regardless of file size.
|
|
156
|
+
*
|
|
157
|
+
* Large files (product deliverables, up to ~1GB) use the multipart flow:
|
|
158
|
+
* CreateMultipartUpload → (SignPart × N, client PUTs each part to S3) →
|
|
159
|
+
* CompleteMultipartUpload (or AbortMultipartUpload on failure)
|
|
160
|
+
*
|
|
161
|
+
* Small files (preview images, avatars) use the single-PUT flow: CreateUploadUrl.
|
|
162
|
+
*
|
|
163
|
+
* Downloads are gated elsewhere (products-service verifies purchase, then calls
|
|
164
|
+
* GenerateSignedUrl). This service does not know about purchases.
|
|
165
|
+
*/
|
|
166
|
+
|
|
167
|
+
export interface UploadServiceController {
|
|
168
|
+
createMultipartUpload(
|
|
169
|
+
request: CreateMultipartUploadRequest,
|
|
170
|
+
): Promise<CreateMultipartUploadResponse> | Observable<CreateMultipartUploadResponse> | CreateMultipartUploadResponse;
|
|
171
|
+
|
|
172
|
+
signPart(request: SignPartRequest): Promise<SignPartResponse> | Observable<SignPartResponse> | SignPartResponse;
|
|
173
|
+
|
|
174
|
+
completeMultipartUpload(
|
|
175
|
+
request: CompleteMultipartUploadRequest,
|
|
176
|
+
):
|
|
177
|
+
| Promise<CompleteMultipartUploadResponse>
|
|
178
|
+
| Observable<CompleteMultipartUploadResponse>
|
|
179
|
+
| CompleteMultipartUploadResponse;
|
|
180
|
+
|
|
181
|
+
abortMultipartUpload(request: AbortMultipartUploadRequest): Promise<Ok> | Observable<Ok> | Ok;
|
|
182
|
+
|
|
183
|
+
createUploadUrl(
|
|
184
|
+
request: CreateUploadUrlRequest,
|
|
185
|
+
): Promise<CreateUploadUrlResponse> | Observable<CreateUploadUrlResponse> | CreateUploadUrlResponse;
|
|
186
|
+
|
|
187
|
+
generateSignedUrl(
|
|
188
|
+
request: SignedUrlRequest,
|
|
189
|
+
): Promise<SignedUrlResponse> | Observable<SignedUrlResponse> | SignedUrlResponse;
|
|
190
|
+
|
|
191
|
+
deleteObject(request: DeleteObjectRequest): Promise<Ok> | Observable<Ok> | Ok;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export function UploadServiceControllerMethods() {
|
|
195
|
+
return function (constructor: Function) {
|
|
196
|
+
const grpcMethods: string[] = [
|
|
197
|
+
"createMultipartUpload",
|
|
198
|
+
"signPart",
|
|
199
|
+
"completeMultipartUpload",
|
|
200
|
+
"abortMultipartUpload",
|
|
201
|
+
"createUploadUrl",
|
|
202
|
+
"generateSignedUrl",
|
|
203
|
+
"deleteObject",
|
|
204
|
+
];
|
|
205
|
+
for (const method of grpcMethods) {
|
|
206
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
207
|
+
GrpcMethod("UploadService", method)(constructor.prototype[method], method, descriptor);
|
|
208
|
+
}
|
|
209
|
+
const grpcStreamMethods: string[] = [];
|
|
210
|
+
for (const method of grpcStreamMethods) {
|
|
211
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
212
|
+
GrpcStreamMethod("UploadService", method)(constructor.prototype[method], method, descriptor);
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export const UPLOAD_SERVICE_NAME = "UploadService";
|
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.2.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
|
+
}
|