My-Weekly-ToDo-List/src/app/api/user/someday-tabs/route.ts
mARTin ac17ca2635 feat: improve PDF export — header, layout, icons, tab filter
- Add page header per PDF page: KW + date range (headline font/accent
  color) + motivational quote (right-aligned italic, from local quotes)
- Move all-day strip above weekday/date header to match webapp layout
- Increase font sizes across the board (task titles 7.5pt, time labels
  7.5pt, day date 8pt) to better match the web view
- Remove time prefix from task rows (hour-row label already provides
  context); completed tasks get strikethrough styling
- Calendar event chips in all-day strip now use solid calendar color +
  white text + small dot indicator (replaces 📅 emoji, which Helvetica
  cannot render in PDFs)
- Fix multi-day all-day events: expand CachedCalendarEvents across every
  day they span (iCal endDate is exclusive); deduplicate by title to
  prevent double-rendering when the same event exists in both Task and
  CachedCalendarEvent tables
- Someday page is now landscape (matches main week pages)
- Print modal: fetch available someday tabs on open; show pill-checkbox
  filter below "Aufgaben ohne Uhrzeit" toggle when multiple tabs exist;
  selected tabs are passed to the export route as noTimeTabs param
- New API endpoint GET /api/user/someday-tabs for fetching tab list
- Export route filters someday lists by noTimeTabs when provided

v1.97.2

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 17:00:13 +02:00

27 lines
980 B
TypeScript

import { NextResponse } from 'next/server';
import { getServerSession } from 'next-auth';
import { authOptions } from '@/lib/auth';
import { prisma } from '@/lib/prisma';
// Returns the distinct set of tabs (and list titles within each tab) for the
// current user's someday lists — used by the print/export modal to show a
// tab-filter selector.
export async function GET() {
const session = await getServerSession(authOptions);
if (!session?.user?.email) return new NextResponse('Unauthorized', { status: 401 });
const user = await prisma.user.findUnique({
where: { email: session.user.email },
select: { id: true },
});
if (!user) return new NextResponse('Not found', { status: 404 });
const lists = await prisma.somedayList.findMany({
where: { userId: user.id },
select: { id: true, title: true, tab: true },
orderBy: [{ tab: 'asc' }, { order: 'asc' }],
});
return NextResponse.json({ lists });
}