mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-01-16 13:12:10 +01:00
fix: standardize nullable field handling in session mapping
- Use undefined for optional boolean fields (escalated, forwardedHr) - Use null for fields explicitly typed as '| null' in ChatSession interface - Use undefined for optional-only fields (messagesSent, initialMsg) - Ensures type consistency throughout mapPrismaSessionToChatSession function
This commit is contained in:
@ -53,13 +53,13 @@ function mapPrismaSessionToChatSession(prismaSession: {
|
|||||||
country: prismaSession.country ?? null,
|
country: prismaSession.country ?? null,
|
||||||
ipAddress: prismaSession.ipAddress ?? null,
|
ipAddress: prismaSession.ipAddress ?? null,
|
||||||
sentiment: prismaSession.sentiment ?? null,
|
sentiment: prismaSession.sentiment ?? null,
|
||||||
messagesSent: prismaSession.messagesSent ?? undefined, // Maintain consistency with other nullable fields
|
messagesSent: prismaSession.messagesSent ?? undefined,
|
||||||
avgResponseTime: prismaSession.avgResponseTime ?? null,
|
avgResponseTime: prismaSession.avgResponseTime ?? null,
|
||||||
escalated: prismaSession.escalated ?? false,
|
escalated: prismaSession.escalated ?? undefined,
|
||||||
forwardedHr: prismaSession.forwardedHr ?? false,
|
forwardedHr: prismaSession.forwardedHr ?? undefined,
|
||||||
initialMsg: prismaSession.initialMsg ?? undefined,
|
initialMsg: prismaSession.initialMsg ?? undefined,
|
||||||
fullTranscriptUrl: prismaSession.fullTranscriptUrl ?? undefined,
|
fullTranscriptUrl: prismaSession.fullTranscriptUrl ?? null,
|
||||||
summary: prismaSession.summary ?? undefined, // New field
|
summary: prismaSession.summary ?? null,
|
||||||
transcriptContent: undefined, // Not available in Session model
|
transcriptContent: undefined, // Not available in Session model
|
||||||
messages:
|
messages:
|
||||||
prismaSession.messages?.map((msg) => ({
|
prismaSession.messages?.map((msg) => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user