-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from Saifullah-dev/refactor/code-splitting
Additional props for better customization
- Loading branch information
Showing
31 changed files
with
464 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const FileSystem = require("../../models/FileSystem.model"); | ||
const path = require("path"); | ||
|
||
const downloadFile = async (req, res) => { | ||
try { | ||
const { id } = req.params; | ||
|
||
const file = await FileSystem.findById(id); | ||
if (!file || file.isDirectory) { | ||
res.status(404).json({ error: "File not found!" }); | ||
} | ||
|
||
const filePath = path.join(__dirname, "../../../public/uploads", file.path); | ||
res.header("Access-Control-Expose-Headers", "Content-Disposition"); | ||
res.download(filePath, file.name); | ||
} catch (error) { | ||
res.status(500).json({ error: error.message }); | ||
} | ||
}; | ||
|
||
module.exports = downloadFile; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,4 @@ body { | |
height: 70%; | ||
width: 67%; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
.file-delete-confirm { | ||
.file-delete-confirm-text { | ||
border-bottom: 1px solid #dddddd; | ||
padding: 10px 15px; | ||
margin-bottom: 1rem; | ||
padding: 15px; | ||
margin-top: 0; | ||
margin-bottom: .7rem; | ||
word-wrap: break-word; | ||
font-weight: 500; | ||
} | ||
|
||
.file-delete-confirm-actions { | ||
display: flex; | ||
gap: 0.5rem; | ||
justify-content: flex-end; | ||
margin-bottom: 1rem; | ||
margin-bottom: .7rem; | ||
margin-right: 1rem; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.