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

Integrate with frontend web app #79

Merged
merged 32 commits into from
Oct 27, 2021

Conversation

JonathanLeeWH
Copy link
Contributor

@JonathanLeeWH JonathanLeeWH commented Nov 24, 2020

API Related

  • Added POST users/check API endpoint for check on username availability
  • Amended POST users API endpoint logic to add custom claims (username field) to firebase Authentication
  • Resolved naming error with regards to the naming of the users controller method for users/check API endpoints
  • Amended error message for missing and invalid authentication token with consistent message
  • Added support for api/search/software to allow for integration with frontend typeahead search bar component (including page and per_page query params support`

Note: This does not use mongodb build in text search (https://docs.mongodb.com/manual/text-search/) due to lack of support for partial text search.

Potential Alternative is to use Mongodb Atlas Search (https://www.mongodb.com/atlas/search and https://www.mongodb.com/blog/post/mongodb-atlas-search-now-ga) but it will mean require depending on a third party service.

Another alternative is to use elasticsearch

  • Added api/software/added/recent and api/software/updates/recent API endpoints
  • Resolved a bug in POST software API endpoint where the software model meta properties are not updated

Model Related

  • Removed username minlength of 6 constraint from user model
  • Refactored ALLOWED_USERNAME_REGEX to utils/config.js
  • Amended Allowed username regex to only allow alphanumeric characters (uppercase letter not included as all letters will be converted lowercase letters when saved to database) and underscores
  • Added additional test scenario in users.test.js when no Authorization token is provided
  • Added corresponding test cases for users/check API endpoints in users.test.js
  • Amended software model by changing developedBy and maintainedBy fields from reference to user to an array of String

Note: This is due to the fact that the developer(s) or maintainer(s) may not be a registered user

  • Improved software model with shortDescription, pricing, videoLink and twitterUsername fields

Note: videoLink field validates if the video link is either youtube.com or vimeo.com as the plan is to initially support only youtube and vimeo as video hosting websites

Test Related

  • Added the corresponding requests API endpoint test file for POST users/check API endpoint
  • Resolved a bug in the requests API endpoint test file file for POST users API endpoint
  • Removed users.test.js test scenario where username provided is less than 6 characters in line with the removal of username minlength of 6 from user model
  • Amended test/utils/databaseSetup.js setBackendDefaultUser method with the additional custom claims (username) for firebase Authentication (Part of frontend Integration)
  • Amended softwareTestUtils.js to match the updated software model
  • Amended post_software.rest test API endpoint file to match the updated software model
  • Amended patch_softwareById.rest test API endpoint file to PATCH HTTP method from PUT HTTP method
  • Added get_recentAddedSoftware.rest and get_recentUpdatedSoftware.rest test API endpoints files

Others

  • Added additional check involving username in database for verifyAuthToken method when checkDatabase argument is set to true
  • Refactored checkUsernameValidity as a separate method in utils/usersUtils.js for improved cohesion
  • Refactored code with ALLOWED_VIDEO_HOST_WHITELIST now available in utils/config.js for easier configuration (Improved code quality)

To be considered

  • To consider whether license field should be added in software model and whether it should accept a String (license type) or url type (the url to license)

Added the corresponding requests API endpoint test file for POST users/check API endpoint
Resolved a bug in the requests API endpoint test file file for POST users API endpoint
Refactored ALLOWED_USERNAME_REGEX to utils/config.js
Amended Allowed username regex to only allow alphanumeric characters (uppercase letter not included as all letters will be converted lowercase letters when saved to database) and underscores
Amended POST users API endpoint logic to add custom claims (username field) to firebase Authentication
Removed users.test.js test scenario where username provided is less than 6 characters in line with the removal of username minlength of 6 from user model
Added additional test scenario in users.test.js when no Authorization token is provided
….test.js

Refactored checkUsernameValidity as a separate method in utils/usersUtils.js for improved cohesion
Resolved naming error with regards to the naming of the controller method for users/check API endpoints introduced in the previous commit
@JonathanLeeWH JonathanLeeWH added enhancement New feature or request db.model Related to database models/schemas API Related to API endpoints Testing Related to testing code quality Related to code quality firebase Related to firebase frontend integration Related to frontend integration labels Nov 24, 2020
@JonathanLeeWH JonathanLeeWH added this to the Version 1.0.0 milestone Nov 24, 2020
@JonathanLeeWH JonathanLeeWH self-assigned this Nov 24, 2020
JonathanLeeWH and others added 17 commits November 24, 2020 19:02
…ken method when checkDatabase argument is set to true

Amended test/utils/databaseSetup.js setBackendDefaultUser method with the additional custom claims (username) for firebase Authentication (Part of frontend Integration)
Amended error message for missing and invalid authentication token with consistent message
…oftware in database

Added test search software API endpoint `search_software.rest` file

This is to prepare for usage in frontend typeahead search bar

Note: This does not use `mongodb` build in `text search` (https://docs.mongodb.com/manual/text-search/) due to lack of support for partial

Potential Alternative is to use `Mongodb Atlas Search` (https://www.mongodb.com/atlas/search and https://www.mongodb.com/blog/post/mongodb-atlas-search-now-ga) but it will mean require depending on a third party service.

Another alternative is to use `elasticsearch`
…endpoint

Added `/api/search/software` API endpoint to allow for searching of software in database
…oftware` API endpoint

Amended `search_software.rest` test API endpoint with `page` and `per_page` query params

This is to prepare for pagination support in the frontend
… fields from reference to `user` to an array of string
…model

Amended `software` model by changing `developedBy` and `maintainedBy` fields from reference to `user` to an array of `String`
…-software-api-endpoint

Improved `search` software API endpoint
…ink` and `twitterUsername` fields

Note: `videoLink` field validates if the video link is either `youtube.com` or `vimeo.com` as the plan is to initially support only youtube and vimeo as video hosting websites

Amended `softwareTestUtils.js` to match the updated `software` model

Amended `post_software.rest` test API endpoint file to match the updated `software` model
…e-model

Improved `software` model with `shortDescription`, `pricing`, `videoLink` and `twitterUsername` fields
…ault-software-model

Added missing `default` field in `software` model `twitterUsername` field
JonathanLeeWH and others added 9 commits August 1, 2021 16:58
… model `meta` properties are not updated

Amended `patch_softwareById.rest` test API endpoint file to `PATCH` HTTP method from `PUT` HTTP method
…-post-software-api

Resolved a bug in `POST` `software` API endpoint where the `software` model `meta` properties are not updated
…PI endpoints

Added `get_recentAddedSoftware.rest` and `get_recentUpdatedSoftware.rest` test API endpoints files

This is to prepare for frontend integration (listing of recently added and updated software)

Refactored `search_software.rest` test API endpoint file to `search` directory for consistency
…software-api-endpoints

Added `api/software/added/recent` and `api/software/updates/recent` API endpoints
…not part of whitelist

Refactored code with `ALLOWED_VIDEO_HOST_WHITELIST` now available in `utils/config.js` for easier configuration (Improved code quality)
…host-whitelist-bug

Resolved a bug where previously video host with subdomain `www.` was not part of whitelist
@JonathanLeeWH JonathanLeeWH added the github_actions Pull requests that update Github_actions code label Oct 6, 2021
@JonathanLeeWH JonathanLeeWH added dependencies Pull requests that update a dependency file priority.high High priority Security Related to Security status.done Done and ready for review and merge labels Oct 27, 2021
…-to-version-16-lts

Amended GitHub Actions to new nodejs LTS Version `16`
@JonathanLeeWH JonathanLeeWH linked an issue Oct 27, 2021 that may be closed by this pull request
@JonathanLeeWH JonathanLeeWH merged commit 89a3333 into master Oct 27, 2021
@JonathanLeeWH JonathanLeeWH deleted the integrate-with-frontend-web-app branch October 27, 2021 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Related to API endpoints code quality Related to code quality db.model Related to database models/schemas dependencies Pull requests that update a dependency file enhancement New feature or request firebase Related to firebase frontend integration Related to frontend integration github_actions Pull requests that update Github_actions code priority.high High priority Security Related to Security status.done Done and ready for review and merge Testing Related to testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

To check support for newest Nodejs LTS Version 16
1 participant