Skip to content

Commit 104bc02

Browse files
committed
refactor: refactor sync_operation _response
1 parent ab8e49b commit 104bc02

File tree

1 file changed

+56
-20
lines changed

1 file changed

+56
-20
lines changed

protos/account.proto

+56-20
Original file line numberDiff line numberDiff line change
@@ -188,28 +188,64 @@ message SyncAccountUserInfoRequest {
188188
repeated SyncAccountInfo sync_accounts = 2;
189189
}
190190

191+
192+
message CreateAccountOperation {
193+
string account_name = 1;
194+
}
195+
196+
message BlockAccountOperation {
197+
string account_name = 1;
198+
}
199+
200+
message UnblockAccountOperation {
201+
string account_name = 1;
202+
}
203+
204+
message AddUserToAccountOperation {
205+
string account_name = 1;
206+
string user_id = 2;
207+
}
208+
209+
message RemoveUserFromAccountOperation {
210+
string account_name = 1;
211+
string user_id = 2;
212+
}
213+
214+
message BlockUserInAccountOperation {
215+
string account_name = 1;
216+
string user_id = 2;
217+
}
218+
219+
message UnblockUserInAccountOperation {
220+
string account_name = 1;
221+
string user_id = 2;
222+
}
223+
224+
message DeleteAccountOperation {
225+
string account_name = 1;
226+
}
227+
228+
message DeleteUserOperation {
229+
string user_id = 1;
230+
}
231+
191232
message SyncAccountUserInfoResponse {
192-
enum SyncOperation {
193-
UNKNOWN = 0;
194-
CREATE_ACCOUNT = 1;
195-
BLOCK_ACCOUNT = 2;
196-
UNBLOCK_ACCOUNT = 3;
197-
ADD_USER_TO_ACCOUNT = 4;
198-
BLOCK_USER_IN_ACCOUNT = 5;
199-
REMOVE_USER_FROM_ACCOUNT = 6;
200-
UNBLOCK_USER_IN_ACCOUNT = 7;
201-
DELETE_ACCOUNT = 8;
202-
DELETE_USER = 9;
203-
}
204-
message FailureInfo {
205-
SyncOperation sync_operation = 1;
206-
string failed_account_name = 2;
207-
// only exists in users' failed operation of ADD_USER_TO_ACCOUNT, BLOCK_USER_IN_ACCOUNT or REMOVE_USER_FROM_ACCOUNT
208-
optional string failed_user_id = 3;
209-
string failed_message = 4;
233+
message SyncOperationResult {
234+
oneof operation {
235+
CreateAccountOperation create_account = 1;
236+
BlockAccountOperation block_account = 2;
237+
UnblockAccountOperation unblock_account = 3;
238+
AddUserToAccountOperation add_user_to_account = 4;
239+
RemoveUserFromAccountOperation remove_user_from_account = 5;
240+
BlockUserInAccountOperation block_user_in_account = 6;
241+
UnblockUserInAccountOperation unblock_user_in_account = 7;
242+
DeleteAccountOperation delete_account = 8;
243+
DeleteUserOperation delete_user = 9;
244+
}
245+
bool success = 1;
246+
optional string failure_info = 2;
210247
}
211-
// only returns when failure info exists
212-
repeated FailureInfo failure_info = 1;
248+
repeated SyncOperationResult sync_results = 1;
213249
}
214250

215251
service AccountService {

0 commit comments

Comments
 (0)