-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/update pageroutes #133
Conversation
* feat: add RootType Directory This commit adds a RootType to the Directory class so that we can retrieve directories from the root of a repo. * feat: new endpoint for retrieving information on all folders This commit introduces a new GET `/:siteName/folders/all` endpoint which: 1) gets the names of all collections/folders within the repo 2) gets the collection.yml directory config file for each collection * fix: remove _ before sending folder name Co-authored-by: jiehao <[email protected]>
02f1a80
to
e1c378d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good for the most part, mostly had a question on how the updateItemInOrder
method for the CollectionConfig
class works
return { index, item } | ||
} | ||
|
||
async updateItemInOrder(oldItem, newItem) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's nice to compose the updateItemInOrder
from the other methods, but this results in two four API calls for what is essentially one update. Have we considered writing specific "update" code so only one two API calls are made?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gweiying brought up the possibility of building out the methods for the CollectionConfig
class but as that would be a more significant undertaking we will be postponing that for now. As discussed, we will modify the updateItemInOrder
method so that the the directory config file is read only once, and custom updating logic is applied instead of composing it with the addItem
and deleteItem
methods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -63,24 +63,6 @@ async function listPages (req, res, next) { | |||
res.status(200).json({ pages }) | |||
} | |||
|
|||
// Create new page |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: could we also remove unused imports for this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
As discussed offline, we might want to move the encoding/decoding into File
instead, but we'll do this later on when cleaning up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
* Feat/get all collections directories (#117) * feat: add RootType Directory This commit adds a RootType to the Directory class so that we can retrieve directories from the root of a repo. * feat: new endpoint for retrieving information on all folders This commit introduces a new GET `/:siteName/folders/all` endpoint which: 1) gets the names of all collections/folders within the repo 2) gets the collection.yml directory config file for each collection * fix: remove _ before sending folder name Co-authored-by: jiehao <[email protected]> * fix: resolving merge conflicts * fix: restores comments that were accidentally deleted * fix: applies missing URI decoding to page routes * fix: updates CollectionConfig to return and accept spliced index * fix: updates renameCollectionPage to use updated CollectionConfig functions * fix: adds updateItemInOrder and read methods to CollectionConfig * fix: updates collectionPages route to use updated CollectionConfig methods * fix: changes updateItemInOrder to use single read and update API call * fix: removes unused imports Co-authored-by: kwajiehao <[email protected]> Co-authored-by: jiehao <[email protected]>
This PR updates the
pages
andcollectionPages
read
,update
,delete
andrename
routes so that all path names are received and parsed as encodedURIComponents, and Base64 encoding happens only on the backend. This PR extends the changes introduced by Alex in #131.For
collectionPages
delete
andrename
, the collection config is also updated accordingly to remove/ rename the modified pages.This PR also updates the
CollectionConfig
'saddItemToOrder
,deleteItemFromOrder
,updateItemInOrder
andread
methods to make the class more reusable.