Download unit master sample file API

This commit is contained in:
unknown 2025-12-01 18:03:59 +05:30
parent c13971792e
commit 72b6dab150
3 changed files with 34 additions and 1 deletions

View File

@ -438,3 +438,12 @@ exports.uploadUnitMasterFromCSV = async (req, res) => {
});
}
};
exports.downloadUnitMasterSample = async (req, res) => {
try {
const filePath = path.join(__dirname, "../uploads/unit_master_sample.csv");
return res.download(filePath, "unit_master_sample.csv");
} catch (error) {
return res.status(500).send({ status: "failed", message: error.message });
}
};

View File

@ -2798,7 +2798,7 @@ router.get("/city-towns", [verifySignature, verifyToken], establishmentControlle
* @swagger
* /api/establishment/download-sample-file:
* get:
* summary: Download sample CSV template for bulk product upload
* summary: Download sample CSV template for bulk company profile upload
* tags: [Products]
* security:
* - appSignature: []
@ -2818,6 +2818,29 @@ router.get("/city-towns", [verifySignature, verifyToken], establishmentControlle
*/
router.get("/establishment/download-sample-file",[verifySignature, verifyToken], establishmentController.downloadCompanyProfileSample);
/**
* @swagger
* /api/establishment/download-sample-file:
* get:
* summary: Download sample CSV template for bulk Unit Master upload
* tags: [Products]
* security:
* - appSignature: []
* - bearerAuth: []
* responses:
* 200:
* description: Sample CSV file downloaded successfully
* content:
* text/csv:
* schema:
* type: string
* format: binary
* 404:
* description: File not found
* 500:
* description: Server error
*/
router.get("/unit_master/download-sample-file",[verifySignature, verifyToken], establishmentController.downloadUnitMasterSample);

View File

@ -0,0 +1 @@
Unit Name,Description
1 Unit Name Description