Skip to content

Commit 9bbb556

Browse files
feat: Include Manual Data Entry in migration toolkit (#97) (#98)
1 parent e837c75 commit 9bbb556

21 files changed

Lines changed: 833 additions & 3 deletions

Modules/CluedIn.Product.Toolkit/CluedIn.Product.Toolkit.psd1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,11 @@ FunctionsToExport = 'Connect-CluedInOrganization', 'Get-CluedInAdminSetting',
118118
'Import-Glossaries', 'Set-CluedInDataSourceDatabaseConfiguration',
119119
'Get-CluedInGlossaryTags', 'Set-CluedInDataSet',
120120
'New-CluedInAnnotationCode', 'Set-CluedInAnnotationCode',
121-
'Get-CluedInAnnotationCodes'
121+
'Get-CluedInAnnotationCodes', 'Export-ManualDataEntryProjects',
122+
'Get-CluedInManualDataEntryProject', 'Get-CluedInManualDataEntryProjects',
123+
'Import-ManualDataEntryProjects', 'New-CluedInManualDataEntryProject',
124+
'Set-CluedInManualDataEntryProject', 'Set-CluedInManualDataEntryProjectFormField',
125+
'New-CluedInManualDataEntryProjectFormField'
122126

123127
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
124128
CmdletsToExport = @()
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
mutation addManualDataEntryProjectFormField(
2+
$projectId: ID!
3+
$formField: FormFieldInput
4+
) {
5+
management {
6+
addManualDataEntryProjectFormField(
7+
projectId: $projectId
8+
formField: $formField
9+
) {
10+
id
11+
label
12+
description
13+
vocabularyKey
14+
type
15+
onlyExistingValues
16+
isRequired
17+
onlyAllowedValues
18+
preventForbiddenValues
19+
parameters
20+
__typename
21+
}
22+
__typename
23+
}
24+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
mutation createManualDataEntryProject(
2+
$manualDataEntryProject: ManualDataEntryProjectInput
3+
) {
4+
management {
5+
createManualDataEntryProject(
6+
manualDataEntryProject: $manualDataEntryProject
7+
) {
8+
id
9+
title
10+
description
11+
entityType
12+
entityTypeConfiguration {
13+
icon
14+
displayName
15+
entityType
16+
__typename
17+
}
18+
__typename
19+
}
20+
__typename
21+
}
22+
}
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
query manualDataEntryProject($id: ID!) {
2+
management {
3+
manualDataEntryProject(id: $id) {
4+
id
5+
title
6+
requireApproval
7+
isOwner
8+
description
9+
entityType
10+
hasPendingRecordsApproval
11+
entityTypeConfiguration {
12+
icon
13+
displayName
14+
entityType
15+
__typename
16+
}
17+
createdAt
18+
createdBy
19+
createdByUser {
20+
id
21+
username
22+
__typename
23+
}
24+
modifiedAt
25+
modifiedBy
26+
annotationId
27+
fieldMappings {
28+
id
29+
originalField
30+
key
31+
columnType
32+
columnSubType
33+
__typename
34+
}
35+
connectorConfigurationId
36+
connectorConfiguration {
37+
id
38+
name
39+
accountDisplay
40+
accountId
41+
active
42+
autoSync
43+
codeName
44+
connector {
45+
id
46+
icon
47+
name
48+
authMethods
49+
properties
50+
streamModes
51+
__typename
52+
}
53+
createdDate
54+
entityId
55+
failingAuthentication
56+
guide
57+
helperConfiguration
58+
providerId
59+
reAuthEndpoint
60+
source
61+
sourceQuality
62+
stats
63+
status
64+
supportsAutomaticWebhookCreation
65+
supportsConfiguration
66+
supportsWebhooks
67+
userId
68+
userName
69+
users {
70+
id
71+
username
72+
roles
73+
__typename
74+
}
75+
permissions {
76+
user {
77+
id
78+
username
79+
__typename
80+
}
81+
role {
82+
id
83+
name
84+
userCount
85+
__typename
86+
}
87+
createdDate
88+
__typename
89+
}
90+
webhookManagementEndpoints
91+
webhooks
92+
__typename
93+
}
94+
vocabularyId
95+
vocabulary {
96+
vocabularyId
97+
vocabularyName
98+
keyPrefix
99+
__typename
100+
}
101+
formFields {
102+
id
103+
position
104+
label
105+
description
106+
vocabularyKey
107+
isRequired
108+
createdAt
109+
createdBy
110+
type
111+
onlyExistingValues
112+
onlyAllowedValues
113+
preventForbiddenValues
114+
parameters
115+
useAsEntityCode
116+
isArchived
117+
createdByUser {
118+
id
119+
username
120+
__typename
121+
}
122+
vocabularyKeyObject {
123+
displayName
124+
vocabularyKeyId
125+
isCluedInCore
126+
isDynamic
127+
isObsolete
128+
mappedKey
129+
isProvider
130+
vocabularyId
131+
name
132+
isVisible
133+
key
134+
groupName
135+
dataClassificationCode
136+
dataType
137+
description
138+
providerId
139+
mapsToOtherKeyId
140+
vocabulary {
141+
connector {
142+
about
143+
icon
144+
id
145+
name
146+
__typename
147+
}
148+
vocabularyId
149+
vocabularyName
150+
__typename
151+
}
152+
__typename
153+
}
154+
__typename
155+
}
156+
__typename
157+
}
158+
__typename
159+
}
160+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
query getManualDataEntryProjects($pageNumber: Int, $pageSize: Int) {
2+
management {
3+
manualDataEntryProjects(pageNumber: $pageNumber, pageSize: $pageSize) {
4+
total
5+
data {
6+
id
7+
title
8+
description
9+
entityType
10+
createdAt
11+
createdBy
12+
modifiedAt
13+
modifiedBy
14+
annotationId
15+
entityTypeConfiguration {
16+
icon
17+
displayName
18+
entityType
19+
__typename
20+
}
21+
createdByUser {
22+
id
23+
email
24+
username
25+
__typename
26+
}
27+
formFields {
28+
id
29+
label
30+
description
31+
vocabularyKey
32+
type
33+
parameters
34+
isRequired
35+
onlyExistingValues
36+
onlyAllowedValues
37+
preventForbiddenValues
38+
isArchived
39+
__typename
40+
}
41+
__typename
42+
}
43+
__typename
44+
}
45+
__typename
46+
}
47+
}

Modules/CluedIn.Product.Toolkit/GraphQL/getVocabularyByKeyName.gql renamed to Modules/CluedIn.Product.Toolkit/GraphQL/getVocabularyKeyByKeyName.gql

File renamed without changes.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
mutation saveManualDataEntryProject(
2+
$id: ID!
3+
$manualDataEntryProject: ManualDataEntryProjectInput
4+
) {
5+
management {
6+
saveManualDataEntryProject(
7+
id: $id
8+
manualDataEntryProject: $manualDataEntryProject
9+
) {
10+
id
11+
title
12+
description
13+
entityType
14+
__typename
15+
}
16+
__typename
17+
}
18+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
mutation saveManualDataEntryProjectFormField(
2+
$projectId: ID!
3+
$formField: FormFieldInput
4+
) {
5+
management {
6+
saveManualDataEntryProjectFormField(
7+
projectId: $projectId
8+
formField: $formField
9+
) {
10+
id
11+
label
12+
description
13+
vocabularyKey
14+
type
15+
onlyExistingValues
16+
useAsEntityCode
17+
isRequired
18+
onlyAllowedValues
19+
preventForbiddenValues
20+
isArchived
21+
__typename
22+
}
23+
__typename
24+
}
25+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
function Export-ManualDataEntryProjects{
2+
<#
3+
.SYNOPSIS
4+
Wrapper for exporting manual data entry projects
5+
6+
.DESCRIPTION
7+
Wrapper for exporting manual data entry projects
8+
9+
.PARAMETER BackupPath
10+
The path to the backup folder
11+
12+
.EXAMPLE
13+
PS> Export-DataSets -BackupPath "c:\backuplocation"
14+
15+
This will export all of the deduplication project details
16+
#>
17+
18+
[CmdletBinding()]
19+
param(
20+
[Parameter(Mandatory)][string]$BackupPath,
21+
[string]$SelectManualDataEntryProjects = 'None'
22+
)
23+
Write-Host "INFO: Exporting Manual Data Entry Projects" -ForegroundColor 'Green'
24+
25+
$path = Join-Path -Path $BackupPath -ChildPath 'ManualDataEntryProjects'
26+
if (!(Test-Path -Path $path -PathType Container)) { New-Item $path -ItemType Directory | Out-Null }
27+
28+
switch ($SelectManualDataEntryProjects) {
29+
'All' {
30+
$manualDataEntryProjects = Get-CluedInManualDataEntryProjects
31+
[array]$manualDataEntryProjectIds = $manualDataEntryProjects.data.management.manualDataEntryProjects.data.id
32+
}
33+
'None' { $null }
34+
default { $manualDataEntryProjectIds = ($SelectManualDataEntryProjects -Split ',').Trim() }
35+
}
36+
37+
foreach ($id in $manualDataEntryProjectIds) {
38+
Write-Verbose "Processing id: $id"
39+
$manualDataEntryProject = Get-CluedInManualDataEntryProject -Id $id
40+
if ((!$?) -or ($manualDataEntryProject.errors)) { Write-Warning "Manual data entry project '$id' was not found. This won't be backed up"; continue }
41+
42+
Write-Host "Exporting Manual Data Entry Project: '$($manualDataEntryProject.data.management.manualDataEntryProject.title) ($id)'" -ForegroundColor 'Cyan'
43+
$manualDataEntryProject | Out-JsonFile -Path $path -Name ('{0}-ManualDataEntryProject' -f $id)
44+
45+
$annotationId = $manualDataEntryProject.data.management.manualDataEntryProject.annotationId
46+
switch ($annotationId) {
47+
$null { Write-Warning "No annotation detected. Skipping export of annotations" }
48+
default {
49+
Write-Host "Exporting Annotation" -ForegroundColor 'Cyan'
50+
Get-CluedInAnnotations -id $annotationId | Out-JsonFile -Path $path -Name ('{0}-Annotation' -f $id)
51+
}
52+
}
53+
54+
# Left for the future when manual data entry switches to using annotation codes
55+
# switch ($annotationId) {
56+
# $null { Write-Warning "No annotation detected. Skipping export of codes" }
57+
# default {
58+
# Write-Host "Exporting Codes" -ForegroundColor 'Cyan'
59+
# Get-CluedInAnnotationCodes -Id $annotationId | Out-JsonFile -Path $path -Name ('{0}-Annotation-Codes' -f $id)
60+
# }
61+
# }
62+
}
63+
}

0 commit comments

Comments
 (0)