Download unit master sample file API
This commit is contained in:
parent
c13971792e
commit
72b6dab150
@ -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 });
|
||||
}
|
||||
};
|
||||
@ -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);
|
||||
|
||||
|
||||
|
||||
|
||||
1
app/uploads/unit-master-sample.csv
Normal file
1
app/uploads/unit-master-sample.csv
Normal file
@ -0,0 +1 @@
|
||||
Unit Name,Description
|
||||
|
Loading…
Reference in New Issue
Block a user