UI & Feature update - Alpha #9

Merged
Mathis merged 22 commits from dev into prod 2026-01-14 22:40:06 +01:00
3 changed files with 12 additions and 12 deletions
Showing only changes of commit 14f8b8b63d - Show all commits

View File

@@ -19,11 +19,11 @@ import {
UseInterceptors,
} from "@nestjs/common";
import { FileInterceptor } from "@nestjs/platform-express";
import type { Request, Response } from "express";
import type { Response } from "express";
import { Roles } from "../auth/decorators/roles.decorator";
import { AuthGuard } from "../auth/guards/auth.guard";
import { OptionalAuthGuard } from "../auth/guards/optional-auth.guard";
import { RolesGuard } from "../auth/guards/roles.guard";
import { Roles } from "../auth/decorators/roles.decorator";
import type { AuthenticatedRequest } from "../common/interfaces/request.interface";
import { ContentsService } from "./contents.service";
import { CreateContentDto } from "./dto/create-content.dto";
@@ -144,10 +144,7 @@ export class ContentsController {
@Req() req: AuthenticatedRequest,
@Res() res: Response,
) {
const content = await this.contentsService.findOne(
idOrSlug,
req.user?.sub,
);
const content = await this.contentsService.findOne(idOrSlug, req.user?.sub);
if (!content) {
throw new NotFoundException("Contenu non trouvé");
}

View File

@@ -135,7 +135,8 @@ export class ContentsRepository {
fileSize: contents.fileSize,
views: contents.views,
usageCount: contents.usageCount,
favoritesCount: sql<number>`(SELECT count(*) FROM ${favorites} WHERE ${favorites.contentId} = ${contents.id})`.mapWith(
favoritesCount:
sql<number>`(SELECT count(*) FROM ${favorites} WHERE ${favorites.contentId} = ${contents.id})`.mapWith(
Number,
),
isLiked: userId
@@ -235,7 +236,8 @@ export class ContentsRepository {
fileSize: contents.fileSize,
views: contents.views,
usageCount: contents.usageCount,
favoritesCount: sql<number>`(SELECT count(*) FROM ${favorites} WHERE ${favorites.contentId} = ${contents.id})`.mapWith(
favoritesCount:
sql<number>`(SELECT count(*) FROM ${favorites} WHERE ${favorites.contentId} = ${contents.id})`.mapWith(
Number,
),
isLiked: userId

View File

@@ -16,6 +16,7 @@ import {
CardHeader,
} from "@/components/ui/card";
import { useAuth } from "@/providers/auth-provider";
import { ContentService } from "@/services/content.service";
import { FavoriteService } from "@/services/favorite.service";
import type { Content } from "@/types/content";