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 = [];
}
/* ... */
Describe the Problem
/* else case: ... */are edge cases that are handled throughout development to some degree...Describe the Proposed Solution
References
elseblock for a User or an Org that is being written on App Install with NO repos...src\db\controllers\installation.controller.tsinstallationController.ts