fix: remove AuthGuard('jwt') from all service controllers
Kong handles JWT validation at the gateway level. Service-level
AuthGuard('jwt') fails because services don't register a Passport
JWT strategy (only auth-service does). Removed from 17 controllers
across ops, inventory, monitor, comm, audit, and agent services.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
c710303b60
commit
806113554b
|
|
@ -1,5 +1,4 @@
|
|||
import { Controller, Post, Body, Param, Delete, Get, UseGuards, NotFoundException, BadRequestException } from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { Controller, Post, Body, Param, Delete, Get, NotFoundException, BadRequestException } from '@nestjs/common';
|
||||
import { TenantId } from '@it0/common';
|
||||
import { EngineRegistry } from '../../../infrastructure/engines/engine-registry';
|
||||
import { AgentStreamGateway } from '../../ws/agent-stream.gateway';
|
||||
|
|
@ -22,7 +21,6 @@ export class AgentController {
|
|||
|
||||
// TODO 10: Execute task
|
||||
@Post('tasks')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async executeTask(
|
||||
@TenantId() tenantId: string,
|
||||
@Body() body: { prompt: string; systemPrompt?: string; maxTurns?: number; allowedTools?: string[] },
|
||||
|
|
@ -115,7 +113,6 @@ export class AgentController {
|
|||
|
||||
// TODO 11: Cancel task
|
||||
@Delete('tasks/:taskId')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async cancelTask(@Param('taskId') taskId: string) {
|
||||
const task = await this.taskRepository.findById(taskId);
|
||||
if (!task) {
|
||||
|
|
@ -143,7 +140,6 @@ export class AgentController {
|
|||
|
||||
// TODO 12: Approve command
|
||||
@Post('tasks/:taskId/approve')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async approveCommand(@Param('taskId') taskId: string, @Body() body: { approved: boolean }) {
|
||||
const task = await this.taskRepository.findById(taskId);
|
||||
if (!task) {
|
||||
|
|
@ -230,7 +226,6 @@ export class AgentController {
|
|||
|
||||
// TODO 13: List engines
|
||||
@Get('engines')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async listEngines() {
|
||||
const engines = this.engineRegistry.listAvailable();
|
||||
return { engines };
|
||||
|
|
@ -238,7 +233,6 @@ export class AgentController {
|
|||
|
||||
// TODO 14: Switch engine
|
||||
@Post('engines/switch')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async switchEngine(@Body() body: { engineType: string }) {
|
||||
const engine = this.engineRegistry.switchEngine(body.engineType as AgentEngineType);
|
||||
return { message: 'Engine switched', engineType: engine.engineType };
|
||||
|
|
|
|||
|
|
@ -6,10 +6,8 @@ import {
|
|||
Delete,
|
||||
Param,
|
||||
Body,
|
||||
UseGuards,
|
||||
NotFoundException,
|
||||
} from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import * as crypto from 'crypto';
|
||||
|
||||
interface RiskRule {
|
||||
|
|
@ -47,13 +45,11 @@ export class RiskRulesController {
|
|||
/* ---------- Risk Rules CRUD ---------- */
|
||||
|
||||
@Get('risk-rules')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
listRules() {
|
||||
return { data: this.rules, total: this.rules.length };
|
||||
}
|
||||
|
||||
@Post('risk-rules')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
createRule(@Body() body: any) {
|
||||
const now = new Date().toISOString();
|
||||
const rule: RiskRule = {
|
||||
|
|
@ -71,7 +67,6 @@ export class RiskRulesController {
|
|||
}
|
||||
|
||||
@Put('risk-rules/:id')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
updateRule(@Param('id') id: string, @Body() body: any) {
|
||||
const rule = this.rules.find((r) => r.id === id);
|
||||
if (!rule) {
|
||||
|
|
@ -87,7 +82,6 @@ export class RiskRulesController {
|
|||
}
|
||||
|
||||
@Delete('risk-rules/:id')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
deleteRule(@Param('id') id: string) {
|
||||
const idx = this.rules.findIndex((r) => r.id === id);
|
||||
if (idx === -1) {
|
||||
|
|
@ -100,13 +94,11 @@ export class RiskRulesController {
|
|||
/* ---------- Permissions ---------- */
|
||||
|
||||
@Get('permissions')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
getPermissions() {
|
||||
return this.permissionMatrix;
|
||||
}
|
||||
|
||||
@Put('permissions')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
updatePermissions(@Body() body: PermissionMatrix) {
|
||||
this.permissionMatrix = { ...this.permissionMatrix, ...body };
|
||||
return this.permissionMatrix;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { Controller, Get, Param, UseGuards, NotFoundException } from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { Controller, Get, Param, NotFoundException } from '@nestjs/common';
|
||||
import { TenantId } from '@it0/common';
|
||||
import { SessionRepository } from '../../../infrastructure/repositories/session.repository';
|
||||
import { TaskRepository } from '../../../infrastructure/repositories/task.repository';
|
||||
|
|
@ -13,14 +12,12 @@ export class SessionController {
|
|||
|
||||
// TODO 15: List sessions
|
||||
@Get()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async listSessions(@TenantId() tenantId: string) {
|
||||
return this.sessionRepository.findByTenant(tenantId);
|
||||
}
|
||||
|
||||
// TODO 16: Get session details
|
||||
@Get(':sessionId')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async getSession(@Param('sessionId') sessionId: string) {
|
||||
const session = await this.sessionRepository.findById(sessionId);
|
||||
if (!session) {
|
||||
|
|
@ -31,7 +28,6 @@ export class SessionController {
|
|||
|
||||
// TODO 17: Get session history
|
||||
@Get(':sessionId/history')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async getSessionHistory(@Param('sessionId') sessionId: string) {
|
||||
return this.taskRepository.findBySessionId(sessionId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { Controller, Get, Query, UseGuards } from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { Roles, RolesGuard } from '@it0/common';
|
||||
import { AuditLogRepository } from '../../../infrastructure/repositories/audit-log.repository';
|
||||
|
||||
|
|
@ -8,7 +7,7 @@ export class AuditController {
|
|||
constructor(private readonly auditLogRepository: AuditLogRepository) {}
|
||||
|
||||
@Get('logs')
|
||||
@UseGuards(AuthGuard('jwt'), RolesGuard)
|
||||
@UseGuards(RolesGuard)
|
||||
@Roles('admin')
|
||||
async queryLogs(
|
||||
@Query('actionType') actionType?: string,
|
||||
|
|
@ -36,7 +35,7 @@ export class AuditController {
|
|||
}
|
||||
|
||||
@Get('logs/export')
|
||||
@UseGuards(AuthGuard('jwt'), RolesGuard)
|
||||
@UseGuards(RolesGuard)
|
||||
@Roles('admin')
|
||||
async exportLogs(@Query('format') format: 'json' | 'csv' = 'json') {
|
||||
return this.auditLogRepository.exportLogs(format);
|
||||
|
|
|
|||
|
|
@ -4,14 +4,11 @@ import {
|
|||
Patch,
|
||||
Param,
|
||||
Body,
|
||||
UseGuards,
|
||||
NotFoundException,
|
||||
} from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { AdapterRegistry } from '../../../infrastructure/adapters/adapter-registry';
|
||||
|
||||
@Controller('api/v1/comm/channels')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
export class ChannelController {
|
||||
constructor(private readonly adapterRegistry: AdapterRegistry) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { Controller, Get, Post, Put, Delete, Body, Param, UseGuards, NotFoundException } from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { Controller, Get, Post, Put, Delete, Body, Param, NotFoundException } from '@nestjs/common';
|
||||
import { ContactRepository } from '../../../infrastructure/repositories/contact.repository';
|
||||
import { Contact } from '../../../domain/entities/contact.entity';
|
||||
import * as crypto from 'crypto';
|
||||
|
|
@ -9,13 +8,11 @@ export class ContactController {
|
|||
constructor(private readonly contactRepository: ContactRepository) {}
|
||||
|
||||
@Get()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async listContacts() {
|
||||
return this.contactRepository.findAll();
|
||||
}
|
||||
|
||||
@Post()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async createContact(@Body() body: any) {
|
||||
const contact = new Contact();
|
||||
contact.id = crypto.randomUUID();
|
||||
|
|
@ -32,7 +29,6 @@ export class ContactController {
|
|||
}
|
||||
|
||||
@Put(':id')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async updateContact(@Param('id') id: string, @Body() body: any) {
|
||||
const contact = await this.contactRepository.findById(id);
|
||||
if (!contact) {
|
||||
|
|
@ -43,7 +39,6 @@ export class ContactController {
|
|||
}
|
||||
|
||||
@Delete(':id')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async deleteContact(@Param('id') id: string) {
|
||||
const contact = await this.contactRepository.findById(id);
|
||||
if (!contact) {
|
||||
|
|
|
|||
|
|
@ -6,10 +6,8 @@ import {
|
|||
Delete,
|
||||
Param,
|
||||
Body,
|
||||
UseGuards,
|
||||
NotFoundException,
|
||||
} from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { EscalationPolicyRepository } from '../../../infrastructure/repositories/escalation-policy.repository';
|
||||
import { EscalationPolicy } from '../../../domain/entities/escalation-policy.entity';
|
||||
import * as crypto from 'crypto';
|
||||
|
|
@ -21,14 +19,12 @@ export class EscalationPolicyController {
|
|||
) {}
|
||||
|
||||
@Get()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async listPolicies() {
|
||||
const policies = await this.policyRepository.findAll();
|
||||
return policies.map((p) => this.serialize(p));
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async getPolicy(@Param('id') id: string) {
|
||||
const policy = await this.policyRepository.findById(id);
|
||||
if (!policy) {
|
||||
|
|
@ -38,7 +34,6 @@ export class EscalationPolicyController {
|
|||
}
|
||||
|
||||
@Post()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async createPolicy(@Body() body: any) {
|
||||
const policy = new EscalationPolicy();
|
||||
policy.id = crypto.randomUUID();
|
||||
|
|
@ -52,7 +47,6 @@ export class EscalationPolicyController {
|
|||
}
|
||||
|
||||
@Put(':id')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async updatePolicy(@Param('id') id: string, @Body() body: any) {
|
||||
const policy = await this.policyRepository.findById(id);
|
||||
if (!policy) {
|
||||
|
|
@ -67,7 +61,6 @@ export class EscalationPolicyController {
|
|||
}
|
||||
|
||||
@Delete(':id')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async deletePolicy(@Param('id') id: string) {
|
||||
const policy = await this.policyRepository.findById(id);
|
||||
if (!policy) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { Controller, Get, Post, Body, Query, UseGuards } from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { Controller, Get, Post, Body, Query } from '@nestjs/common';
|
||||
import { MessageRepository } from '../../../infrastructure/repositories/message.repository';
|
||||
import { Message } from '../../../domain/entities/message.entity';
|
||||
import * as crypto from 'crypto';
|
||||
|
|
@ -9,7 +8,6 @@ export class MessageController {
|
|||
constructor(private readonly messageRepository: MessageRepository) {}
|
||||
|
||||
@Get()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async listMessages(@Query('direction') direction?: string) {
|
||||
if (direction) {
|
||||
return this.messageRepository.findByDirection(direction);
|
||||
|
|
@ -18,7 +16,6 @@ export class MessageController {
|
|||
}
|
||||
|
||||
@Post()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async sendMessage(@Body() body: any) {
|
||||
const message = new Message();
|
||||
message.id = crypto.randomUUID();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { Controller, Get, Post, Body, Param, UseGuards, NotFoundException } from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { Controller, Get, Post, Body, Param, NotFoundException } from '@nestjs/common';
|
||||
import { ClusterRepository } from '../../../infrastructure/repositories/cluster.repository';
|
||||
import { Cluster } from '../../../domain/entities/cluster.entity';
|
||||
import * as crypto from 'crypto';
|
||||
|
|
@ -9,13 +8,11 @@ export class ClusterController {
|
|||
constructor(private readonly clusterRepository: ClusterRepository) {}
|
||||
|
||||
@Get()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async listClusters() {
|
||||
return this.clusterRepository.findAll();
|
||||
}
|
||||
|
||||
@Post()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async createCluster(@Body() body: any) {
|
||||
const cluster = new Cluster();
|
||||
cluster.id = crypto.randomUUID();
|
||||
|
|
@ -29,7 +26,6 @@ export class ClusterController {
|
|||
}
|
||||
|
||||
@Get(':id')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async getCluster(@Param('id') id: string) {
|
||||
const cluster = await this.clusterRepository.findById(id);
|
||||
if (!cluster) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { Controller, Get, Post, Delete, Body, Param, UseGuards, NotFoundException } from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { Roles, RolesGuard } from '@it0/common';
|
||||
import { CredentialRepository } from '../../../infrastructure/repositories/credential.repository';
|
||||
import { CredentialVaultService } from '../../../infrastructure/crypto/credential-vault.service';
|
||||
|
|
@ -14,14 +13,12 @@ export class CredentialController {
|
|||
) {}
|
||||
|
||||
@Get()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async listCredentials() {
|
||||
const credentials = await this.credentialRepository.findAll();
|
||||
return credentials.map(c => this.toSafeOutput(c));
|
||||
}
|
||||
|
||||
@Post()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async createCredential(
|
||||
@Body() body: { name: string; type: string; plainValue: string; keyType?: string; expiresAt?: string },
|
||||
) {
|
||||
|
|
@ -42,7 +39,6 @@ export class CredentialController {
|
|||
}
|
||||
|
||||
@Get(':id')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async getCredential(@Param('id') id: string) {
|
||||
const credential = await this.credentialRepository.findById(id);
|
||||
if (!credential) {
|
||||
|
|
@ -52,7 +48,6 @@ export class CredentialController {
|
|||
}
|
||||
|
||||
@Delete(':id')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async deleteCredential(@Param('id') id: string) {
|
||||
const credential = await this.credentialRepository.findById(id);
|
||||
if (!credential) {
|
||||
|
|
@ -63,7 +58,7 @@ export class CredentialController {
|
|||
}
|
||||
|
||||
@Post(':id/decrypt')
|
||||
@UseGuards(AuthGuard('jwt'), RolesGuard)
|
||||
@UseGuards(RolesGuard)
|
||||
@Roles('admin')
|
||||
async decryptCredential(@Param('id') id: string) {
|
||||
const credential = await this.credentialRepository.findById(id);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { Controller, Get, Post, Put, Delete, Body, Param, Query, UseGuards, NotFoundException } from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { Controller, Get, Post, Put, Delete, Body, Param, Query, NotFoundException } from '@nestjs/common';
|
||||
import { ServerRepository } from '../../../infrastructure/repositories/server.repository';
|
||||
import { Server } from '../../../domain/entities/server.entity';
|
||||
import * as crypto from 'crypto';
|
||||
|
|
@ -17,7 +16,6 @@ export class ServerController {
|
|||
}
|
||||
|
||||
@Get()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async listServers(@Query('environment') env?: string) {
|
||||
const servers = env
|
||||
? await this.serverRepository.findByEnvironment(env)
|
||||
|
|
@ -26,7 +24,6 @@ export class ServerController {
|
|||
}
|
||||
|
||||
@Post()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async createServer(@Body() body: any) {
|
||||
const server = new Server();
|
||||
server.id = crypto.randomUUID();
|
||||
|
|
@ -51,7 +48,6 @@ export class ServerController {
|
|||
}
|
||||
|
||||
@Get(':id')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async getServer(@Param('id') id: string) {
|
||||
const server = await this.serverRepository.findById(id);
|
||||
if (!server) {
|
||||
|
|
@ -61,7 +57,6 @@ export class ServerController {
|
|||
}
|
||||
|
||||
@Put(':id')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async updateServer(@Param('id') id: string, @Body() body: any) {
|
||||
const server = await this.serverRepository.findById(id);
|
||||
if (!server) {
|
||||
|
|
@ -76,7 +71,6 @@ export class ServerController {
|
|||
}
|
||||
|
||||
@Delete(':id')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async deleteServer(@Param('id') id: string) {
|
||||
const server = await this.serverRepository.findById(id);
|
||||
if (!server) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { Controller, Get, Post, Put, Body, Param, Query, UseGuards, NotFoundException } from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { Controller, Get, Post, Put, Body, Param, Query, NotFoundException } from '@nestjs/common';
|
||||
import { AlertRuleRepository } from '../../../infrastructure/repositories/alert-rule.repository';
|
||||
import { AlertEventRepository } from '../../../infrastructure/repositories/alert-event.repository';
|
||||
import { AlertRule } from '../../../domain/entities/alert-rule.entity';
|
||||
|
|
@ -13,13 +12,11 @@ export class AlertController {
|
|||
) {}
|
||||
|
||||
@Get('rules')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async listRules() {
|
||||
return this.alertRuleRepository.findAll();
|
||||
}
|
||||
|
||||
@Post('rules')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async createRule(@Body() body: any) {
|
||||
const rule = new AlertRule();
|
||||
rule.id = crypto.randomUUID();
|
||||
|
|
@ -36,7 +33,6 @@ export class AlertController {
|
|||
}
|
||||
|
||||
@Get('events')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async listEvents(@Query('status') status?: string) {
|
||||
if (status) {
|
||||
return this.alertEventRepository.findByStatus(status);
|
||||
|
|
@ -45,7 +41,6 @@ export class AlertController {
|
|||
}
|
||||
|
||||
@Put('events/:id/acknowledge')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async acknowledgeEvent(@Param('id') id: string) {
|
||||
const event = await this.alertEventRepository.findById(id);
|
||||
if (!event) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { Controller, Get, Post, Body, Query, UseGuards } from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { Controller, Get, Post, Body, Query } from '@nestjs/common';
|
||||
import { HealthCheckResultRepository } from '../../../infrastructure/repositories/health-check-result.repository';
|
||||
import { HealthCheckResult } from '../../../domain/entities/health-check-result.entity';
|
||||
import * as crypto from 'crypto';
|
||||
|
|
@ -9,7 +8,6 @@ export class HealthCheckController {
|
|||
constructor(private readonly healthCheckResultRepo: HealthCheckResultRepository) {}
|
||||
|
||||
@Get()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async listHealthChecks(@Query('serverId') serverId?: string) {
|
||||
if (serverId) {
|
||||
return this.healthCheckResultRepo.findByServerId(serverId);
|
||||
|
|
@ -18,7 +16,6 @@ export class HealthCheckController {
|
|||
}
|
||||
|
||||
@Post('run')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async runHealthCheck(@Body() body: { serverIds?: string[]; checkType?: string }) {
|
||||
const results: HealthCheckResult[] = [];
|
||||
const serverIds = body.serverIds || [];
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { Controller, Get, Post, Body, Param, Query, UseGuards, NotFoundException } from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { Controller, Get, Post, Body, Param, Query, NotFoundException } from '@nestjs/common';
|
||||
import { ApprovalRepository } from '../../../infrastructure/repositories/approval.repository';
|
||||
import { ApproveTaskUseCase } from '../../../application/use-cases/approve-task.use-case';
|
||||
|
||||
|
|
@ -11,13 +10,11 @@ export class ApprovalController {
|
|||
) {}
|
||||
|
||||
@Get()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async listApprovals(@Query('status') status?: string) {
|
||||
return this.approveTaskUseCase.getApprovalRequests(status);
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async getApproval(@Param('id') id: string) {
|
||||
const approval = await this.approvalRepository.findById(id);
|
||||
if (!approval) {
|
||||
|
|
@ -27,7 +24,6 @@ export class ApprovalController {
|
|||
}
|
||||
|
||||
@Post(':id/approve')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async approve(
|
||||
@Param('id') id: string,
|
||||
@Body() body: { approvedBy: string },
|
||||
|
|
@ -37,7 +33,6 @@ export class ApprovalController {
|
|||
}
|
||||
|
||||
@Post(':id/reject')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async reject(
|
||||
@Param('id') id: string,
|
||||
@Body() body: { rejectedBy: string; reason?: string },
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { Controller, Get, Post, Put, Delete, Body, Param, UseGuards, NotFoundException } from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { Controller, Get, Post, Put, Delete, Body, Param, NotFoundException } from '@nestjs/common';
|
||||
import { RunbookRepository } from '../../../infrastructure/repositories/runbook.repository';
|
||||
import { Runbook } from '../../../domain/entities/runbook.entity';
|
||||
import * as crypto from 'crypto';
|
||||
|
|
@ -9,13 +8,11 @@ export class RunbookController {
|
|||
constructor(private readonly runbookRepository: RunbookRepository) {}
|
||||
|
||||
@Get()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async listRunbooks() {
|
||||
return this.runbookRepository.findAll();
|
||||
}
|
||||
|
||||
@Post()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async createRunbook(@Body() body: any) {
|
||||
const runbook = new Runbook();
|
||||
runbook.id = crypto.randomUUID();
|
||||
|
|
@ -33,7 +30,6 @@ export class RunbookController {
|
|||
}
|
||||
|
||||
@Put(':id')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async updateRunbook(@Param('id') id: string, @Body() body: any) {
|
||||
const runbook = await this.runbookRepository.findById(id);
|
||||
if (!runbook) {
|
||||
|
|
@ -44,7 +40,6 @@ export class RunbookController {
|
|||
}
|
||||
|
||||
@Delete(':id')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async deleteRunbook(@Param('id') id: string) {
|
||||
const runbook = await this.runbookRepository.findById(id);
|
||||
if (!runbook) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { Controller, Get, Post, Put, Patch, Param, Body, UseGuards, NotFoundException } from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { Controller, Get, Post, Put, Patch, Param, Body, NotFoundException } from '@nestjs/common';
|
||||
import { StandingOrderRepository } from '../../../infrastructure/repositories/standing-order.repository';
|
||||
import { StandingOrderExecutionRepository } from '../../../infrastructure/repositories/standing-order-execution.repository';
|
||||
import { StandingOrder } from '../../../domain/entities/standing-order.entity';
|
||||
|
|
@ -13,7 +12,6 @@ export class StandingOrderController {
|
|||
) {}
|
||||
|
||||
@Get()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async listOrders() {
|
||||
const orders = await this.standingOrderRepository.findAll();
|
||||
return orders.map((o) => this.serializeOrder(o));
|
||||
|
|
@ -93,7 +91,6 @@ export class StandingOrderController {
|
|||
}
|
||||
|
||||
@Post()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async createOrder(@Body() body: any) {
|
||||
const order = new StandingOrder();
|
||||
order.id = crypto.randomUUID();
|
||||
|
|
@ -110,7 +107,6 @@ export class StandingOrderController {
|
|||
}
|
||||
|
||||
@Get(':id')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async getOrder(@Param('id') id: string) {
|
||||
const order = await this.standingOrderRepository.findById(id);
|
||||
if (!order) {
|
||||
|
|
@ -120,7 +116,6 @@ export class StandingOrderController {
|
|||
}
|
||||
|
||||
@Put(':id')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async updateOrder(@Param('id') id: string, @Body() body: any) {
|
||||
const order = await this.standingOrderRepository.findById(id);
|
||||
if (!order) {
|
||||
|
|
@ -133,7 +128,6 @@ export class StandingOrderController {
|
|||
}
|
||||
|
||||
@Patch(':id/status')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async updateStatus(@Param('id') id: string, @Body() body: { status: string }) {
|
||||
const order = await this.standingOrderRepository.findById(id);
|
||||
if (!order) {
|
||||
|
|
@ -145,7 +139,6 @@ export class StandingOrderController {
|
|||
}
|
||||
|
||||
@Get(':id/executions')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async getExecutions(@Param('id') id: string) {
|
||||
const order = await this.standingOrderRepository.findById(id);
|
||||
if (!order) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { Controller, Get, Post, Body, Param, UseGuards, NotFoundException } from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { Controller, Get, Post, Body, Param, NotFoundException } from '@nestjs/common';
|
||||
import { TaskRepository } from '../../../infrastructure/repositories/task.repository';
|
||||
import { OpsTask } from '../../../domain/entities/ops-task.entity';
|
||||
import * as crypto from 'crypto';
|
||||
|
|
@ -9,13 +8,11 @@ export class TaskController {
|
|||
constructor(private readonly taskRepository: TaskRepository) {}
|
||||
|
||||
@Get()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async listTasks() {
|
||||
return this.taskRepository.findAll();
|
||||
}
|
||||
|
||||
@Post()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async createTask(@Body() body: any) {
|
||||
const task = new OpsTask();
|
||||
task.id = crypto.randomUUID();
|
||||
|
|
@ -34,7 +31,6 @@ export class TaskController {
|
|||
}
|
||||
|
||||
@Get(':id')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async getTask(@Param('id') id: string) {
|
||||
const task = await this.taskRepository.findById(id);
|
||||
if (!task) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue