Skip to content

Commit 9b46887

Browse files
committed
refactor: use types from model instead of repeating
1 parent 99286b1 commit 9b46887

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed
Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,10 @@
1+
import { ToolScope, ToolType } from '../../domain/models/ExternalTool'
2+
13
export interface ExternalToolPayload {
24
id: number
35
displayName: string
46
description: string
5-
types: ToolTypePayload[]
6-
scope: ToolScopePayload
7+
types: ToolType[]
8+
scope: ToolScope
79
contentType?: string // Only present when scope is 'file'
810
}
9-
10-
enum ToolTypePayload {
11-
Explore = 'explore',
12-
Configure = 'configure',
13-
Preview = 'preview',
14-
Query = 'query'
15-
}
16-
17-
enum ToolScopePayload {
18-
Dataset = 'dataset',
19-
File = 'file'
20-
}

src/externalTools/infra/transformers/externalToolsTransformer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ export const externalToolsTransformer = (
1313
id: tool.id,
1414
displayName: tool.displayName,
1515
description: tool.description,
16-
types: tool.types as unknown as ExternalTool['types'],
17-
scope: tool.scope as unknown as ExternalTool['scope'],
16+
types: tool.types,
17+
scope: tool.scope,
1818
contentType: tool.contentType
1919
}))
2020
}

0 commit comments

Comments
 (0)