added being able to assign sessions to projects via the sessions modal

This commit is contained in:
Storme-bit
2026-04-13 20:36:42 -07:00
parent e3f6b9a9db
commit 649ed2b350
8 changed files with 163 additions and 121 deletions

View File

@@ -30,11 +30,11 @@ router.get('/', async (req, res) => {
})
router.patch('/:sessionId', async (req, res) => {
const { name } = req.body;
const { name, projectId } = req.body;
if (!name?.trim()) return res.status(400).json({ error: 'name is required' });
try {
const session = await memory.updateSession(req.params.sessionId, { name: name.trim() });
const session = await memory.updateSession(req.params.sessionId, { name, projectId });
res.json(session);
} catch (err) {
res.status(500).json({ error: err.message });

View File

@@ -63,11 +63,11 @@ async function getSessions(limit = EPISODIC.DEFAULT_SESSIONS_LIMIT, offset = EPI
return res.json();
}
async function updateSession(externalId, { name }) {
async function updateSession(externalId, { name, projectId }) {
const res = await fetch(`${BASE_URL}/sessions/by-external/${externalId}`, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ name }),
body: JSON.stringify({ name, projectId }),
});
if (!res.ok) throw new Error(`Failed to update session: ${res.status}`);
return res.json();