Skip to content

Commit fa565a2

Browse files
committed
This should cause the filter to return the way we are wanting
1 parent d2923ae commit fa565a2

File tree

3 files changed

+2738
-4
lines changed

3 files changed

+2738
-4
lines changed

server/src/generic-controller.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,22 @@ export class GenericController {
350350
console.log("Found records:", records.length);
351351

352352
// Return fully populated records for all models
353-
return Promise.all(
354-
records.map((r) => this.getById(modelName, r.getDataValue("id"))),
355-
);
353+
return records.map((paper) => {
354+
const paperData = paper.get({ plain: true });
355+
356+
return {
357+
...paperData,
358+
authors: Array.isArray(paperData.authors) ? paperData.authors : [],
359+
parts: Array.isArray(paperData.parts)
360+
? paperData.parts.map((part: any) => ({
361+
...part,
362+
tids: Array.isArray(part.tids) ? part.tids : [],
363+
sees: Array.isArray(part.sees) ? part.sees : [],
364+
dds: Array.isArray(part.dds) ? part.dds : [],
365+
}))
366+
: [],
367+
};
368+
});
356369
}
357370

358371
/** Create full paper along with related entities */

server/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ async function initializeSystem(): Promise<{
9898
initializeSystem().then(({ dbController, gptController }) => {
9999
app.use("/", exampleRouter);
100100
app.use("/api/dataRequest", cascadeRouter(dbController));
101-
//app.use("/api/adminRequest", adminRouter(dbController, gptController));
101+
app.use("/api/adminRequest", adminRouter(dbController, gptController));
102102

103103
//for testing
104104

0 commit comments

Comments
 (0)