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-edge-cases #39

Open
colinwilliams91 opened this issue Apr 11, 2024 · 0 comments
Open

refactor-edge-cases #39

colinwilliams91 opened this issue Apr 11, 2024 · 0 comments

Comments

@colinwilliams91
Copy link
Contributor

colinwilliams91 commented Apr 11, 2024

Describe the Problem

  • sections of code labaled as /* else case: ... */ are edge cases that are handled throughout development to some degree...

Describe the Proposed Solution

  • It will be wise to revisit these after testing and usage.

References

  • E.g.: else block for a User or an Org that is being written on App Install with NO repos...

src\db\controllers\installation.controller.ts installationController.ts

  findOrCreateInstallation = async (payload) => { // return type Promise<typeof Installation>
    try {

      let _installation = await this.socketFindOneById(payload.installation.id); // _installation: typeof Installation | null
      let _repositories: any[];

      if (_installation === null) {

        const { installation, repositories }: { installation: OctokitTypes.Installation, repositories: OctokitTypes.Repository[] } = payload;
        const { id, target_id, target_type, account } = installation;
        const { login, organizations_url, repos_url } = account;

        /* maps repos for installation document to array of owner_ids */
        if (repositories.length) {
          _repositories = repositories.map((repo: any) => repo.id);
        } else { /* else case: User or Org with no Repos */
          _repositories = [];
        }

/* ... */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant