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

PIMS-1884 Swagger Rework #2621

Merged
merged 37 commits into from
Aug 28, 2024
Merged

PIMS-1884 Swagger Rework #2621

merged 37 commits into from
Aug 28, 2024

Conversation

dbarkowsky
Copy link
Collaborator

@dbarkowsky dbarkowsky commented Aug 13, 2024

🎯 Summary

PIMS-1884

Swagger Autogen was not doing a sufficient job of generating documentation. Moving to a manually-defined documentation structure.

Follows this structure:

  • Write Swagger documentation in .swagger.yaml files
  • Place these files alongside their relevant routes

Changes

  • Remove swagger-autogen package and commands
  • Add .yaml files that manually define routes

While writing documentation, these are the changes that happened as a result.

  • Notifications service now updates the updated by field when the CHES status is updated.
  • Removed unused routes from /tools, /roles, and /users
    • In some cases, the controllers were removed as well.
  • Changed orWhere condition in some queries to andWhere. This isn't an issue with the current MUI tables, because we only query by one column at a time, but I noticed if I manually queried by multiple columns it would not function as expected, getting way too many results.
  • Removed unused properties from schemas. Some of these were carried from old PIMS. Some have more recently been taken out or are about to be taken out in other PRs.
  • Changed default error code to 500. If we don't know why something errored, it's not necessarily a bad request, but a server-side error.
  • Removed hooks in react-app that were unused.

Testing

With the API running, go to this URL: http://localhost:5000/api-docs

To use any protected routes, copy your bearer token from the browser and use it in the authorization section
image

🔰 Checklist

  • I have read and agree with the following checklist and am following the guidelines in our Code of Conduct document.
  • I have performed a self-review of my code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation where required.
  • I have tested my changes to the best of my ability.
  • My changes generate no new warnings.

Copy link

🚀 Deployment Information

The Express API Image has been built with the tag: 2621. Please make sure to utilize this specific tag when promoting these changes to the TEST and PROD environments during the API deployment. For more updates please monitor Image Tags Page on Wiki.

Copy link

codeclimate bot commented Aug 13, 2024

Code Climate has analyzed commit b955e59 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 83.7% (50% is the threshold).

This pull request will bring the total coverage in the repository to 93.2%.

View more on Code Climate.

Copy link
Collaborator

@LawrenceLau2020 LawrenceLau2020 left a comment

Choose a reason for hiding this comment

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

The new swagger docs looks good, tested a couple endpoints and works well.
Also tested admin areas, agencies, properties and projects tables, filtering still working well and cancelling/resending notifications updates the updatedById correctly. No issues found.

@dbarkowsky dbarkowsky merged commit 4d452d3 into main Aug 28, 2024
13 checks passed
@dbarkowsky dbarkowsky deleted the PIMS-1884-Swagger-Rework branch August 28, 2024 17:27
dbarkowsky added a commit that referenced this pull request Sep 11, 2024
Co-authored-by: LawrenceLau2020 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants