diff --git a/server/index.js b/server/index.js index 6ad73497..f2dd9882 100755 --- a/server/index.js +++ b/server/index.js @@ -27,7 +27,7 @@ import { promises as fsPromises } from 'fs'; import { spawn } from 'child_process'; import pty from 'node-pty'; import mime from 'mime-types'; -import { getProjects } from '@/modules/projects'; +import { getProjectsWithSessions } from '@/modules/projects'; import { getSessionsById, @@ -142,7 +142,7 @@ async function setupProjectsWatcher() { clearProjectDirectoryCache(); // Get updated projects list - const updatedProjects = await getProjects(broadcastProgress); + const updatedProjects = await getProjectsWithSessions(broadcastProgress); // Notify all connected clients about the project changes const updateMessage = JSON.stringify({ @@ -431,7 +431,7 @@ app.post('/api/system/update', authenticateToken, async (req, res) => { app.get('/api/projects', authenticateToken, async (req, res) => { try { - const projects = await getProjects(broadcastProgress); + const projects = await getProjectsWithSessions(broadcastProgress); res.json(projects); } catch (error) { res.status(500).json({ error: error.message }); @@ -2375,7 +2375,7 @@ async function startServer() { // Start watching the projects folder for changes await setupProjectsWatcher(); - // await getProjects(); // TODO: REMOVE THIS + // await getProjectsWithSessions(); // TODO: REMOVE THIS // Start server-side plugin processes for enabled plugins startEnabledPluginServers().catch(err => { console.error('[Plugins] Error during startup:', err.message); diff --git a/server/modules/projects/index.ts b/server/modules/projects/index.ts index bee7b5fc..f180cad3 100644 --- a/server/modules/projects/index.ts +++ b/server/modules/projects/index.ts @@ -1,6 +1,6 @@ export { createProjectsSnapshot, generateDisplayName, - getProjects, + getProjectsWithSessions, writeSnapshot, } from './services/projects.service.js'; \ No newline at end of file diff --git a/server/modules/projects/services/projects.service.ts b/server/modules/projects/services/projects.service.ts index 2ad67f99..5967d54d 100644 --- a/server/modules/projects/services/projects.service.ts +++ b/server/modules/projects/services/projects.service.ts @@ -175,7 +175,7 @@ export async function writeSnapshot(projects: ProjectListItem[]): Promise /** * Reads all projects from DB and returns provider-bucketed session summaries. */ -export async function getProjects(progressCallback: ProgressCallback = null): Promise { +export async function getProjectsWithSessions(progressCallback: ProgressCallback = null): Promise { await sessionSynchronizerService.synchronizeSessions(); const projectRows = projectsDb.getProjectPaths() as Array<{ diff --git a/server/projects.js b/server/projects.js index 86456134..f8e0d46c 100755 --- a/server/projects.js +++ b/server/projects.js @@ -872,7 +872,7 @@ async function renameProject(projectName, newDisplayName) { * ID-based wrapper around `renameProject`. * * Writes the new display name to the `projects.custom_project_name` column - * (the source of truth for the DB-driven getProjects() response) and also + * (the source of truth for the DB-driven getProjectsWithSessions() response) and also * keeps the legacy project-config.json in sync for backwards compatibility * with any code that still reads it. */ @@ -883,7 +883,7 @@ async function renameProjectById(projectId, newDisplayName) { } const trimmed = typeof newDisplayName === 'string' ? newDisplayName.trim() : ''; - // Persist on the DB row so getProjects() immediately reflects the change. + // Persist on the DB row so getProjectsWithSessions() immediately reflects the change. projectsDb.updateCustomProjectNameById(projectId, trimmed.length > 0 ? trimmed : null); // Keep the legacy file-based project config in lockstep so historic readers