diff --git a/src/routes/resources/main.ts b/src/routes/resources/main.ts index 4039ede..9dd4cbf 100644 --- a/src/routes/resources/main.ts +++ b/src/routes/resources/main.ts @@ -405,7 +405,7 @@ export default async function resourceRoutes(server: FastifyInstance) { if(resourceConfig[resource].mtoLoad) { for await (const relation of resourceConfig[resource].mtoLoad ) { if(data[relation]) { - data[relation] = await server.db.select().from(resourceConfig[relation + "s"].table).where(eq(resourceConfig[relation + "s"].table.id, data[relation])) + data[relation] = (await server.db.select().from(resourceConfig[relation + "s"].table).where(eq(resourceConfig[relation + "s"].table.id, data[relation])))[0] } } } diff --git a/src/utils/resource.config.ts b/src/utils/resource.config.ts index dd70738..c430fc5 100644 --- a/src/utils/resource.config.ts +++ b/src/utils/resource.config.ts @@ -15,7 +15,7 @@ export const resourceConfig = { projects: { searchColumns: ["name"], mtoLoad: ["customer","plant","contract","projecttype"], - mtmLoad: ["tasks", "files"], + mtmLoad: ["tasks", "files","createddocuments"], table: projects, numberRangeHolder: "projectNumber" },