@slack-clone-org/contracts 1.1.2 → 1.1.4

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.
@@ -2,4 +2,5 @@ export declare const PROTO_PATHS: {
2
2
  readonly AUTH: string;
3
3
  readonly ACCOUNT: string;
4
4
  readonly TELEGRAM: string;
5
+ readonly USER: string;
5
6
  };
@@ -6,4 +6,5 @@ exports.PROTO_PATHS = {
6
6
  AUTH: (0, path_1.join)(__dirname, "../../proto/auth.proto"),
7
7
  ACCOUNT: (0, path_1.join)(__dirname, "../../proto/account.proto"),
8
8
  TELEGRAM: (0, path_1.join)(__dirname, "../../proto/telegram.proto"),
9
+ USER: (0, path_1.join)(__dirname, "../../proto/user.proto"),
9
10
  };
@@ -22,51 +22,11 @@ export interface GetAccountRequest {
22
22
 
23
23
  export interface GetAccountResponse {
24
24
  accountId: string;
25
- phoneNumber?: string | undefined;
26
- email?: string | undefined;
25
+ phoneNumber: string;
26
+ email: string;
27
27
  isPhoneVerified: boolean;
28
28
  isEmailVerified: boolean;
29
29
  role: GlobalRole;
30
- isBanned: boolean;
31
- bannedAt?: string | undefined;
32
- banReason?: string | undefined;
33
- createdAt: string;
34
- updatedAt: string;
35
- }
36
-
37
- export interface GetAccountsRequest {
38
- limit?: number | undefined;
39
- offset?: number | undefined;
40
- role?: GlobalRole | undefined;
41
- isBanned?: boolean | undefined;
42
- }
43
-
44
- export interface GetAccountsResponse {
45
- accounts: GetAccountResponse[];
46
- total: number;
47
- }
48
-
49
- export interface DeleteAccountRequest {
50
- accountId: string;
51
- }
52
-
53
- export interface DeleteAccountResponse {
54
- success: boolean;
55
- }
56
-
57
- export interface UpdateAccountRequest {
58
- accountId: string;
59
- phoneNumber?: string | undefined;
60
- email?: string | undefined;
61
- isPhoneVerified?: boolean | undefined;
62
- isEmailVerified?: boolean | undefined;
63
- role?: GlobalRole | undefined;
64
- isBanned?: boolean | undefined;
65
- banReason?: string | undefined;
66
- }
67
-
68
- export interface UpdateAccountResponse {
69
- success: boolean;
70
30
  }
71
31
 
72
32
  export interface InitEmailChangeRequest {
@@ -116,31 +76,19 @@ export interface AccountServiceClient {
116
76
 
117
77
  getAccount(request: GetAccountRequest): Observable<GetAccountResponse>;
118
78
 
119
- /** GetAccounts retrieves a paginated list of accounts with optional filters. */
120
-
121
- getAccounts(request: GetAccountsRequest): Observable<GetAccountsResponse>;
122
-
123
- /** UpdateAccount updates account fields such as role, ban status, and contact info. */
124
-
125
- updateAccount(request: UpdateAccountRequest): Observable<UpdateAccountResponse>;
126
-
127
- /** DeleteAccount permanently removes an account by account ID. */
128
-
129
- deleteAccount(request: DeleteAccountRequest): Observable<DeleteAccountResponse>;
130
-
131
- /** InitEmailChange initiates an email change request by sending a verification code. */
79
+ /** Methods for initiating email changes. */
132
80
 
133
81
  initEmailChange(request: InitEmailChangeRequest): Observable<InitEmailChangeResponse>;
134
82
 
135
- /** ConfirmEmailChange confirms the email change using the verification code. */
83
+ /** Methods for confirming email changes. */
136
84
 
137
85
  confirmEmailChange(request: ConfirmEmailChangeRequest): Observable<ConfirmEmailChangeResponse>;
138
86
 
139
- /** InitPhoneChange initiates a phone number change request by sending a verification code. */
87
+ /** Methods for initiating phone changes. */
140
88
 
141
89
  initPhoneChange(request: InitPhoneChangeRequest): Observable<InitPhoneChangeResponse>;
142
90
 
143
- /** ConfirmPhoneChange confirms the phone number change using the verification code. */
91
+ /** Methods for confirming phone changes. */
144
92
 
145
93
  confirmPhoneChange(request: ConfirmPhoneChangeRequest): Observable<ConfirmPhoneChangeResponse>;
146
94
  }
@@ -154,43 +102,25 @@ export interface AccountServiceController {
154
102
  request: GetAccountRequest,
155
103
  ): Promise<GetAccountResponse> | Observable<GetAccountResponse> | GetAccountResponse;
156
104
 
157
- /** GetAccounts retrieves a paginated list of accounts with optional filters. */
158
-
159
- getAccounts(
160
- request: GetAccountsRequest,
161
- ): Promise<GetAccountsResponse> | Observable<GetAccountsResponse> | GetAccountsResponse;
162
-
163
- /** UpdateAccount updates account fields such as role, ban status, and contact info. */
164
-
165
- updateAccount(
166
- request: UpdateAccountRequest,
167
- ): Promise<UpdateAccountResponse> | Observable<UpdateAccountResponse> | UpdateAccountResponse;
168
-
169
- /** DeleteAccount permanently removes an account by account ID. */
170
-
171
- deleteAccount(
172
- request: DeleteAccountRequest,
173
- ): Promise<DeleteAccountResponse> | Observable<DeleteAccountResponse> | DeleteAccountResponse;
174
-
175
- /** InitEmailChange initiates an email change request by sending a verification code. */
105
+ /** Methods for initiating email changes. */
176
106
 
177
107
  initEmailChange(
178
108
  request: InitEmailChangeRequest,
179
109
  ): Promise<InitEmailChangeResponse> | Observable<InitEmailChangeResponse> | InitEmailChangeResponse;
180
110
 
181
- /** ConfirmEmailChange confirms the email change using the verification code. */
111
+ /** Methods for confirming email changes. */
182
112
 
183
113
  confirmEmailChange(
184
114
  request: ConfirmEmailChangeRequest,
185
115
  ): Promise<ConfirmEmailChangeResponse> | Observable<ConfirmEmailChangeResponse> | ConfirmEmailChangeResponse;
186
116
 
187
- /** InitPhoneChange initiates a phone number change request by sending a verification code. */
117
+ /** Methods for initiating phone changes. */
188
118
 
189
119
  initPhoneChange(
190
120
  request: InitPhoneChangeRequest,
191
121
  ): Promise<InitPhoneChangeResponse> | Observable<InitPhoneChangeResponse> | InitPhoneChangeResponse;
192
122
 
193
- /** ConfirmPhoneChange confirms the phone number change using the verification code. */
123
+ /** Methods for confirming phone changes. */
194
124
 
195
125
  confirmPhoneChange(
196
126
  request: ConfirmPhoneChangeRequest,
@@ -201,9 +131,6 @@ export function AccountServiceControllerMethods() {
201
131
  return function (constructor: Function) {
202
132
  const grpcMethods: string[] = [
203
133
  "getAccount",
204
- "getAccounts",
205
- "updateAccount",
206
- "deleteAccount",
207
134
  "initEmailChange",
208
135
  "confirmEmailChange",
209
136
  "initPhoneChange",
@@ -0,0 +1,98 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.6
4
+ // protoc v3.21.12
5
+ // source: user.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+
11
+ export const protobufPackage = "user.v1";
12
+
13
+ export interface GetMeRequest {
14
+ id: string;
15
+ }
16
+
17
+ export interface GetMeResponse {
18
+ user: User | undefined;
19
+ }
20
+
21
+ export interface CreateUserRequest {
22
+ id: string;
23
+ }
24
+
25
+ export interface CreateUserResponse {
26
+ ok: string;
27
+ }
28
+
29
+ /**
30
+ * User represents a user profile.
31
+ * NOTE: Additional fields (bio, status, timezone, locale, etc.) will be added later.
32
+ */
33
+ export interface User {
34
+ id: string;
35
+ name?: string | undefined;
36
+ phone?: string | undefined;
37
+ email?: string | undefined;
38
+ avatar?: string | undefined;
39
+ }
40
+
41
+ export const USER_V1_PACKAGE_NAME = "user.v1";
42
+
43
+ /**
44
+ * UserService provides user profile-related operations.
45
+ * NOTE: This is a minimal implementation. Full profile fields and additional
46
+ * RPCs (GetUser, GetUsers, SearchUsers, UpdateUser) will be added in a future iteration.
47
+ */
48
+
49
+ export interface UserServiceClient {
50
+ /** GetMe retrieves the profile of the currently authenticated user. */
51
+
52
+ getMe(request: GetMeRequest): Observable<GetMeResponse>;
53
+
54
+ /**
55
+ * CreateUser creates a new user profile after successful authentication.
56
+ * Called internally when a new account is registered.
57
+ */
58
+
59
+ createUser(request: CreateUserRequest): Observable<CreateUserResponse>;
60
+ }
61
+
62
+ /**
63
+ * UserService provides user profile-related operations.
64
+ * NOTE: This is a minimal implementation. Full profile fields and additional
65
+ * RPCs (GetUser, GetUsers, SearchUsers, UpdateUser) will be added in a future iteration.
66
+ */
67
+
68
+ export interface UserServiceController {
69
+ /** GetMe retrieves the profile of the currently authenticated user. */
70
+
71
+ getMe(request: GetMeRequest): Promise<GetMeResponse> | Observable<GetMeResponse> | GetMeResponse;
72
+
73
+ /**
74
+ * CreateUser creates a new user profile after successful authentication.
75
+ * Called internally when a new account is registered.
76
+ */
77
+
78
+ createUser(
79
+ request: CreateUserRequest,
80
+ ): Promise<CreateUserResponse> | Observable<CreateUserResponse> | CreateUserResponse;
81
+ }
82
+
83
+ export function UserServiceControllerMethods() {
84
+ return function (constructor: Function) {
85
+ const grpcMethods: string[] = ["getMe", "createUser"];
86
+ for (const method of grpcMethods) {
87
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
88
+ GrpcMethod("UserService", method)(constructor.prototype[method], method, descriptor);
89
+ }
90
+ const grpcStreamMethods: string[] = [];
91
+ for (const method of grpcStreamMethods) {
92
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
93
+ GrpcStreamMethod("UserService", method)(constructor.prototype[method], method, descriptor);
94
+ }
95
+ };
96
+ }
97
+
98
+ export const USER_SERVICE_NAME = "UserService";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slack-clone-org/contracts",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "Shared gRPC contracts and TypeScript definitions for Slack Clone microservices",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -6,20 +6,14 @@ package account.v1;
6
6
  service AccountService {
7
7
  // GetAccount retrieves account details by account ID.
8
8
  rpc GetAccount (GetAccountRequest) returns (GetAccountResponse);
9
- // GetAccounts retrieves a paginated list of accounts with optional filters.
10
- rpc GetAccounts (GetAccountsRequest) returns (GetAccountsResponse);
11
- // UpdateAccount updates account fields such as role, ban status, and contact info.
12
- rpc UpdateAccount (UpdateAccountRequest) returns (UpdateAccountResponse);
13
- // DeleteAccount permanently removes an account by account ID.
14
- rpc DeleteAccount (DeleteAccountRequest) returns (DeleteAccountResponse);
15
9
 
16
- // InitEmailChange initiates an email change request by sending a verification code.
10
+ // Methods for initiating email changes.
17
11
  rpc InitEmailChange (InitEmailChangeRequest) returns (InitEmailChangeResponse);
18
- // ConfirmEmailChange confirms the email change using the verification code.
12
+ // Methods for confirming email changes.
19
13
  rpc ConfirmEmailChange (ConfirmEmailChangeRequest) returns (ConfirmEmailChangeResponse);
20
- // InitPhoneChange initiates a phone number change request by sending a verification code.
14
+ // Methods for initiating phone changes.
21
15
  rpc InitPhoneChange (InitPhoneChangeRequest) returns (InitPhoneChangeResponse);
22
- // ConfirmPhoneChange confirms the phone number change using the verification code.
16
+ // Methods for confirming phone changes.
23
17
  rpc ConfirmPhoneChange (ConfirmPhoneChangeRequest) returns (ConfirmPhoneChangeResponse);
24
18
  }
25
19
 
@@ -29,51 +23,11 @@ message GetAccountRequest {
29
23
 
30
24
  message GetAccountResponse {
31
25
  string account_id = 1;
32
- optional string phone_number = 2;
33
- optional string email = 3;
26
+ string phone_number = 2;
27
+ string email = 3;
34
28
  bool is_phone_verified = 4;
35
29
  bool is_email_verified = 5;
36
30
  GlobalRole role = 6;
37
- bool is_banned = 7;
38
- optional string banned_at = 8;
39
- optional string ban_reason = 9;
40
- string created_at = 10;
41
- string updated_at = 11;
42
- }
43
-
44
- message GetAccountsRequest {
45
- optional int32 limit = 1;
46
- optional int32 offset = 2;
47
- optional GlobalRole role = 3;
48
- optional bool is_banned = 4;
49
- }
50
-
51
- message GetAccountsResponse {
52
- repeated GetAccountResponse accounts = 1;
53
- int32 total = 2;
54
- }
55
-
56
- message DeleteAccountRequest {
57
- string account_id = 1;
58
- }
59
-
60
- message DeleteAccountResponse {
61
- bool success = 1;
62
- }
63
-
64
- message UpdateAccountRequest {
65
- string account_id = 1;
66
- optional string phone_number = 2;
67
- optional string email = 3;
68
- optional bool is_phone_verified = 4;
69
- optional bool is_email_verified = 5;
70
- optional GlobalRole role = 6;
71
- optional bool is_banned = 7;
72
- optional string ban_reason = 8;
73
- }
74
-
75
- message UpdateAccountResponse {
76
- bool success = 1;
77
31
  }
78
32
 
79
33
  message InitEmailChangeRequest {
@@ -0,0 +1,40 @@
1
+ syntax = "proto3";
2
+
3
+ package user.v1;
4
+
5
+ // UserService provides user profile-related operations.
6
+ // NOTE: This is a minimal implementation. Full profile fields and additional
7
+ // RPCs (GetUser, GetUsers, SearchUsers, UpdateUser) will be added in a future iteration.
8
+ service UserService {
9
+ // GetMe retrieves the profile of the currently authenticated user.
10
+ rpc GetMe (GetMeRequest) returns (GetMeResponse);
11
+ // CreateUser creates a new user profile after successful authentication.
12
+ // Called internally when a new account is registered.
13
+ rpc CreateUser (CreateUserRequest) returns (CreateUserResponse);
14
+ }
15
+
16
+ message GetMeRequest {
17
+ string id = 1;
18
+ }
19
+
20
+ message GetMeResponse {
21
+ User user = 1;
22
+ }
23
+
24
+ message CreateUserRequest {
25
+ string id = 1;
26
+ }
27
+
28
+ message CreateUserResponse {
29
+ string ok = 1;
30
+ }
31
+
32
+ // User represents a user profile.
33
+ // NOTE: Additional fields (bio, status, timezone, locale, etc.) will be added later.
34
+ message User {
35
+ string id = 1;
36
+ optional string name = 2;
37
+ optional string phone = 3;
38
+ optional string email = 4;
39
+ optional string avatar = 5;
40
+ }