Files
ReadaBook/apps/api/src/progress/progress.controller.ts
Git Agent 85b56ef3b2 fix(web,api): UI fiche livre et lecteur — progression, locators EPUB/PDF, styles
- web: BookPage/ReaderPage enrichis, sauvegarde de progression lecteur
- web: locators EPUB/PDF normalisés (+ tests), EpubReader/PdfReader ajustés
- web: nginx et service worker ajustés
- api: progress — corrections contrôleur/service

Refs: #13
2026-08-23 10:32:44 +02:00

32 lines
1.1 KiB
TypeScript

import { Body, Controller, Get, Param, Put, UseGuards } from "@nestjs/common";
import { UpdateProgressDto, UpdateProgressSchema } from "@readabook/shared";
import { AuthGuard } from "../auth/auth.guard.js";
import { CurrentUser, CurrentUserParam } from "../auth/current-user.js";
import { ZodValidationPipe } from "../common/zod-validation.pipe.js";
import { ProgressService } from "./progress.service.js";
@Controller("progress")
@UseGuards(AuthGuard)
export class ProgressController {
constructor(private readonly progress: ProgressService) {}
@Get("continue")
continue(@CurrentUserParam() user: CurrentUser) {
return this.progress.continueReading(user.id);
}
@Get(":bookId")
get(@CurrentUserParam() user: CurrentUser, @Param("bookId") bookId: string) {
return this.progress.find(user.id, Number(bookId));
}
@Put(":bookId")
update(
@CurrentUserParam() user: CurrentUser,
@Param("bookId") bookId: string,
@Body(new ZodValidationPipe(UpdateProgressSchema)) body: UpdateProgressDto
) {
return this.progress.upsert(user.id, Number(bookId), body);
}
}