MCPcopy Create free account
hub / github.com/BingyanStudio/github-analyzer / getSession

Method getSession

api/src/services/sessionStore.ts:26–46  ·  view source on GitHub ↗

* Get session data from Redis * @param sessionId The session ID * @returns Session data or null if not found

(sessionId: string)

Source from the content-addressed store, hash-verified

24 * @returns Session data or null if not found
25 */
26 async getSession(sessionId: string): Promise<UserSession | null> {
27 const data = await redis.get(`session:${sessionId}`);
28 if (!data) return null;
29
30 try {
31 const session = JSON.parse(data) as UserSession;
32
33 // Convert date strings back to Date objects
34 if (session.expiresAt) {
35 session.expiresAt = new Date(session.expiresAt);
36 }
37 if (session.createdAt) {
38 session.createdAt = new Date(session.createdAt);
39 }
40
41 return session;
42 } catch (error) {
43 console.error("Error parsing session data:", error);
44 return null;
45 }
46 }
47
48 /**
49 * Remove a session from Redis

Callers 5

updateSessionMethod · 0.95
refreshTokenIfNeededMethod · 0.95
fetchUserDataEndpointFunction · 0.45
generateReportFunction · 0.45
getUserSessionFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected