Initial commit
This commit is contained in:
25
server/api/models/[urn]/status.js
Normal file
25
server/api/models/[urn]/status.js
Normal file
@@ -0,0 +1,25 @@
|
||||
export default defineEventHandler(async (event) => {
|
||||
const urn = getRouterParam(event, 'urn');
|
||||
const manifest = await getManifest(urn);
|
||||
|
||||
if (!manifest)
|
||||
return { status: 'n/a' };
|
||||
|
||||
let messages = [];
|
||||
if (manifest.derivatives) {
|
||||
for (const derivative of manifest.derivatives) {
|
||||
messages = messages.concat(derivative.messages || []);
|
||||
if (derivative.children) {
|
||||
for (const child of derivative.children) {
|
||||
messages.concat(child.messages || []);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
status: manifest.status,
|
||||
progress: manifest.progress,
|
||||
messages
|
||||
};
|
||||
})
|
||||
Reference in New Issue
Block a user