Skip to content
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/get all collections directories #117

Merged
merged 3 commits into from
Mar 3, 2021

Conversation

kwajiehao
Copy link
Contributor

@kwajiehao kwajiehao commented Mar 1, 2021

Overview

Note: this PR is to be reviewed in conjunction with PR #362 on the frontend.

It adds a new GET /:siteName/folders/all endpoint which returns the collection.yml directory config file for all collections/folders in the requested repo.

Copy link
Contributor

@alexanderleegs alexanderleegs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Comment on lines +38 to +42
if (
curr.type === 'dir'
&& !ISOMER_TEMPLATE_DIRS.includes(curr.name)
&& curr.name.slice(0, 1) === '_'
) acc.push(curr.path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could remove the underscore on the backend instead of the frontend, but I'm open to either option

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved with 7f8b635. For consistency, we will abstract the _ character away from the frontend entirely, and the backend will be responsible for removing and appending the _ character

@gweiying gweiying mentioned this pull request Mar 3, 2021
@gweiying
Copy link
Contributor

gweiying commented Mar 3, 2021

lgtm. Regarding underscore prefix, based on offline discussion we have decided that frontend will have no knowledge of underscore prefix, hence backend will handle any necessary prefixing and slicing.

This commit adds a RootType to the Directory class so that we can
retrieve directories from the root of a repo.
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
@kwajiehao kwajiehao force-pushed the feat/get-all-collections-directories branch from 7f8b635 to b78ca35 Compare March 3, 2021 06:21
@kwajiehao kwajiehao merged commit 88c1270 into staging Mar 3, 2021
@kwajiehao kwajiehao deleted the feat/get-all-collections-directories branch March 3, 2021 06:21
@kwajiehao kwajiehao restored the feat/get-all-collections-directories branch March 3, 2021 06:28
@kwajiehao kwajiehao mentioned this pull request Mar 3, 2021
kwajiehao added a commit that referenced this pull request Mar 3, 2021
* 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

* fix: use read route handler wrapper

Co-authored-by: jiehao <[email protected]>
gweiying added a commit that referenced this pull request Mar 3, 2021
gweiying added a commit that referenced this pull request Mar 4, 2021
* 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]>

* feat: create CollectionConfig which extends Config class, with methods for creating and deleting the collection.yml file

* feat: updates Collection class to use CollectionConfig for create, delete and rename functions

* fix: updates folders listAll route to use CollectionConfig

* fix: adds more details to inline comment for .list()

* feat: adds functions to support adding and removing item from CollectionConfig

* fix: removes endpoint variable

* fix: uses passed siteName variable instead of class variable

* fix: destructures err response status

* fix: allows Collection.create to take in optional orderArray

* fix: rename config to collectionConfig in Collection for clarity

* fix: updates Collection.rename to modify collectionName in collection.yml after git tree changes

* fix: typo in variable names

Co-authored-by: kwajiehao <[email protected]>
Co-authored-by: jiehao <[email protected]>
gweiying added a commit that referenced this pull request Mar 10, 2021
* 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]>

* feat: add function for creating new collection page

* feat: add route for creating new collection page

* fix: updates createCollectionPage endpoint to use /new in endpoint url

* feat: creates equivalent createPage endpoint for creating new unlinked pages

* fix: updates authenticated endpoints on backend

* fix: updates unlinkedPages to use Directory for .list()

* fix: removes unused listUnlinkedPages route

Co-authored-by: kwajiehao <[email protected]>
Co-authored-by: jiehao <[email protected]>
gweiying added a commit that referenced this pull request Mar 17, 2021
* 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]>
gweiying added a commit that referenced this pull request Mar 31, 2021
* 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]>

* feat: add moveResources API

* fix: adds backend check for if resource categories exist prior to move

* fix: update resourcePages routes to handle Base64 encoding on backend

* fix: update moveResource route to work on single file only

* Revert "fix: update moveResource route to work on single file only"

This reverts commit 81b4786.

* fix: typo in auth for resources route

Co-authored-by: kwajiehao <[email protected]>
Co-authored-by: jiehao <[email protected]>
harishv7 pushed a commit that referenced this pull request Feb 17, 2023
* 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

* fix: use read route handler wrapper

Co-authored-by: jiehao <[email protected]>
harishv7 pushed a commit that referenced this pull request Feb 17, 2023
* 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]>

* feat: create CollectionConfig which extends Config class, with methods for creating and deleting the collection.yml file

* feat: updates Collection class to use CollectionConfig for create, delete and rename functions

* fix: updates folders listAll route to use CollectionConfig

* fix: adds more details to inline comment for .list()

* feat: adds functions to support adding and removing item from CollectionConfig

* fix: removes endpoint variable

* fix: uses passed siteName variable instead of class variable

* fix: destructures err response status

* fix: allows Collection.create to take in optional orderArray

* fix: rename config to collectionConfig in Collection for clarity

* fix: updates Collection.rename to modify collectionName in collection.yml after git tree changes

* fix: typo in variable names

Co-authored-by: kwajiehao <[email protected]>
Co-authored-by: jiehao <[email protected]>
harishv7 pushed a commit that referenced this pull request Feb 17, 2023
* 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]>

* feat: add function for creating new collection page

* feat: add route for creating new collection page

* fix: updates createCollectionPage endpoint to use /new in endpoint url

* feat: creates equivalent createPage endpoint for creating new unlinked pages

* fix: updates authenticated endpoints on backend

* fix: updates unlinkedPages to use Directory for .list()

* fix: removes unused listUnlinkedPages route

Co-authored-by: kwajiehao <[email protected]>
Co-authored-by: jiehao <[email protected]>
harishv7 pushed a commit that referenced this pull request Feb 17, 2023
* 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]>
harishv7 pushed a commit that referenced this pull request Feb 17, 2023
* 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]>

* feat: add moveResources API

* fix: adds backend check for if resource categories exist prior to move

* fix: update resourcePages routes to handle Base64 encoding on backend

* fix: update moveResource route to work on single file only

* Revert "fix: update moveResource route to work on single file only"

This reverts commit 81b4786.

* fix: typo in auth for resources route

Co-authored-by: kwajiehao <[email protected]>
Co-authored-by: jiehao <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants