MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / getSessionsByUser

Method getSessionsByUser

server/src/db/si-db.ts:261–284  ·  view source on GitHub ↗
(
    userIdentifier: string,
    identifierType: "slack_id" | "email" | "anonymous"
  )

Source from the content-addressed store, hash-verified

259 }
260
261 async getSessionsByUser(
262 userIdentifier: string,
263 identifierType: "slack_id" | "email" | "anonymous"
264 ): Promise<SiSession[]> {
265 let column: string;
266 switch (identifierType) {
267 case "slack_id":
268 column = "user_slack_id";
269 break;
270 case "email":
271 column = "user_email";
272 break;
273 case "anonymous":
274 column = "user_anonymous_id";
275 break;
276 }
277
278 const result = await query(
279 `SELECT * FROM si_sessions WHERE ${column} = $1 ORDER BY created_at DESC`,
280 [userIdentifier]
281 );
282
283 return result.rows.map((row) => this.deserializeSession(row));
284 }
285
286 // --------------------------------------------------------------------------
287 // Messages

Callers 1

createSiChatRoutesFunction · 0.80

Calls 2

deserializeSessionMethod · 0.95
queryFunction · 0.85

Tested by

no test coverage detected