@aepstore-dev/contracts 1.33.0 → 1.34.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/gen/auth.ts CHANGED
@@ -119,6 +119,20 @@ export interface TwoFactorStatusResponse {
119
119
  export interface Empty {
120
120
  }
121
121
 
122
+ export interface LogoutCurrentRequest {
123
+ refreshToken: string;
124
+ }
125
+
126
+ export interface LogoutAllRequest {
127
+ userId: string;
128
+ }
129
+
130
+ export interface LogoutResponse {
131
+ ok: boolean;
132
+ /** number of refresh-token rows deleted */
133
+ removed: number;
134
+ }
135
+
122
136
  export const AUTH_V1_PACKAGE_NAME = "auth.v1";
123
137
 
124
138
  /**
@@ -148,6 +162,15 @@ export interface AuthServiceClient {
148
162
  getProfile(request: GetProfileRequest): Observable<AuthUser>;
149
163
 
150
164
  cleanupExpiredTotpSetups(request: Empty): Observable<Empty>;
165
+
166
+ /**
167
+ * Logout — kill refresh tokens. LogoutCurrent kills only the one whose
168
+ * HMAC matches; LogoutAll wipes every row for the user.
169
+ */
170
+
171
+ logoutCurrent(request: LogoutCurrentRequest): Observable<LogoutResponse>;
172
+
173
+ logoutAll(request: LogoutAllRequest): Observable<LogoutResponse>;
151
174
  }
152
175
 
153
176
  /**
@@ -179,6 +202,15 @@ export interface AuthServiceController {
179
202
  getProfile(request: GetProfileRequest): Promise<AuthUser> | Observable<AuthUser> | AuthUser;
180
203
 
181
204
  cleanupExpiredTotpSetups(request: Empty): Promise<Empty> | Observable<Empty> | Empty;
205
+
206
+ /**
207
+ * Logout — kill refresh tokens. LogoutCurrent kills only the one whose
208
+ * HMAC matches; LogoutAll wipes every row for the user.
209
+ */
210
+
211
+ logoutCurrent(request: LogoutCurrentRequest): Promise<LogoutResponse> | Observable<LogoutResponse> | LogoutResponse;
212
+
213
+ logoutAll(request: LogoutAllRequest): Promise<LogoutResponse> | Observable<LogoutResponse> | LogoutResponse;
182
214
  }
183
215
 
184
216
  export function AuthServiceControllerMethods() {
@@ -193,6 +225,8 @@ export function AuthServiceControllerMethods() {
193
225
  "get2FaStatus",
194
226
  "getProfile",
195
227
  "cleanupExpiredTotpSetups",
228
+ "logoutCurrent",
229
+ "logoutAll",
196
230
  ];
197
231
  for (const method of grpcMethods) {
198
232
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
package/gen/payments.ts CHANGED
@@ -429,6 +429,72 @@ export interface PremiumPaymentsListResponse {
429
429
  limit: number;
430
430
  }
431
431
 
432
+ /**
433
+ * ---------------------------------------------------------------------------
434
+ * Saved cards (YooKassa payment_method tokens; we never see PAN)
435
+ * ---------------------------------------------------------------------------
436
+ */
437
+ export interface SavedCard {
438
+ id: string;
439
+ /** "MIR" | "VISA" | "MASTERCARD" | "" */
440
+ brand: string;
441
+ /** "0000" etc, display-only */
442
+ last4: string;
443
+ expMonth: number;
444
+ expYear: number;
445
+ isDefault: boolean;
446
+ /** user-set label */
447
+ nickname: string;
448
+ createdAt: string;
449
+ }
450
+
451
+ export interface ListSavedCardsRequest {
452
+ userId: string;
453
+ }
454
+
455
+ export interface ListSavedCardsResponse {
456
+ items: SavedCard[];
457
+ }
458
+
459
+ export interface DeleteSavedCardRequest {
460
+ userId: string;
461
+ id: string;
462
+ }
463
+
464
+ export interface SetDefaultSavedCardRequest {
465
+ userId: string;
466
+ id: string;
467
+ }
468
+
469
+ export interface UpdateSavedCardRequest {
470
+ userId: string;
471
+ id: string;
472
+ /** empty = clear */
473
+ nickname: string;
474
+ }
475
+
476
+ /**
477
+ * ---------------------------------------------------------------------------
478
+ * Payout details (persistent default; per-withdrawal override still allowed)
479
+ * ---------------------------------------------------------------------------
480
+ */
481
+ export interface UpdatePayoutDetailsRequest {
482
+ userId: string;
483
+ /** "card" | "sbp" | "bank" | "" (clear) */
484
+ method: string;
485
+ /** JSON string — payments-service treats opaquely */
486
+ details: string;
487
+ }
488
+
489
+ export interface UpdatePayoutDetailsResponse {
490
+ method: string;
491
+ details: string;
492
+ }
493
+
494
+ export interface GetPayoutDetailsRequest {
495
+ userId: string;
496
+ }
497
+
432
498
  export const PAYMENTS_V1_PACKAGE_NAME = "payments.v1";
433
499
 
434
500
  /**
@@ -490,6 +556,22 @@ export interface PaymentsServiceClient {
490
556
 
491
557
  runPremiumRenewals(request: RunPremiumRenewalsRequest): Observable<RunPremiumRenewalsResponse>;
492
558
 
559
+ /** ----- saved cards ----- */
560
+
561
+ listSavedCards(request: ListSavedCardsRequest): Observable<ListSavedCardsResponse>;
562
+
563
+ deleteSavedCard(request: DeleteSavedCardRequest): Observable<Ok>;
564
+
565
+ setDefaultSavedCard(request: SetDefaultSavedCardRequest): Observable<SavedCard>;
566
+
567
+ updateSavedCard(request: UpdateSavedCardRequest): Observable<SavedCard>;
568
+
569
+ /** ----- payout details ----- */
570
+
571
+ updatePayoutDetails(request: UpdatePayoutDetailsRequest): Observable<UpdatePayoutDetailsResponse>;
572
+
573
+ getPayoutDetails(request: GetPayoutDetailsRequest): Observable<UpdatePayoutDetailsResponse>;
574
+
493
575
  /** ----- admin ----- */
494
576
 
495
577
  getAdminOverview(request: AdminOverviewRequest): Observable<AdminOverviewResponse>;
@@ -580,6 +662,28 @@ export interface PaymentsServiceController {
580
662
  request: RunPremiumRenewalsRequest,
581
663
  ): Promise<RunPremiumRenewalsResponse> | Observable<RunPremiumRenewalsResponse> | RunPremiumRenewalsResponse;
582
664
 
665
+ /** ----- saved cards ----- */
666
+
667
+ listSavedCards(
668
+ request: ListSavedCardsRequest,
669
+ ): Promise<ListSavedCardsResponse> | Observable<ListSavedCardsResponse> | ListSavedCardsResponse;
670
+
671
+ deleteSavedCard(request: DeleteSavedCardRequest): Promise<Ok> | Observable<Ok> | Ok;
672
+
673
+ setDefaultSavedCard(request: SetDefaultSavedCardRequest): Promise<SavedCard> | Observable<SavedCard> | SavedCard;
674
+
675
+ updateSavedCard(request: UpdateSavedCardRequest): Promise<SavedCard> | Observable<SavedCard> | SavedCard;
676
+
677
+ /** ----- payout details ----- */
678
+
679
+ updatePayoutDetails(
680
+ request: UpdatePayoutDetailsRequest,
681
+ ): Promise<UpdatePayoutDetailsResponse> | Observable<UpdatePayoutDetailsResponse> | UpdatePayoutDetailsResponse;
682
+
683
+ getPayoutDetails(
684
+ request: GetPayoutDetailsRequest,
685
+ ): Promise<UpdatePayoutDetailsResponse> | Observable<UpdatePayoutDetailsResponse> | UpdatePayoutDetailsResponse;
686
+
583
687
  /** ----- admin ----- */
584
688
 
585
689
  getAdminOverview(
@@ -620,6 +724,12 @@ export function PaymentsServiceControllerMethods() {
620
724
  "refundPremium",
621
725
  "getMyPremiumPayments",
622
726
  "runPremiumRenewals",
727
+ "listSavedCards",
728
+ "deleteSavedCard",
729
+ "setDefaultSavedCard",
730
+ "updateSavedCard",
731
+ "updatePayoutDetails",
732
+ "getPayoutDetails",
623
733
  "getAdminOverview",
624
734
  "adminListTransactions",
625
735
  "getUserFinance",
package/gen/users.ts CHANGED
@@ -29,6 +29,10 @@ export enum PremiumPeriod {
29
29
  UNRECOGNIZED = -1,
30
30
  }
31
31
 
32
+ export interface Ok {
33
+ ok: boolean;
34
+ }
35
+
32
36
  export interface User {
33
37
  id: string;
34
38
  email: string;
@@ -378,6 +382,210 @@ export interface DeleteAvatarBorderResponse {
378
382
  ok: boolean;
379
383
  }
380
384
 
385
+ export interface UpdatePrivacyRequest {
386
+ userId: string;
387
+ hideEmail: boolean;
388
+ hideBalance: boolean;
389
+ hideOnline: boolean;
390
+ }
391
+
392
+ export interface UpdateEmailPrefsRequest {
393
+ userId: string;
394
+ emailOnSales: boolean;
395
+ emailOnReviews: boolean;
396
+ emailOnNews: boolean;
397
+ }
398
+
399
+ export interface UpdateEmailPrefsResponse {
400
+ emailOnSales: boolean;
401
+ emailOnReviews: boolean;
402
+ emailOnNews: boolean;
403
+ }
404
+
405
+ export interface UpdateLocaleRequest {
406
+ userId: string;
407
+ /** "ru" | "en" | ... */
408
+ locale: string;
409
+ }
410
+
411
+ export interface UpdateLocaleResponse {
412
+ locale: string;
413
+ }
414
+
415
+ export interface SoftDeleteAccountRequest {
416
+ userId: string;
417
+ /** optional, for support/audit */
418
+ reason: string;
419
+ /** 0 → use server default (30) */
420
+ cooldownDays: number;
421
+ }
422
+
423
+ export interface SoftDeleteAccountResponse {
424
+ /** ISO 8601 */
425
+ deletedAt: string;
426
+ scheduledForHardDelete: string;
427
+ }
428
+
429
+ export interface RestoreAccountRequest {
430
+ userId: string;
431
+ }
432
+
433
+ export interface HardDeletePendingRequest {
434
+ /** 0 → default 100 */
435
+ maxBatch: number;
436
+ }
437
+
438
+ export interface HardDeletePendingResponse {
439
+ deleted: number;
440
+ }
441
+
442
+ export interface ChangePasswordRequest {
443
+ userId: string;
444
+ currentPassword: string;
445
+ newPassword: string;
446
+ /** Optional: revoke all other sessions on success. */
447
+ revokeOtherSessions: boolean;
448
+ }
449
+
450
+ export interface BlockUserRequest {
451
+ blockerId: string;
452
+ blockedId: string;
453
+ /** optional */
454
+ reason: string;
455
+ }
456
+
457
+ export interface BlockUserResponse {
458
+ blocked: boolean;
459
+ }
460
+
461
+ export interface BlockedUserRow {
462
+ id: string;
463
+ username: string;
464
+ avatarUrl: string;
465
+ blockedAt: string;
466
+ reason: string;
467
+ }
468
+
469
+ export interface ListBlockedUsersRequest {
470
+ blockerId: string;
471
+ page: number;
472
+ limit: number;
473
+ }
474
+
475
+ export interface ListBlockedUsersResponse {
476
+ items: BlockedUserRow[];
477
+ total: number;
478
+ page: number;
479
+ limit: number;
480
+ }
481
+
482
+ export interface IsBlockedRequest {
483
+ blockerId: string;
484
+ blockedId: string;
485
+ }
486
+
487
+ export interface IsBlockedResponse {
488
+ isBlocked: boolean;
489
+ }
490
+
491
+ export interface DataExportRequestRow {
492
+ id: string;
493
+ userId: string;
494
+ /** PENDING | PROCESSING | READY | FAILED */
495
+ status: string;
496
+ fileUrl: string;
497
+ fileSize: number;
498
+ error: string;
499
+ createdAt: string;
500
+ completedAt: string;
501
+ }
502
+
503
+ export interface RequestDataExportRequest {
504
+ userId: string;
505
+ }
506
+
507
+ export interface ListDataExportsRequest {
508
+ userId: string;
509
+ page: number;
510
+ limit: number;
511
+ }
512
+
513
+ export interface ListDataExportsResponse {
514
+ items: DataExportRequestRow[];
515
+ total: number;
516
+ page: number;
517
+ limit: number;
518
+ }
519
+
520
+ export interface PickPendingDataExportRequest {
521
+ /** tasks-service polls; returns one PENDING row marked PROCESSING, or empty. */
522
+ Placeholder: boolean;
523
+ }
524
+
525
+ export interface CompleteDataExportRequest {
526
+ id: string;
527
+ fileUrl: string;
528
+ fileSize: number;
529
+ /** if set, marks FAILED instead of READY */
530
+ error: string;
531
+ }
532
+
533
+ export interface CollectUserExportDataRequest {
534
+ userId: string;
535
+ }
536
+
537
+ export interface CollectUserExportDataResponse {
538
+ /**
539
+ * Opaque JSON-as-string of user-owned data. tasks-service writes it to
540
+ * S3 verbatim. Keeps the schema-specific marshaling private to users-service.
541
+ */
542
+ payloadJson: string;
543
+ }
544
+
545
+ export interface GetAccountSettingsRequest {
546
+ userId: string;
547
+ }
548
+
549
+ export interface AccountSettingsResponse {
550
+ /** Identity */
551
+ id: string;
552
+ username: string;
553
+ email: string;
554
+ fullName: string;
555
+ aboutMe: string;
556
+ avatarUrl: string;
557
+ bannerUrl: string;
558
+ locale: string;
559
+ timezone: string;
560
+ countryId: string;
561
+ createdAt: string;
562
+ /** 2FA */
563
+ twoFactorType: string;
564
+ twoFactorEnabled: boolean;
565
+ backupCodesRemaining: number;
566
+ /** Privacy */
567
+ hideEmail: boolean;
568
+ hideBalance: boolean;
569
+ hideOnline: boolean;
570
+ hideSubscriptions: boolean;
571
+ /** Email prefs */
572
+ emailOnSales: boolean;
573
+ emailOnReviews: boolean;
574
+ emailOnNews: boolean;
575
+ /** Payout defaults */
576
+ payoutMethod: string;
577
+ payoutDetails: string;
578
+ /** Premium snapshot */
579
+ premiumIsActive: boolean;
580
+ premiumStatus: string;
581
+ premiumExpiresAt: string;
582
+ premiumAutoRenew: boolean;
583
+ /** Soft-delete state */
584
+ deletedAt: string;
585
+ scheduledForHardDelete: string;
586
+ socialMedia: SocialMedia[];
587
+ }
588
+
381
589
  export const USERS_V1_PACKAGE_NAME = "users.v1";
382
590
 
383
591
  export interface UsersServiceClient {
@@ -435,6 +643,65 @@ export interface UsersServiceClient {
435
643
  upsertAvatarBorder(request: UpsertAvatarBorderRequest): Observable<AvatarBorder>;
436
644
 
437
645
  deleteAvatarBorder(request: DeleteAvatarBorderRequest): Observable<DeleteAvatarBorderResponse>;
646
+
647
+ /** Account settings — bundled write surface for the UI. */
648
+
649
+ updatePrivacy(request: UpdatePrivacyRequest): Observable<PublicProfileResponse>;
650
+
651
+ updateEmailPrefs(request: UpdateEmailPrefsRequest): Observable<UpdateEmailPrefsResponse>;
652
+
653
+ updateLocale(request: UpdateLocaleRequest): Observable<UpdateLocaleResponse>;
654
+
655
+ /**
656
+ * Soft-delete + restore. Internal AuthService also queries the soft-delete
657
+ * state on login (rejects if deletedAt set).
658
+ */
659
+
660
+ softDeleteAccount(request: SoftDeleteAccountRequest): Observable<SoftDeleteAccountResponse>;
661
+
662
+ restoreAccount(request: RestoreAccountRequest): Observable<UserResponse>;
663
+
664
+ /** tasks-service cron */
665
+
666
+ hardDeletePending(request: HardDeletePendingRequest): Observable<HardDeletePendingResponse>;
667
+
668
+ /** Blocks */
669
+
670
+ blockUser(request: BlockUserRequest): Observable<BlockUserResponse>;
671
+
672
+ unblockUser(request: BlockUserRequest): Observable<BlockUserResponse>;
673
+
674
+ listBlockedUsers(request: ListBlockedUsersRequest): Observable<ListBlockedUsersResponse>;
675
+
676
+ /** internal lookup */
677
+
678
+ isBlocked(request: IsBlockedRequest): Observable<IsBlockedResponse>;
679
+
680
+ /** Data export */
681
+
682
+ requestDataExport(request: RequestDataExportRequest): Observable<DataExportRequestRow>;
683
+
684
+ listDataExports(request: ListDataExportsRequest): Observable<ListDataExportsResponse>;
685
+
686
+ /** tasks-service */
687
+
688
+ pickPendingDataExport(request: PickPendingDataExportRequest): Observable<DataExportRequestRow>;
689
+
690
+ /** tasks-service */
691
+
692
+ completeDataExport(request: CompleteDataExportRequest): Observable<DataExportRequestRow>;
693
+
694
+ /** tasks-service */
695
+
696
+ collectUserExportData(request: CollectUserExportDataRequest): Observable<CollectUserExportDataResponse>;
697
+
698
+ /** Unified read for the settings page */
699
+
700
+ getAccountSettings(request: GetAccountSettingsRequest): Observable<AccountSettingsResponse>;
701
+
702
+ /** Password — separate from generic createCode/verifyCode reset flow. */
703
+
704
+ changePassword(request: ChangePasswordRequest): Observable<Ok>;
438
705
  }
439
706
 
440
707
  export interface UsersServiceController {
@@ -520,6 +787,91 @@ export interface UsersServiceController {
520
787
  deleteAvatarBorder(
521
788
  request: DeleteAvatarBorderRequest,
522
789
  ): Promise<DeleteAvatarBorderResponse> | Observable<DeleteAvatarBorderResponse> | DeleteAvatarBorderResponse;
790
+
791
+ /** Account settings — bundled write surface for the UI. */
792
+
793
+ updatePrivacy(
794
+ request: UpdatePrivacyRequest,
795
+ ): Promise<PublicProfileResponse> | Observable<PublicProfileResponse> | PublicProfileResponse;
796
+
797
+ updateEmailPrefs(
798
+ request: UpdateEmailPrefsRequest,
799
+ ): Promise<UpdateEmailPrefsResponse> | Observable<UpdateEmailPrefsResponse> | UpdateEmailPrefsResponse;
800
+
801
+ updateLocale(
802
+ request: UpdateLocaleRequest,
803
+ ): Promise<UpdateLocaleResponse> | Observable<UpdateLocaleResponse> | UpdateLocaleResponse;
804
+
805
+ /**
806
+ * Soft-delete + restore. Internal AuthService also queries the soft-delete
807
+ * state on login (rejects if deletedAt set).
808
+ */
809
+
810
+ softDeleteAccount(
811
+ request: SoftDeleteAccountRequest,
812
+ ): Promise<SoftDeleteAccountResponse> | Observable<SoftDeleteAccountResponse> | SoftDeleteAccountResponse;
813
+
814
+ restoreAccount(request: RestoreAccountRequest): Promise<UserResponse> | Observable<UserResponse> | UserResponse;
815
+
816
+ /** tasks-service cron */
817
+
818
+ hardDeletePending(
819
+ request: HardDeletePendingRequest,
820
+ ): Promise<HardDeletePendingResponse> | Observable<HardDeletePendingResponse> | HardDeletePendingResponse;
821
+
822
+ /** Blocks */
823
+
824
+ blockUser(request: BlockUserRequest): Promise<BlockUserResponse> | Observable<BlockUserResponse> | BlockUserResponse;
825
+
826
+ unblockUser(
827
+ request: BlockUserRequest,
828
+ ): Promise<BlockUserResponse> | Observable<BlockUserResponse> | BlockUserResponse;
829
+
830
+ listBlockedUsers(
831
+ request: ListBlockedUsersRequest,
832
+ ): Promise<ListBlockedUsersResponse> | Observable<ListBlockedUsersResponse> | ListBlockedUsersResponse;
833
+
834
+ /** internal lookup */
835
+
836
+ isBlocked(request: IsBlockedRequest): Promise<IsBlockedResponse> | Observable<IsBlockedResponse> | IsBlockedResponse;
837
+
838
+ /** Data export */
839
+
840
+ requestDataExport(
841
+ request: RequestDataExportRequest,
842
+ ): Promise<DataExportRequestRow> | Observable<DataExportRequestRow> | DataExportRequestRow;
843
+
844
+ listDataExports(
845
+ request: ListDataExportsRequest,
846
+ ): Promise<ListDataExportsResponse> | Observable<ListDataExportsResponse> | ListDataExportsResponse;
847
+
848
+ /** tasks-service */
849
+
850
+ pickPendingDataExport(
851
+ request: PickPendingDataExportRequest,
852
+ ): Promise<DataExportRequestRow> | Observable<DataExportRequestRow> | DataExportRequestRow;
853
+
854
+ /** tasks-service */
855
+
856
+ completeDataExport(
857
+ request: CompleteDataExportRequest,
858
+ ): Promise<DataExportRequestRow> | Observable<DataExportRequestRow> | DataExportRequestRow;
859
+
860
+ /** tasks-service */
861
+
862
+ collectUserExportData(
863
+ request: CollectUserExportDataRequest,
864
+ ): Promise<CollectUserExportDataResponse> | Observable<CollectUserExportDataResponse> | CollectUserExportDataResponse;
865
+
866
+ /** Unified read for the settings page */
867
+
868
+ getAccountSettings(
869
+ request: GetAccountSettingsRequest,
870
+ ): Promise<AccountSettingsResponse> | Observable<AccountSettingsResponse> | AccountSettingsResponse;
871
+
872
+ /** Password — separate from generic createCode/verifyCode reset flow. */
873
+
874
+ changePassword(request: ChangePasswordRequest): Promise<Ok> | Observable<Ok> | Ok;
523
875
  }
524
876
 
525
877
  export function UsersServiceControllerMethods() {
@@ -544,6 +896,23 @@ export function UsersServiceControllerMethods() {
544
896
  "listAvatarBorders",
545
897
  "upsertAvatarBorder",
546
898
  "deleteAvatarBorder",
899
+ "updatePrivacy",
900
+ "updateEmailPrefs",
901
+ "updateLocale",
902
+ "softDeleteAccount",
903
+ "restoreAccount",
904
+ "hardDeletePending",
905
+ "blockUser",
906
+ "unblockUser",
907
+ "listBlockedUsers",
908
+ "isBlocked",
909
+ "requestDataExport",
910
+ "listDataExports",
911
+ "pickPendingDataExport",
912
+ "completeDataExport",
913
+ "collectUserExportData",
914
+ "getAccountSettings",
915
+ "changePassword",
547
916
  ];
548
917
  for (const method of grpcMethods) {
549
918
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aepstore-dev/contracts",
3
- "version": "1.33.0",
3
+ "version": "1.34.0",
4
4
  "description": "Protobuf definitions for aepstore microservices",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
package/proto/auth.proto CHANGED
@@ -18,6 +18,11 @@ service AuthService {
18
18
  rpc Get2faStatus(Get2faStatusRequest) returns (TwoFactorStatusResponse);
19
19
  rpc GetProfile(GetProfileRequest) returns (AuthUser);
20
20
  rpc CleanupExpiredTotpSetups(Empty) returns (Empty);
21
+
22
+ // Logout — kill refresh tokens. LogoutCurrent kills only the one whose
23
+ // HMAC matches; LogoutAll wipes every row for the user.
24
+ rpc LogoutCurrent(LogoutCurrentRequest) returns (LogoutResponse);
25
+ rpc LogoutAll(LogoutAllRequest) returns (LogoutResponse);
21
26
  }
22
27
 
23
28
  enum TwoFactorType {
@@ -124,3 +129,16 @@ message TwoFactorStatusResponse {
124
129
  }
125
130
 
126
131
  message Empty {}
132
+
133
+ message LogoutCurrentRequest {
134
+ string refresh_token = 1;
135
+ }
136
+
137
+ message LogoutAllRequest {
138
+ string user_id = 1;
139
+ }
140
+
141
+ message LogoutResponse {
142
+ bool ok = 1;
143
+ int32 removed = 2; // number of refresh-token rows deleted
144
+ }
@@ -36,6 +36,16 @@ service PaymentsService {
36
36
  // payments-service iterates ACTIVE subscriptions with autoRenew+savedCard.
37
37
  rpc RunPremiumRenewals(RunPremiumRenewalsRequest) returns (RunPremiumRenewalsResponse);
38
38
 
39
+ // ----- saved cards -----
40
+ rpc ListSavedCards(ListSavedCardsRequest) returns (ListSavedCardsResponse);
41
+ rpc DeleteSavedCard(DeleteSavedCardRequest) returns (Ok);
42
+ rpc SetDefaultSavedCard(SetDefaultSavedCardRequest) returns (SavedCard);
43
+ rpc UpdateSavedCard(UpdateSavedCardRequest) returns (SavedCard);
44
+
45
+ // ----- payout details -----
46
+ rpc UpdatePayoutDetails(UpdatePayoutDetailsRequest) returns (UpdatePayoutDetailsResponse);
47
+ rpc GetPayoutDetails(GetPayoutDetailsRequest) returns (UpdatePayoutDetailsResponse);
48
+
39
49
  // ----- admin -----
40
50
  rpc GetAdminOverview(AdminOverviewRequest) returns (AdminOverviewResponse);
41
51
  rpc AdminListTransactions(AdminListTransactionsRequest) returns (AdminTransactionsListResponse);
@@ -301,3 +311,46 @@ message PremiumPaymentsListResponse {
301
311
  int32 page = 3;
302
312
  int32 limit = 4;
303
313
  }
314
+
315
+ // ---------------------------------------------------------------------------
316
+ // Saved cards (YooKassa payment_method tokens; we never see PAN)
317
+ // ---------------------------------------------------------------------------
318
+ message SavedCard {
319
+ string id = 1;
320
+ string brand = 2; // "MIR" | "VISA" | "MASTERCARD" | ""
321
+ string last4 = 3; // "0000" etc, display-only
322
+ int32 exp_month = 4;
323
+ int32 exp_year = 5;
324
+ bool is_default = 6;
325
+ string nickname = 7; // user-set label
326
+ string created_at = 8;
327
+ }
328
+
329
+ message ListSavedCardsRequest { string user_id = 1; }
330
+ message ListSavedCardsResponse { repeated SavedCard items = 1; }
331
+
332
+ message DeleteSavedCardRequest { string user_id = 1; string id = 2; }
333
+
334
+ message SetDefaultSavedCardRequest { string user_id = 1; string id = 2; }
335
+
336
+ message UpdateSavedCardRequest {
337
+ string user_id = 1;
338
+ string id = 2;
339
+ string nickname = 3; // empty = clear
340
+ }
341
+
342
+ // ---------------------------------------------------------------------------
343
+ // Payout details (persistent default; per-withdrawal override still allowed)
344
+ // ---------------------------------------------------------------------------
345
+ message UpdatePayoutDetailsRequest {
346
+ string user_id = 1;
347
+ string method = 2; // "card" | "sbp" | "bank" | "" (clear)
348
+ string details = 3; // JSON string — payments-service treats opaquely
349
+ }
350
+
351
+ message UpdatePayoutDetailsResponse {
352
+ string method = 1;
353
+ string details = 2;
354
+ }
355
+
356
+ message GetPayoutDetailsRequest { string user_id = 1; }
package/proto/users.proto CHANGED
@@ -33,8 +33,40 @@ service UsersService {
33
33
  rpc ListAvatarBorders(ListAvatarBordersRequest) returns (ListAvatarBordersResponse);
34
34
  rpc UpsertAvatarBorder(UpsertAvatarBorderRequest) returns (AvatarBorder);
35
35
  rpc DeleteAvatarBorder(DeleteAvatarBorderRequest) returns (DeleteAvatarBorderResponse);
36
+
37
+ // Account settings — bundled write surface for the UI.
38
+ rpc UpdatePrivacy(UpdatePrivacyRequest) returns (PublicProfileResponse);
39
+ rpc UpdateEmailPrefs(UpdateEmailPrefsRequest) returns (UpdateEmailPrefsResponse);
40
+ rpc UpdateLocale(UpdateLocaleRequest) returns (UpdateLocaleResponse);
41
+
42
+ // Soft-delete + restore. Internal AuthService also queries the soft-delete
43
+ // state on login (rejects if deletedAt set).
44
+ rpc SoftDeleteAccount(SoftDeleteAccountRequest) returns (SoftDeleteAccountResponse);
45
+ rpc RestoreAccount(RestoreAccountRequest) returns (UserResponse);
46
+ rpc HardDeletePending(HardDeletePendingRequest) returns (HardDeletePendingResponse); // tasks-service cron
47
+
48
+ // Blocks
49
+ rpc BlockUser(BlockUserRequest) returns (BlockUserResponse);
50
+ rpc UnblockUser(BlockUserRequest) returns (BlockUserResponse);
51
+ rpc ListBlockedUsers(ListBlockedUsersRequest) returns (ListBlockedUsersResponse);
52
+ rpc IsBlocked(IsBlockedRequest) returns (IsBlockedResponse); // internal lookup
53
+
54
+ // Data export
55
+ rpc RequestDataExport(RequestDataExportRequest) returns (DataExportRequestRow);
56
+ rpc ListDataExports(ListDataExportsRequest) returns (ListDataExportsResponse);
57
+ rpc PickPendingDataExport(PickPendingDataExportRequest) returns (DataExportRequestRow); // tasks-service
58
+ rpc CompleteDataExport(CompleteDataExportRequest) returns (DataExportRequestRow); // tasks-service
59
+ rpc CollectUserExportData(CollectUserExportDataRequest) returns (CollectUserExportDataResponse); // tasks-service
60
+
61
+ // Unified read for the settings page
62
+ rpc GetAccountSettings(GetAccountSettingsRequest) returns (AccountSettingsResponse);
63
+
64
+ // Password — separate from generic createCode/verifyCode reset flow.
65
+ rpc ChangePassword(ChangePasswordRequest) returns (Ok);
36
66
  }
37
67
 
68
+ message Ok { bool ok = 1; }
69
+
38
70
  // =================================================================
39
71
  // Common types
40
72
  // =================================================================
@@ -409,3 +441,220 @@ message DeleteAvatarBorderRequest {
409
441
  message DeleteAvatarBorderResponse {
410
442
  bool ok = 1;
411
443
  }
444
+
445
+ // =================================================================
446
+ // Account settings
447
+ // =================================================================
448
+
449
+ message UpdatePrivacyRequest {
450
+ string user_id = 1;
451
+ bool hide_email = 2;
452
+ bool hide_balance = 3;
453
+ bool hide_online = 4;
454
+ }
455
+
456
+ message UpdateEmailPrefsRequest {
457
+ string user_id = 1;
458
+ bool email_on_sales = 2;
459
+ bool email_on_reviews = 3;
460
+ bool email_on_news = 4;
461
+ }
462
+
463
+ message UpdateEmailPrefsResponse {
464
+ bool email_on_sales = 1;
465
+ bool email_on_reviews = 2;
466
+ bool email_on_news = 3;
467
+ }
468
+
469
+ message UpdateLocaleRequest {
470
+ string user_id = 1;
471
+ string locale = 2; // "ru" | "en" | ...
472
+ }
473
+
474
+ message UpdateLocaleResponse {
475
+ string locale = 1;
476
+ }
477
+
478
+ message SoftDeleteAccountRequest {
479
+ string user_id = 1;
480
+ string reason = 2; // optional, for support/audit
481
+ int32 cooldown_days = 3; // 0 → use server default (30)
482
+ }
483
+
484
+ message SoftDeleteAccountResponse {
485
+ string deleted_at = 1; // ISO 8601
486
+ string scheduled_for_hard_delete = 2;
487
+ }
488
+
489
+ message RestoreAccountRequest {
490
+ string user_id = 1;
491
+ }
492
+
493
+ message HardDeletePendingRequest {
494
+ int32 max_batch = 1; // 0 → default 100
495
+ }
496
+
497
+ message HardDeletePendingResponse {
498
+ int32 deleted = 1;
499
+ }
500
+
501
+ message ChangePasswordRequest {
502
+ string user_id = 1;
503
+ string current_password = 2;
504
+ string new_password = 3;
505
+ // Optional: revoke all other sessions on success.
506
+ bool revoke_other_sessions = 4;
507
+ }
508
+
509
+ // =================================================================
510
+ // Blocks
511
+ // =================================================================
512
+
513
+ message BlockUserRequest {
514
+ string blocker_id = 1;
515
+ string blocked_id = 2;
516
+ string reason = 3; // optional
517
+ }
518
+
519
+ message BlockUserResponse {
520
+ bool blocked = 1;
521
+ }
522
+
523
+ message BlockedUserRow {
524
+ string id = 1;
525
+ string username = 2;
526
+ string avatar_url = 3;
527
+ string blocked_at = 4;
528
+ string reason = 5;
529
+ }
530
+
531
+ message ListBlockedUsersRequest {
532
+ string blocker_id = 1;
533
+ int32 page = 2;
534
+ int32 limit = 3;
535
+ }
536
+
537
+ message ListBlockedUsersResponse {
538
+ repeated BlockedUserRow items = 1;
539
+ int32 total = 2;
540
+ int32 page = 3;
541
+ int32 limit = 4;
542
+ }
543
+
544
+ message IsBlockedRequest {
545
+ string blocker_id = 1;
546
+ string blocked_id = 2;
547
+ }
548
+
549
+ message IsBlockedResponse {
550
+ bool is_blocked = 1;
551
+ }
552
+
553
+ // =================================================================
554
+ // Data export
555
+ // =================================================================
556
+
557
+ message DataExportRequestRow {
558
+ string id = 1;
559
+ string user_id = 2;
560
+ string status = 3; // PENDING | PROCESSING | READY | FAILED
561
+ string file_url = 4;
562
+ int32 file_size = 5;
563
+ string error = 6;
564
+ string created_at = 7;
565
+ string completed_at = 8;
566
+ }
567
+
568
+ message RequestDataExportRequest {
569
+ string user_id = 1;
570
+ }
571
+
572
+ message ListDataExportsRequest {
573
+ string user_id = 1;
574
+ int32 page = 2;
575
+ int32 limit = 3;
576
+ }
577
+
578
+ message ListDataExportsResponse {
579
+ repeated DataExportRequestRow items = 1;
580
+ int32 total = 2;
581
+ int32 page = 3;
582
+ int32 limit = 4;
583
+ }
584
+
585
+ message PickPendingDataExportRequest {
586
+ // tasks-service polls; returns one PENDING row marked PROCESSING, or empty.
587
+ bool _placeholder = 1;
588
+ }
589
+
590
+ message CompleteDataExportRequest {
591
+ string id = 1;
592
+ string file_url = 2;
593
+ int32 file_size = 3;
594
+ string error = 4; // if set, marks FAILED instead of READY
595
+ }
596
+
597
+ message CollectUserExportDataRequest {
598
+ string user_id = 1;
599
+ }
600
+
601
+ message CollectUserExportDataResponse {
602
+ // Opaque JSON-as-string of user-owned data. tasks-service writes it to
603
+ // S3 verbatim. Keeps the schema-specific marshaling private to users-service.
604
+ string payload_json = 1;
605
+ }
606
+
607
+ // =================================================================
608
+ // Settings — unified read
609
+ // =================================================================
610
+
611
+ message GetAccountSettingsRequest {
612
+ string user_id = 1;
613
+ }
614
+
615
+ message AccountSettingsResponse {
616
+ // Identity
617
+ string id = 1;
618
+ string username = 2;
619
+ string email = 3;
620
+ string full_name = 4;
621
+ string about_me = 5;
622
+ string avatar_url = 6;
623
+ string banner_url = 7;
624
+ string locale = 8;
625
+ string timezone = 9;
626
+ string country_id = 10;
627
+ string created_at = 11;
628
+
629
+ // 2FA
630
+ string two_factor_type = 12; // NONE | APP | EMAIL
631
+ bool two_factor_enabled = 13;
632
+ int32 backup_codes_remaining = 14;
633
+
634
+ // Privacy
635
+ bool hide_email = 15;
636
+ bool hide_balance = 16;
637
+ bool hide_online = 17;
638
+ bool hide_subscriptions = 18;
639
+
640
+ // Email prefs
641
+ bool email_on_sales = 19;
642
+ bool email_on_reviews = 20;
643
+ bool email_on_news = 21;
644
+
645
+ // Payout defaults
646
+ string payout_method = 22;
647
+ string payout_details = 23;
648
+
649
+ // Premium snapshot
650
+ bool premium_is_active = 24;
651
+ string premium_status = 25;
652
+ string premium_expires_at = 26;
653
+ bool premium_auto_renew = 27;
654
+
655
+ // Soft-delete state
656
+ string deleted_at = 28;
657
+ string scheduled_for_hard_delete = 29;
658
+
659
+ repeated SocialMedia social_media = 30;
660
+ }