690414:1113 Update README.md /.agents/skills, /.windsurf/workflows

This commit is contained in:
2026-04-14 11:13:42 +07:00
parent 02400fd88c
commit 6d45bdaeb5
194 changed files with 12708 additions and 8762 deletions
@@ -170,6 +170,31 @@ export class FileStorageService {
return committedAttachments;
}
/**
* ADR-021: Preview File by publicId (Content-Disposition: inline)
* ดึงไฟล์มาเป็น Stream สำหรับแสดงผลใน Browser โดยตรง (ใช้กับ FilePreviewModal)
*/
async preview(
publicId: string
): Promise<{ stream: fs.ReadStream; attachment: Attachment }> {
const attachment = await this.attachmentRepository.findOne({
where: { publicId },
});
if (!attachment) {
throw new NotFoundException(`Attachment not found`);
}
const filePath = attachment.filePath;
if (!fs.existsSync(filePath)) {
this.logger.error(`Preview file missing on disk: ${filePath}`);
throw new NotFoundException('File not found on server storage');
}
const stream = fs.createReadStream(filePath);
return { stream, attachment };
}
/**
* Download File
* ดึงไฟล์มาเป็น Stream เพื่อส่งกลับไปให้ Controller