forked from pinks/eris
main #14
|
@ -4,12 +4,29 @@ import { generationQueue } from "../app/generationQueue.ts";
|
||||||
export const jobsRoute = createMethodFilter({
|
export const jobsRoute = createMethodFilter({
|
||||||
GET: createEndpoint(
|
GET: createEndpoint(
|
||||||
{ query: null, body: null },
|
{ query: null, body: null },
|
||||||
async () => ({
|
async () => {
|
||||||
status: 200,
|
const allJobs = await generationQueue.getAllJobs();
|
||||||
body: {
|
const filteredJobsData = allJobs.map((job) => ({
|
||||||
type: "application/json",
|
id: job.id,
|
||||||
data: await generationQueue.getAllJobs(),
|
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,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue