Skip to content

Commit 02a87b6

Browse files
committed
chore: handle case tags
1 parent 5ab91eb commit 02a87b6

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

packages/backend/src/apps/gathersg/actions/get-case-details/get-data-out-metadata.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ async function getDataOutMetadata(
5151
},
5252
}
5353

54+
// handle tags if any
55+
// tags are an array of strings and exist at the top level alongside the
56+
// uuid, caseRef, etc
57+
const tagsMetadata = Object.create(null)
58+
if (dataOut.tags && Array.isArray(dataOut.tags)) {
59+
for (let i = 0; i < dataOut.tags.length; i++) {
60+
tagsMetadata[i] = { label: `Tag` }
61+
}
62+
}
63+
5464
// handle hex-encoded field names from dataOut
5565
const fieldsMetadata = Object.create(null)
5666

@@ -108,6 +118,7 @@ async function getDataOutMetadata(
108118
return {
109119
data: {
110120
...metadata.data,
121+
tags: tagsMetadata,
111122
fields: fieldsMetadata,
112123
},
113124
}

packages/backend/src/apps/gathersg/actions/get-case-details/schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const dataOutSchema = z.object({
2222
name: z.string().min(1),
2323
})
2424
.nullish(),
25+
tags: z.array(z.string()).nullish(),
2526
})
2627
.nullish(),
2728
})

0 commit comments

Comments
 (0)