1
0
Fork 0

fix(backend): Parse JSON as POJO before returning

This commit is contained in:
joostdecock 2023-05-08 09:43:03 +02:00
parent 6dbc6fe078
commit f1ceea32f9

View file

@ -118,7 +118,16 @@ CuratedSetModel.prototype.allCuratedSets = async function () {
log.warn(`Failed to search curated sets: ${err}`)
}
const list = []
for (const curatedSet of curatedSets) list.push(curatedSet)
for (const curatedSet of curatedSets) {
// FIXME: Convert object to JSON. See https://github.com/prisma/prisma/issues/3786
const asPojo = { ...curatedSet }
asPojo.measies = JSON.parse(asPojo.measies)
for (const lang of this.config.languages) {
const key = `tags${capitalize(lang)}`
asPojo[key] = JSON.parse(asPojo[key] || [])
}
list.push(asPojo)
}
return list
}