PR #24

Merged
pinks merged 11 commits from nameless/eris:pr-main into main 2023-11-17 18:00:14 +00:00
1 changed files with 24 additions and 7 deletions
Showing only changes of commit e270a3ab1f - Show all commits

View File

@ -4,12 +4,29 @@ import { generationQueue } from "../app/generationQueue.ts";
export const jobsRoute = createMethodFilter({
GET: createEndpoint(
{ query: null, body: null },
async () => ({
status: 200,
body: {
type: "application/json",
data: await generationQueue.getAllJobs(),
},
}),
async () => {
const allJobs = await generationQueue.getAllJobs();
const filteredJobsData = allJobs.map((job) => ({
id: job.id,
place: job.place,
state: {
from: {
language_code: job.state.from.language_code,
first_name: job.state.from.first_name,
last_name: job.state.from.last_name,
username: job.state.from.username,
},
progress: job.state.progress,
workerInstanceKey: job.state.workerInstanceKey,
},
}));
return {
status: 200,
body: {
type: "application/json",
data: filteredJobsData,
},
};
},
),
});