fix(api,orchestrator): fix remaining dependency injection issues
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
API: - Add AuthModule import to JobEventsModule - Add AuthModule import to JobStepsModule - Fixes: AuthGuard dependency resolution in job modules Orchestrator: - Add @Optional() decorator to docker parameter in DockerSandboxService - Fixes: NestJS trying to inject Docker class as dependency All modules using AuthGuard must import AuthModule. Docker parameter is optional for testing, needs @Optional() decorator.
This commit is contained in:
@@ -2,6 +2,7 @@ import { Module } from "@nestjs/common";
|
|||||||
import { JobEventsController } from "./job-events.controller";
|
import { JobEventsController } from "./job-events.controller";
|
||||||
import { JobEventsService } from "./job-events.service";
|
import { JobEventsService } from "./job-events.service";
|
||||||
import { PrismaModule } from "../prisma/prisma.module";
|
import { PrismaModule } from "../prisma/prisma.module";
|
||||||
|
import { AuthModule } from "../auth/auth.module";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Job Events Module
|
* Job Events Module
|
||||||
@@ -10,7 +11,7 @@ import { PrismaModule } from "../prisma/prisma.module";
|
|||||||
* Events are stored in PostgreSQL and provide a complete audit trail.
|
* Events are stored in PostgreSQL and provide a complete audit trail.
|
||||||
*/
|
*/
|
||||||
@Module({
|
@Module({
|
||||||
imports: [PrismaModule],
|
imports: [PrismaModule, AuthModule],
|
||||||
controllers: [JobEventsController],
|
controllers: [JobEventsController],
|
||||||
providers: [JobEventsService],
|
providers: [JobEventsService],
|
||||||
exports: [JobEventsService],
|
exports: [JobEventsService],
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { Module } from "@nestjs/common";
|
|||||||
import { JobStepsController } from "./job-steps.controller";
|
import { JobStepsController } from "./job-steps.controller";
|
||||||
import { JobStepsService } from "./job-steps.service";
|
import { JobStepsService } from "./job-steps.service";
|
||||||
import { PrismaModule } from "../prisma/prisma.module";
|
import { PrismaModule } from "../prisma/prisma.module";
|
||||||
|
import { AuthModule } from "../auth/auth.module";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Job Steps Module
|
* Job Steps Module
|
||||||
@@ -10,7 +11,7 @@ import { PrismaModule } from "../prisma/prisma.module";
|
|||||||
* Tracks step status transitions, token usage, and duration.
|
* Tracks step status transitions, token usage, and duration.
|
||||||
*/
|
*/
|
||||||
@Module({
|
@Module({
|
||||||
imports: [PrismaModule],
|
imports: [PrismaModule, AuthModule],
|
||||||
controllers: [JobStepsController],
|
controllers: [JobStepsController],
|
||||||
providers: [JobStepsService],
|
providers: [JobStepsService],
|
||||||
exports: [JobStepsService],
|
exports: [JobStepsService],
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Injectable, Logger } from "@nestjs/common";
|
import { Injectable, Logger, Optional } from "@nestjs/common";
|
||||||
import { ConfigService } from "@nestjs/config";
|
import { ConfigService } from "@nestjs/config";
|
||||||
import { randomBytes } from "crypto";
|
import { randomBytes } from "crypto";
|
||||||
import Docker from "dockerode";
|
import Docker from "dockerode";
|
||||||
@@ -86,7 +86,7 @@ export class DockerSandboxService {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly configService: ConfigService,
|
private readonly configService: ConfigService,
|
||||||
docker?: Docker
|
@Optional() docker?: Docker
|
||||||
) {
|
) {
|
||||||
const socketPath = this.configService.get<string>(
|
const socketPath = this.configService.get<string>(
|
||||||
"orchestrator.docker.socketPath",
|
"orchestrator.docker.socketPath",
|
||||||
|
|||||||
Reference in New Issue
Block a user