missing POST /sessions

This commit is contained in:
Storme-bit
2026-04-15 02:52:31 -07:00
parent 5f5fec9d00
commit 46f3013a51
2 changed files with 12 additions and 5 deletions

View File

@@ -43,11 +43,18 @@ app.get('/sessions', (req, res) => {
res.json(sessions);
});
app.get('/sessions', (req, res) => {
const {limit = EPISODIC.DEFAULT_PAGE_SIZE, offset = EPISODIC.DEFAULT_OFFSET, projectId } = req.query;
const sessions = episodic.getSessions(Number(limit), Number(offset, projectId ?? null));
res.json(sessions);
})
app.post('/sessions', (req, res) => {
const { externalId, metadata } = req.body;
if (!externalId) {
return res.status(400).json({ error: 'externalId is required' });
}
try {
const session = episodic.createSession(externalId, metadata);
res.status(201).json(session);
} catch (err) {
res.status(409).json({ error: 'Session already exists', detail: err.message });
}
});
// Retrieves a session by its external ID
app.get('/sessions/by-external/:externalId', (req, res) => {

BIN
packages/source.zip Normal file

Binary file not shown.