Performance and layout enhancements
This commit is contained in:
@@ -278,6 +278,32 @@ export const buildServer = async () => {
|
||||
service: "api"
|
||||
}));
|
||||
|
||||
app.get("/api/admin/bootstrap", async () => store.read());
|
||||
app.get("/api/admin/live", async () => {
|
||||
const state = await store.read();
|
||||
const pendingCount = state.photoAssets.filter((asset) => {
|
||||
if (asset.moderationStatus !== "pending") {
|
||||
return false;
|
||||
}
|
||||
const submission = state.submissions.find((entry) => entry.id === asset.submissionId);
|
||||
return submission?.source !== "admin_upload";
|
||||
}).length;
|
||||
|
||||
return {
|
||||
cues: state.cues,
|
||||
pendingCount,
|
||||
approvedCount: state.photoAssets.filter((asset) => asset.moderationStatus === "approved").length
|
||||
};
|
||||
});
|
||||
app.get("/api/admin/library", async () => {
|
||||
const state = await store.read();
|
||||
return {
|
||||
photoAssets: state.photoAssets,
|
||||
submissions: state.submissions,
|
||||
collections: state.collections
|
||||
};
|
||||
});
|
||||
|
||||
app.get("/api/state", async () => store.read());
|
||||
app.get("/api/scenes", async () => (await store.read()).scenes);
|
||||
app.get("/api/cues", async () => (await store.read()).cues);
|
||||
|
||||
Reference in New Issue
Block a user