dorfteich/apps/api/src/versions/versions.module.ts
Claude Fable 5 67fb01fe2b
All checks were successful
CI / Lint, typecheck, test (push) Successful in 3m26s
CI / Build container images (push) Has been skipped
CD / Build and push images (push) Successful in 3m49s
CD / Deploy to Test (push) Successful in 9s
CD / Smoke tests against Test (push) Successful in 1m12s
CD / Promote to Int (push) Successful in 10s
CI / Auth e2e pack (push) Successful in 5m27s
CI / Import/export fidelity gate (push) Successful in 46s
Notify watchers about page changes and comments, with an in-app center (#94)
New notifications table (payload denormalized for join-free rendering;
mailed_at already prepares the #95 digests). Generation fans page events
out to page and pond watchers, excluding the actors, and re-checks page
read permission per watcher at delivery time — a revoked watcher gets
nothing. Sources: named version snapshots (api), new comments (api), and
the collab server's automatic session-close snapshots — announced over a
new pg NOTIFY channel (the reverse of the established api→collab bus)
consumed by a dedicated LISTEN client in the api, since the collab server
has no permission resolution of its own. API: paginated list (unread
first via nulls-first ordering), mark read, mark all read. UI: bell with
unread badge in the top bar (30 s polling, no push in v1) and a dropdown
whose entries navigate and mark themselves read; comment notifications
deep-link with ?comments=1, which now opens the comments panel on load.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EwZ4jR4KFAPvpjWevfUGX1
2026-07-11 23:20:25 +02:00

34 lines
1.1 KiB
TypeScript

import { Module, OnModuleInit } from '@nestjs/common';
import { NotificationsModule } from '../notifications/notifications.module';
import { PondsModule } from '../ponds/ponds.module';
import { SchedulerModule } from '../scheduler/scheduler.module';
import { SchedulerService } from '../scheduler/scheduler.service';
import { VersionsController } from './versions.controller';
import { VersionsService } from './versions.service';
/** Daily, per operations.md's maintenance-jobs table (ADR 0013 thinning). */
const VERSION_THINNING_CADENCE_SECONDS = 24 * 60 * 60;
@Module({
imports: [PondsModule, SchedulerModule, NotificationsModule],
controllers: [VersionsController],
providers: [VersionsService],
exports: [VersionsService],
})
export class VersionsModule implements OnModuleInit {
constructor(
private readonly scheduler: SchedulerService,
private readonly versions: VersionsService,
) {}
onModuleInit(): void {
this.scheduler.register({
name: 'version-thinning',
cadenceSeconds: VERSION_THINNING_CADENCE_SECONDS,
run: () => this.versions.thinDueVersions().then(() => undefined),
});
}
}