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

Refactor/google drive module #392

Merged
merged 34 commits into from
Feb 2, 2024
Merged

Refactor/google drive module #392

merged 34 commits into from
Feb 2, 2024

Conversation

gcharest
Copy link
Contributor

@gcharest gcharest commented Feb 2, 2024

Summary | Résumé

Fixed:

  • .devcontainer.json configuration and vscode settings for codespaces setup
  • make the new dev test commands available in dev only
  • update google_meet module docstring

Refactor the Google Drive integration:
Note: none of the changes below affect the app in production for the moment

  • split the functions using the different endpoints into each their distinct module (google_drive, google_docs, google
  • streamline the functions and make them reusable in different contexts
    • e.g.: single function to create a new file, taking the file type as an argument instead of two separate functions
  • add a google api error handler wrapper function

TODO: Add the remaining functions to their respective modules and update the imports in the various commands:

  1. get_timeline_section: Uses the Docs endpoint. This function should get a section with a start/end heading instead of using const. The implementation function needs to be adjusted.
  2. merge_data: Uses Docs and is specific to an incident. This function should be moved to the incident helper.
  3. replace_text_between_headings: Uses Docs and seems specific to the incident command. This function should be moved to the incident helper.
  4. create_incident: This function should be moved to the incident helper.
  5. close_incident_document: This function should be moved to the incident helper.
  6. update_incident_list: This function should be moved to the incident helper.
  7. update_spreadsheet_close_incident: This function should be moved to the incident helper.

@gcharest gcharest requested a review from a team February 2, 2024 01:36
@gcharest gcharest self-assigned this Feb 2, 2024
if PREFIX == "dev-":
google_service.google_service_command(client, body, respond)
else:
respond("This command is only available in the dev environment.")
Copy link
Contributor

Choose a reason for hiding this comment

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

I like that you added this here!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I figured I should setup a toggle instead of just leaving it hanging in there in prod 😅

.execute()
)
return results.get("files", [])
def google_service_command(client, body, respond):
Copy link
Contributor

Choose a reason for hiding this comment

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

Super nitpicky, but I would put some spacing between the end of the first function and the def googe_service_command

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is showing without space due to the way GitHub displays the changes inline 🤔

It shows like this in VSCode:
image

Copy link

github-actions bot commented Feb 2, 2024

GitHub Action status on 24c101e generated by comment-failure-action

Lint, format and test code

job url
null https://github.com/cds-snc/sre-bot/actions/runs/7757520891/job/21157165271

Build containers CI

No jobs failed 👍

Copy link

github-actions bot commented Feb 2, 2024

GitHub Action status on dab733e generated by comment-failure-action

Lint, format and test code

job url
null https://github.com/cds-snc/sre-bot/actions/runs/7758167782/job/21159298892

Build containers CI

No jobs failed 👍

Copy link

github-actions bot commented Feb 2, 2024

GitHub Action status on 3b73968 generated by comment-failure-action

Lint, format and test code

job url
null https://github.com/cds-snc/sre-bot/actions/runs/7758929359/job/21161819765

Build containers CI

No jobs failed 👍

@gcharest gcharest enabled auto-merge (squash) February 2, 2024 16:49
@gcharest gcharest merged commit 7504b42 into main Feb 2, 2024
7 checks passed
@gcharest gcharest deleted the refactor/GoogleDriveModule branch February 2, 2024 16:58
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.

3 participants