Test compose
This commit is contained in:
@@ -8,6 +8,7 @@ services:
|
||||
container_name: clipperia-api
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
KEYCLOAK_URL: http://keycloak:8080
|
||||
DATABASE_URL: postgresql://leolitas:L@l321321321@postgres:5432/clipperia?schema=public
|
||||
networks:
|
||||
- dokploy-network
|
||||
|
||||
@@ -9,6 +9,7 @@ import { VideosController } from './videos/videos.controller';
|
||||
import { UsuariosModule } from './usuarios/usuarios.module';
|
||||
import { LoggerMiddleware } from './middleware/logger.middleware';
|
||||
import { RolesGuard } from './auth/roles.guard';
|
||||
import { AuthController } from './auth/auth.controller';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
@@ -24,5 +25,6 @@ import { RolesGuard } from './auth/roles.guard';
|
||||
export class AppModule {
|
||||
configure(consumer: MiddlewareConsumer) {
|
||||
consumer.apply(LoggerMiddleware).forRoutes(VideosController);
|
||||
consumer.apply(LoggerMiddleware).forRoutes(AuthController);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,9 +33,7 @@ export interface JwtPayload {
|
||||
@Injectable()
|
||||
export class KeycloakJwtStrategy extends PassportStrategy(Strategy, 'jwt') {
|
||||
constructor() {
|
||||
const baseUrl = process.env.KEYCLOAK_URL
|
||||
? process.env.KEYCLOAK_URL
|
||||
: 'https://auth.clipperia.com.br';
|
||||
const baseUrl = process.env.KEYCLOAK_URL ?? 'https://auth.clipperia.com.br';
|
||||
|
||||
super({
|
||||
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
Patch,
|
||||
Body,
|
||||
Query,
|
||||
UseGuards,
|
||||
// UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import { videos, Prisma, video_situation } from 'generated/prisma';
|
||||
|
||||
@@ -13,17 +13,17 @@ import { VideosService } from './videos.service';
|
||||
import { VideoResponseDto } from './dto/video-response.dto';
|
||||
import { PaginatedQueryDto, PaginatedResponse } from '../shared/dto/paginated';
|
||||
import { EBooleanPipe } from '../shared/pipe';
|
||||
import { KeycloakAuthGuard } from '../auth/keycloak-auth.guard';
|
||||
import { Roles } from 'src/auth/decorator/roles.decorator';
|
||||
import { RolesGuard } from 'src/auth/roles.guard';
|
||||
// import { KeycloakAuthGuard } from '../auth/keycloak-auth.guard';
|
||||
// import { Roles } from 'src/auth/decorator/roles.decorator';
|
||||
// import { RolesGuard } from 'src/auth/roles.guard';
|
||||
|
||||
@Controller('videos')
|
||||
@UseGuards(KeycloakAuthGuard, RolesGuard)
|
||||
// @UseGuards(KeycloakAuthGuard, RolesGuard)
|
||||
export class VideosController {
|
||||
constructor(private readonly videosService: VideosService) {}
|
||||
|
||||
@Get()
|
||||
@Roles('user', 'admin')
|
||||
// @Roles('user', 'admin')
|
||||
async list(
|
||||
@Query() query: PaginatedQueryDto,
|
||||
@Query('situation') situation?: video_situation,
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Module } from '@nestjs/common';
|
||||
import { VideosService } from './videos.service';
|
||||
import { VideosController } from './videos.controller';
|
||||
import { PrismaModule } from '../prisma/prisma.module';
|
||||
// import { RolesGuard } from 'src/auth/roles.guard';
|
||||
|
||||
@Module({
|
||||
imports: [PrismaModule],
|
||||
|
||||
Reference in New Issue
Block a user