feat: Add maxItems validation to jobIds array and improve API response error handling.
This commit is contained in:
parent
8b6c64bff7
commit
a00597440f
2 changed files with 5 additions and 1 deletions
|
|
@ -109,7 +109,7 @@ export const deleteJob = new Elysia()
|
||||||
{
|
{
|
||||||
auth: true,
|
auth: true,
|
||||||
body: t.Object({
|
body: t.Object({
|
||||||
jobIds: t.Array(t.String()),
|
jobIds: t.Array(t.String(), { maxItems: 100 }),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -300,6 +300,10 @@ export const history = new Elysia().use(userService).get(
|
||||||
body: JSON.stringify({ jobIds }),
|
body: JSON.stringify({ jobIds }),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(\`HTTP error! status: \${response.status}\`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
|
|
||||||
if (result.success || result.deleted > 0) {
|
if (result.success || result.deleted > 0) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue