TF-2667 Move the creation of mailbox request id to the data layer

Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
dab246
2024-03-05 18:47:31 +07:00
committed by Dat H. Pham
parent 61687b60e0
commit 016b75aa51
13 changed files with 14 additions and 50 deletions
@@ -148,9 +148,11 @@ class MailboxAPI with HandleSetErrorMixin {
}
Future<Mailbox?> createNewMailbox(Session session, AccountId accountId, CreateNewMailboxRequest request) async {
final generateCreateId = Id(_uuid.v1());
final setMailboxMethod = SetMailboxMethod(accountId)
..addCreate(
request.creationId,
generateCreateId,
Mailbox(
name: request.newName,
isSubscribed: IsSubscribed(request.isSubscribed),
@@ -176,14 +178,14 @@ class MailboxAPI with HandleSetErrorMixin {
final mapMailboxCreated = setMailboxResponse?.created;
if (mapMailboxCreated != null &&
mapMailboxCreated.containsKey(request.creationId)) {
final mailboxCreated = mapMailboxCreated[request.creationId]!;
mapMailboxCreated.containsKey(generateCreateId)) {
final mailboxCreated = mapMailboxCreated[generateCreateId]!;
final newMailboxCreated = mailboxCreated.toMailbox(
request.newName,
parentId: request.parentId);
return newMailboxCreated;
} else {
throw _parseErrorForSetMailboxResponse(setMailboxResponse, request.creationId);
throw _parseErrorForSetMailboxResponse(setMailboxResponse, generateCreateId);
}
}