Skip to content

Commit

Permalink
fix: return empty presets array in case no settings
Browse files Browse the repository at this point in the history
  • Loading branch information
luandro committed Feb 4, 2025
1 parent f0f5f9f commit 2e276bd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/routes/projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ export default async function projectsRoutes(fastify, opts) {
data: Type.Object({
name: Type.Optional(Type.String()),
presets: Type.Array(Type.Any()),
fields: Type.Array(Type.Any()),
}),
}),
404: schemas.errorResponse,
Expand All @@ -126,6 +125,13 @@ export default async function projectsRoutes(fastify, opts) {
throw errors.projectNotFoundError()
}
const settings = await project.$getProjectSettings()
if (Object.keys(settings).length === 0) {
return {
data: {
presets: [],
},
}
}
const presets = await project.preset.getMany()
const fields = await project.field.getMany()

Expand Down

0 comments on commit 2e276bd

Please sign in to comment.