mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-09 20:12:10 +10:00
* feat: set lang in html head * fix: add # in front of git ref * fix: remove unused vars from example env * fix: package name and license field * fix: enable sourcemap for client and server * fix: emojis not showing in prod this is extremely cursed, but it works * chore: refactor auth manager * feat: disable invitations if simple auth disabled * feat: add drop version to footer * feat: translate auth endpoints * chore: move oidc module * feat: add weekly tasks enabled object cleanup as weekly task * feat: add timestamp to task log msgs * feat: add guard to prevent invalid progress % * fix: add missing global scope to i18n components * feat: set base url for i18n * feat: switch task log to json format * ci: run ci on develop branch only * fix: UserWidget text not updating #109 * fix: EXTERNAL_URL being computed at build * feat: add basic language outlines for translation * feat: add more english dialects
37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
import aclManager from "~/server/internal/acls";
|
|
import prisma from "~/server/internal/db/database";
|
|
import taskHandler from "~/server/internal/tasks";
|
|
|
|
export default defineEventHandler(async (h3) => {
|
|
const allowed = await aclManager.allowSystemACL(h3, ["task:read"]);
|
|
if (!allowed) throw createError({ statusCode: 403 });
|
|
const allAcls = await aclManager.fetchAllACLs(h3);
|
|
if (!allAcls)
|
|
throw createError({
|
|
statusCode: 403,
|
|
statusMessage: "Somehow no ACLs on authenticated request.",
|
|
});
|
|
|
|
const runningTasks = (await taskHandler.runningTasks()).map((e) => e.id);
|
|
const historicalTasks = await prisma.task.findMany({
|
|
where: {
|
|
OR: [
|
|
{
|
|
acls: { hasSome: allAcls },
|
|
},
|
|
{
|
|
acls: { isEmpty: true },
|
|
},
|
|
],
|
|
},
|
|
orderBy: {
|
|
ended: "desc",
|
|
},
|
|
take: 10,
|
|
});
|
|
const dailyTasks = await taskHandler.dailyTasks();
|
|
const weeklyTasks = await taskHandler.weeklyTasks();
|
|
|
|
return { runningTasks, historicalTasks, dailyTasks, weeklyTasks };
|
|
});
|