updates for contacts & tenders Modules

This commit is contained in:
yotakii
2026-04-01 15:50:21 +03:00
parent 278d8f6982
commit f101989047
12 changed files with 850 additions and 143 deletions

View File

@@ -227,6 +227,39 @@ export class TendersController {
next(error);
}
}
}
async viewAttachment(req: AuthRequest, res: Response, next: NextFunction) {
try {
const file = await tendersService.getAttachmentFile(req.params.attachmentId)
const fs = require('fs')
if (!fs.existsSync(file)) {
return res.status(404).json(
ResponseFormatter.error('File not found', 'الملف غير موجود')
)
}
const path = require('path')
return res.sendFile(path.resolve(file))
} catch (error) {
console.error(error)
next(error)
}
}
async deleteAttachment(req: AuthRequest, res: Response, next: NextFunction) {
try {
await tendersService.deleteAttachment(req.params.attachmentId)
res.json(ResponseFormatter.success(null, 'Deleted'))
} catch (error) {
next(error)
}
}
}
export const tendersController = new TendersController();