-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Expand file tree
/
Copy pathagent-response.mapper.ts
More file actions
44 lines (40 loc) · 1.31 KB
/
agent-response.mapper.ts
File metadata and controls
44 lines (40 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import type { AgentEntity, AgentIntegrationEntity, IntegrationEntity } from '@novu/dal';
import type { AgentIntegrationResponseDto, AgentIntegrationSummaryDto, AgentResponseDto } from '../dtos';
export function toAgentResponse(agent: AgentEntity): AgentResponseDto {
return {
_id: agent._id,
name: agent.name,
identifier: agent.identifier,
description: agent.description,
_environmentId: agent._environmentId,
_organizationId: agent._organizationId,
createdAt: agent.createdAt,
updatedAt: agent.updatedAt,
};
}
export function toAgentIntegrationSummary(
integration: Pick<IntegrationEntity, '_id' | 'identifier' | 'name' | 'providerId' | 'channel' | 'active'>
): AgentIntegrationSummaryDto {
return {
integrationId: integration._id,
providerId: integration.providerId,
name: integration.name,
identifier: integration.identifier,
channel: integration.channel,
active: integration.active,
};
}
export function toAgentIntegrationResponse(
link: AgentIntegrationEntity,
integrationIdentifier: string
): AgentIntegrationResponseDto {
return {
_id: link._id,
_agentId: link._agentId,
integrationIdentifier,
_environmentId: link._environmentId,
_organizationId: link._organizationId,
createdAt: link.createdAt,
updatedAt: link.updatedAt,
};
}