feat: a calendar to subscribe to, and the backlog's corners
- Each person can subscribe their dates in Google Calendar, Outlook or
Apple Calendar: GET /api/calendar/{token}.ics (no session) brings
their unfinished tickets with a due date (assigned or followed), the
planned and running sprints and the planned releases of their
projects, as all-day events linking to the web. The token is made,
renewed or dropped under /me/calendar (and in GraphQL); in the web,
from «Calendario» in «Mi trabajo».
- The backlog panel keeps the selected rows' background inside its
rounded corners.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
36
libs/api/tracker/application/src/lib/calendar.service.ts
Normal file
36
libs/api/tracker/application/src/lib/calendar.service.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { CommandBus, QueryBus } from '@nestjs/cqrs';
|
||||
import {
|
||||
CreateCalendarFeedCommand,
|
||||
GetCalendarIcsQuery,
|
||||
GetMyCalendarFeedQuery,
|
||||
RevokeCalendarFeedCommand,
|
||||
} from './calendar/calendar';
|
||||
import { CalendarFeed } from './ports/calendar-feeds.repository';
|
||||
|
||||
/** A person's calendar subscription (iCalendar), behind a secret URL. */
|
||||
@Injectable()
|
||||
export class CalendarService {
|
||||
constructor(
|
||||
private readonly commandBus: CommandBus,
|
||||
private readonly queryBus: QueryBus,
|
||||
) {}
|
||||
|
||||
mine(userId: string): Promise<CalendarFeed | null> {
|
||||
return this.queryBus.execute(new GetMyCalendarFeedQuery(userId));
|
||||
}
|
||||
|
||||
/** A new secret URL; the previous one, if any, stops working. */
|
||||
create(userId: string): Promise<CalendarFeed> {
|
||||
return this.commandBus.execute(new CreateCalendarFeedCommand(userId));
|
||||
}
|
||||
|
||||
revoke(userId: string): Promise<void> {
|
||||
return this.commandBus.execute(new RevokeCalendarFeedCommand(userId));
|
||||
}
|
||||
|
||||
/** The calendar behind `token`, or null if no feed has it. */
|
||||
ics(token: string, webUrl: string): Promise<string | null> {
|
||||
return this.queryBus.execute(new GetCalendarIcsQuery(token, webUrl));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user