refactor(db): group database domain modules
This commit is contained in:
1 parent
e43a89096d
commit
6da0a58769
160 files changed
+2124
-1999
No files matched your search
@@ -30,7 +30,7 @@ export function registerBrowserHandlers({
|
||||
const input = socialAccountInputSchema.parse(payload);
|
||||
const err = ensureCompanyExists(input.companyId);
|
||||
if (err) return err;
|
||||
const id = db.social.saveSocialAccount(input);
|
||||
const id = db.core.social.saveSocialAccount(input);
|
||||
publishDomainChanged();
|
||||
return ok(id);
|
||||
});
|
||||
@@ -39,12 +39,12 @@ export function registerBrowserHandlers({
|
||||
const input = deleteEntitySchema.parse(payload);
|
||||
const err = ensureCompanyExists(input.companyId);
|
||||
if (err) return err;
|
||||
const browserActions = db.social.listBrowserActions(input.companyId, { socialAccountId: input.id, limit: 500 });
|
||||
const browserActions = db.core.social.listBrowserActions(input.companyId, { socialAccountId: input.id, limit: 500 });
|
||||
await getBrowserActions()?.clearSocialAccountData(
|
||||
input.id,
|
||||
browserActions.flatMap((action: { screenshotPath: string | null }) => (action.screenshotPath ? [action.screenshotPath] : [])),
|
||||
);
|
||||
db.social.deleteSocialAccount(input.id, input.companyId);
|
||||
db.core.social.deleteSocialAccount(input.id, input.companyId);
|
||||
publishDomainChanged();
|
||||
return ok(true);
|
||||
});
|
||||
@@ -53,7 +53,7 @@ export function registerBrowserHandlers({
|
||||
const input = browserActionQuerySchema.parse(payload);
|
||||
const err = ensureCompanyExists(input.companyId);
|
||||
if (err) return err;
|
||||
return ok(db.social.listBrowserActions(input.companyId, {
|
||||
return ok(db.core.social.listBrowserActions(input.companyId, {
|
||||
socialAccountId: input.socialAccountId,
|
||||
status: input.status,
|
||||
limit: input.limit,
|
||||
@@ -62,12 +62,12 @@ export function registerBrowserHandlers({
|
||||
|
||||
registerHandle(IPC_CHANNELS.cancelBrowserAction, (_event, payload) => {
|
||||
const input = cancelBrowserActionSchema.parse(payload);
|
||||
const action = db.social.getBrowserAction(input.actionId, input.companyId);
|
||||
const action = db.core.social.getBrowserAction(input.actionId, input.companyId);
|
||||
if (!action) {
|
||||
return fail("BROWSER_ACTION_NOT_FOUND", "Browser action not found.");
|
||||
}
|
||||
getBrowserActions()?.cancelAction(input.actionId);
|
||||
db.social.updateBrowserAction(input.actionId, {
|
||||
db.core.social.updateBrowserAction(input.actionId, {
|
||||
status: "cancelled",
|
||||
resultSummary: "Browser action cancelled from the desktop control surface.",
|
||||
errorMessage: "Action cancelled.",
|
||||
@@ -86,7 +86,7 @@ export function registerBrowserHandlers({
|
||||
return fail("BROWSER_NOT_READY", "Browser manager not initialized");
|
||||
}
|
||||
|
||||
const account = db.social.getSocialAccount(input.socialAccountId, input.companyId);
|
||||
const account = db.core.social.getSocialAccount(input.socialAccountId, input.companyId);
|
||||
if (!account) {
|
||||
return fail("ACCOUNT_NOT_FOUND", "Social account not found");
|
||||
}
|
||||
@@ -97,7 +97,7 @@ export function registerBrowserHandlers({
|
||||
inflightBrowserLogins.add(input.socialAccountId);
|
||||
browserActions.launchLoginBrowser(input.socialAccountId, account.platform).then(async (result) => {
|
||||
if (result.success) {
|
||||
const latestAccount = db.social.getSocialAccount(input.socialAccountId, account.companyId);
|
||||
const latestAccount = db.core.social.getSocialAccount(input.socialAccountId, account.companyId);
|
||||
if (!latestAccount) {
|
||||
return;
|
||||
}
|
||||
@@ -110,7 +110,7 @@ export function registerBrowserHandlers({
|
||||
} catch (err) {
|
||||
logger.warn(`[ipc/browser] extractProfileFromSession failed for social account ${input.socialAccountId}:`, err instanceof Error ? err.message : String(err));
|
||||
}
|
||||
db.social.saveSocialAccount({
|
||||
db.core.social.saveSocialAccount({
|
||||
id: latestAccount.id,
|
||||
companyId: latestAccount.companyId,
|
||||
platform: latestAccount.platform,
|
||||
|
||||
Reference in new issue
Block a user