feat: update ProjectE application
This commit is contained in:
@@ -15,13 +15,19 @@ export const GET = withAuth(async (request: NextRequest, _user) => {
|
||||
});
|
||||
|
||||
const byDomain: Record<string, number> = {};
|
||||
const byDate: Record<string, number> = {};
|
||||
const byProject: Record<string, number> = {};
|
||||
const byTag: Record<string, number> = {};
|
||||
let totalMinutes = 0;
|
||||
|
||||
for (const entry of entries) {
|
||||
const duration = (entry.duration_minutes as number) || 0;
|
||||
const duration = (entry.duration_minutes as number) || (entry.duration as number) || 0;
|
||||
totalMinutes += duration;
|
||||
const startedAt = entry.started_at as string | undefined;
|
||||
if (startedAt) {
|
||||
const date = new Date(startedAt).toISOString().slice(0, 10);
|
||||
byDate[date] = (byDate[date] || 0) + duration;
|
||||
}
|
||||
|
||||
// Get task for domain/project/tags
|
||||
const task = await pb.collection('tasks').getOne(entry.task_id as string);
|
||||
@@ -43,6 +49,7 @@ export const GET = withAuth(async (request: NextRequest, _user) => {
|
||||
return NextResponse.json({
|
||||
totalMinutes,
|
||||
byDomain,
|
||||
byDate,
|
||||
byProject,
|
||||
byTag,
|
||||
startDate,
|
||||
|
||||
Reference in New Issue
Block a user