Spaces:
Paused
Paused
File size: 1,298 Bytes
1fe7075 c7a38a3 1fe7075 c7a38a3 1fe7075 c7a38a3 1fe7075 c7a38a3 1fe7075 c7a38a3 1fe7075 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | import { Controller, Get, Param, Query, UseGuards } from '@nestjs/common';
import type { Paginated } from '../common/dto/paginated.dto.js';
import { CurrentAuth } from '../users/decorators/current-auth.decorator.js';
import { ClerkAuthGuard } from '../users/guards/clerk-auth.guard.js';
import type { AuthContext } from '../users/interfaces/authenticated-request.interface.js';
import { ListTilesQueryDto } from './dto/list-tiles-query.dto.js';
import type { TileFacetsDto } from './dto/tile-facets.dto.js';
import { TileSlugParamsDto } from './dto/tile-slug-params.dto.js';
import type { TileDto } from './dto/tile.dto.js';
import { TilesService } from './tiles.service.js';
@Controller('tiles')
@UseGuards(ClerkAuthGuard)
export class TilesController {
constructor(private readonly tiles: TilesService) {}
@Get()
list(@Query() query: ListTilesQueryDto, @CurrentAuth() { user }: AuthContext): Promise<Paginated<TileDto>> {
return this.tiles.list(query, user.role);
}
@Get('facets')
facets(@CurrentAuth() { user }: AuthContext): Promise<TileFacetsDto> {
return this.tiles.facets(user.role);
}
@Get(':slug')
findOne(@Param() { slug }: TileSlugParamsDto, @CurrentAuth() { user }: AuthContext): Promise<TileDto> {
return this.tiles.findBySlug(slug, user.role);
}
}
|