Fix flat entity maps date serialization (#16420)
Changes: - as we store date in redis as serialized, let's make all flatEntity dates as string. This requires changing FlatEntity types and making sure that entity are converted to flatEntity and flatEntity to dtos
This commit is contained in:
+2
-2
@@ -20,7 +20,7 @@ export const fromFlatAgentWithRoleIdToAgentDto = ({
|
||||
workspaceId,
|
||||
roleId,
|
||||
}: FlatAgentWithRoleId): AgentDTO => ({
|
||||
createdAt,
|
||||
createdAt: new Date(createdAt),
|
||||
description: description ?? undefined,
|
||||
evaluationInputs,
|
||||
id,
|
||||
@@ -32,7 +32,7 @@ export const fromFlatAgentWithRoleIdToAgentDto = ({
|
||||
prompt,
|
||||
responseFormat,
|
||||
standardId,
|
||||
updatedAt,
|
||||
updatedAt: new Date(updatedAt),
|
||||
workspaceId,
|
||||
applicationId: applicationId ?? undefined,
|
||||
icon: icon ?? undefined,
|
||||
|
||||
+3
-3
@@ -5,9 +5,9 @@ export const transformAgentEntityToFlatAgent = (
|
||||
agentEntity: AgentEntity,
|
||||
): FlatAgent => {
|
||||
return {
|
||||
createdAt: agentEntity.createdAt,
|
||||
deletedAt: agentEntity.deletedAt,
|
||||
updatedAt: agentEntity.updatedAt,
|
||||
createdAt: agentEntity.createdAt.toISOString(),
|
||||
deletedAt: agentEntity.deletedAt?.toISOString() ?? null,
|
||||
updatedAt: agentEntity.updatedAt.toISOString(),
|
||||
id: agentEntity.id,
|
||||
standardId: agentEntity.standardId,
|
||||
name: agentEntity.name,
|
||||
|
||||
+4
-4
@@ -21,13 +21,13 @@ export const transformStandardAgentDefinitionToFlatAgent = ({
|
||||
outputStrategy: _outputStrategy,
|
||||
...agentData
|
||||
} = standardAgentDefinition;
|
||||
const createdAt = new Date();
|
||||
const createdAt = new Date().toISOString();
|
||||
|
||||
return {
|
||||
id: existingAgentEntity?.id ?? v4(),
|
||||
createdAt: existingAgentEntity?.createdAt ?? createdAt,
|
||||
updatedAt: existingAgentEntity?.updatedAt ?? createdAt,
|
||||
deletedAt: existingAgentEntity?.deletedAt ?? null,
|
||||
createdAt: existingAgentEntity?.createdAt?.toISOString() ?? createdAt,
|
||||
updatedAt: existingAgentEntity?.updatedAt?.toISOString() ?? createdAt,
|
||||
deletedAt: existingAgentEntity?.deletedAt?.toISOString() ?? null,
|
||||
...agentData,
|
||||
workspaceId,
|
||||
universalIdentifier: standardAgentDefinition.standardId,
|
||||
|
||||
Reference in New Issue
Block a user