Refactor file handling in BuyProduct and Request models; implement file schema for better structure. Update routes to handle file uploads and downloads with improved error handling and logging. Adjust MongoDB connection management across scripts and routes for consistency.

This commit is contained in:
2025-11-05 19:06:11 +03:00
parent 41b5cb6fae
commit 284be82e1e
15 changed files with 630 additions and 184 deletions

View File

@@ -1,10 +1,11 @@
const express = require('express')
const fs = require('fs')
const path = require('path')
const router = express.Router()
const BuyDocument = require('../models/BuyDocument')
// Create remote-assets/docs directory if it doesn't exist
const docsDir = 'server/remote-assets/docs'
const docsDir = 'server/routers/remote-assets/docs'
if (!fs.existsSync(docsDir)) {
fs.mkdirSync(docsDir, { recursive: true })
}