feat: add workapp mail sync API

This commit is contained in:
2026-04-29 16:29:38 +00:00
parent a22cc1c0eb
commit 5fbe2eb80b
9 changed files with 773 additions and 4 deletions
@@ -129,6 +129,36 @@ export class WorkHosterHandler {
},
),
);
this.typedrouter.addTypedHandler(
new plugins.typedrequest.TypedHandler<interfaces.requests.IReq_GetWorkAppMailIdentities>(
'getWorkAppMailIdentities',
async (dataArg) => {
await this.requireAuth(dataArg, 'workhosters:read');
const manager = this.opsServerRef.dcRouterRef.workAppMailManager;
if (!manager) return { identities: [] };
return { identities: await manager.listMailIdentities(dataArg.ownership) };
},
),
);
this.typedrouter.addTypedHandler(
new plugins.typedrequest.TypedHandler<interfaces.requests.IReq_SyncWorkAppMailIdentity>(
'syncWorkAppMailIdentity',
async (dataArg) => {
const userId = await this.requireAuth(dataArg, 'workhosters:write');
const manager = this.opsServerRef.dcRouterRef.workAppMailManager;
if (!manager) {
return { success: false, message: 'WorkApp mail manager not initialized' };
}
try {
return await manager.syncMailIdentity(dataArg, userId);
} catch (error) {
return { success: false, message: (error as Error).message };
}
},
),
);
}
private getGatewayCapabilities(): interfaces.data.IGatewayCapabilities {