fixed memory service routes
This commit is contained in:
@@ -41,6 +41,13 @@ app.post('/sessions', (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
// Retrieves a session by its external ID
|
||||
app.get('/sessions/by-external/:externalId', (req, res) => {
|
||||
const session = episodic.getSessionByExternalId(req.params.externalId);
|
||||
if (!session) return res.status(404).json({ error: 'Session not found' });
|
||||
res.json(session);
|
||||
});
|
||||
|
||||
// Retrieves a session by its internal ID
|
||||
app.get('/sessions/:id', (req, res) => {
|
||||
const session = episodic.getSession(req.params.id);
|
||||
@@ -48,12 +55,7 @@ app.get('/sessions/:id', (req, res) => {
|
||||
res.json(session);
|
||||
});
|
||||
|
||||
// Retrieves a session by its external ID
|
||||
app.get('/sessions/by-external/:externalId', (req, res) => {
|
||||
const session = episodic.getSessionByExternalId(req.params.externalId);
|
||||
if (!session) return res.status(404).json({ error: 'Session not found' });
|
||||
res.json(session);
|
||||
});
|
||||
|
||||
|
||||
|
||||
// Updates the session's updated_at timestamp to now
|
||||
@@ -119,6 +121,11 @@ app.post('/entities', (req, res) => {
|
||||
res.status(201).json(entity);
|
||||
});
|
||||
|
||||
// Get all entities of a given type
|
||||
app.get('/entities/by-type/:type', (req, res) => {
|
||||
res.json(entities.getEntitiesByType(req.params.type));
|
||||
});
|
||||
|
||||
// Get an entity by ID
|
||||
app.get('/entities/:id', (req, res) => {
|
||||
const entity = entities.getEntity(req.params.id);
|
||||
@@ -126,10 +133,7 @@ app.get('/entities/:id', (req, res) => {
|
||||
res.json(entity);
|
||||
});
|
||||
|
||||
// Get all entities of a given type
|
||||
app.get('/entities/by-type/:type', (req, res) => {
|
||||
res.json(entities.getEntitiesByType(req.params.type));
|
||||
});
|
||||
|
||||
|
||||
// Delete an entity by ID
|
||||
app.delete('/entities/:id', (req, res) => {
|
||||
|
||||
Reference in New Issue
Block a user