-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat/page reordering endpoints (#108)
- Loading branch information
Showing
6 changed files
with
152 additions
and
10 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
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,12 @@ | ||
// Import base error | ||
const { BaseIsomerError } = require('./BaseError') | ||
|
||
class BadRequestError extends BaseIsomerError { | ||
constructor (message) { | ||
super(400, message) | ||
} | ||
} | ||
|
||
module.exports = { | ||
BadRequestError, | ||
} |
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,25 @@ | ||
const express = require('express'); | ||
const router = express.Router(); | ||
|
||
// Import middleware | ||
const { attachRouteHandlerWrapper } = require('../middleware/routeHandler') | ||
|
||
// Import classes | ||
const { Directory, FolderType } = require('../classes/Directory.js'); | ||
|
||
// List pages and directories in folder | ||
async function listFolderContent (req, res, next) { | ||
const { accessToken } = req | ||
const { siteName } = req.params | ||
const { path } = req.query | ||
|
||
const IsomerDirectory = new Directory(accessToken, siteName) | ||
const folderType = new FolderType(path) | ||
IsomerDirectory.setDirType(folderType) | ||
const folderPages = await IsomerDirectory.list() | ||
res.status(200).json({ folderPages }) | ||
} | ||
|
||
router.get('/:siteName/folders', attachRouteHandlerWrapper(listFolderContent)) | ||
|
||
module.exports = router; |
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