refactor: removed unnecessary functions from attachment

This commit is contained in:
2026-07-08 11:15:20 +03:30
parent 8348692481
commit 95c947a587
3 changed files with 4 additions and 49 deletions
@@ -1,5 +1,5 @@
import { Controller, Get, Post, Patch, Delete, Param, Body, Query } from '@nestjs/common';
import { ApiTags, ApiOperation, ApiResponse, ApiParam, ApiQuery } from '@nestjs/swagger';
import { Controller, Post, Patch, Delete, Param, Body } from '@nestjs/common';
import { ApiTags, ApiOperation, ApiResponse, ApiParam } from '@nestjs/swagger';
import { AttachmentService } from '../providers/attachment.service';
import { CreateAttachmentDto } from '../dto/attachment/create-attachment.dto';
import { UpdateAttachmentDto } from '../dto/attachment/update-attachment.dto';
@@ -14,24 +14,6 @@ import { AdminRoute } from '../../../common/decorators/admin.decorator';
export class AttachmentController {
constructor(private readonly attachmentService: AttachmentService) {}
@Get()
@ApiOperation({ summary: 'Get all attachments, optionally filtered by task' })
@ApiQuery({ name: 'taskId', required: false, description: 'Filter attachments by task ID' })
@ApiResponse({ status: 200, description: 'List of attachments', type: [TMAttachment] })
findAll(@Query('taskId') taskId?: string): Promise<TMAttachment[]> {
if (taskId) return this.attachmentService.findByTask(taskId);
return this.attachmentService.findAll();
}
@Get(':id')
@ApiOperation({ summary: 'Get an attachment by ID' })
@ApiParam({ name: 'id', description: 'Attachment ID' })
@ApiResponse({ status: 200, description: 'Attachment found', type: TMAttachment })
@ApiResponse({ status: 404, description: 'Attachment not found' })
findOne(@Param('id') id: string): Promise<TMAttachment> {
return this.attachmentService.findOneOrFail(id);
}
@Post()
@ApiOperation({ summary: 'Create a new attachment' })
@ApiResponse({ status: 201, description: 'Attachment created', type: TMAttachment })