import { Controller, Delete, Param, Req, Res } from "@nestjs/common";
import { AttachmentService } from "./attachment.service";
import { Response } from "express";
import { UserDecorator } from "src/common/decorator";

@Controller("attachment")
export class AttachmentController {
  constructor(private readonly attachmentService: AttachmentService) {}

  @Delete(":attachmentId")
  deleteAttachment(
    @Param("attachmentId") attachmentId: string,
    @Req() req,
    @UserDecorator() user: any,
    @Res() res: Response,
  ) {
    return this.attachmentService.deleteAttachment(
      user?._id,
      attachmentId,
      res,
    );
  }
}
