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

fix(openchallenges): update OC data model and API specs #2399

Merged
merged 23 commits into from
Dec 15, 2023

Conversation

vpchung
Copy link
Member

@vpchung vpchung commented Dec 8, 2023

Fixes #2064

Changelog

  • SQL
    • allow avatar_keys to be NULL (not all platforms/organizations/challenges will have an image)
    • update max characters for website_url and avatar_url to 500 characters (ref)
    • update max characters for challenge.doi to 120 characters - to be reasonably more generous with URLs
    • update max characters fororganization.acronym to 10 characters (ref)
    • add constraint that challenge.slug must be unique, in kebab-case, and at least 3 characters
    • add constraint that organization.login must be unique, in kebab-case, and at least 2 characters
    • add constraint that challenge.name cannot be NULL
    • add constraint that combination of challenge_id, organization_id, and role must be unique in challenge_contribution tables
    • set default value for organization.challengeCount to 0
    • remove redundant constraint of id having to be unique - they are set as primary keys so they should already be unique
    • remove deprecated columns (challenge.difficulty, organization.email)
    • general cleanup (fix formatting, remove commented out lines, etc)
    • update dump files (using latest data from chore(openchallenges): 2023-12-06 DB update #2394
  • API descriptions
    • add schemas for ChallengeDoi, CreationDatetime, ModifiedDatetime, Url
    • remove unneeded schemas: ChallengeDifficulty, ChallengeReadme*
    • add missing descriptions to Organization properties, e.g. Organization.name
    • update API models to reflect changes noted above in SQL ^ e.g. specify certain properties as nullable, update maxLength, set default values, etc.
  • Web app
    • update mock objects, search queries and HTML files to not include deprecated properties, e.g. difficulty and email

Note

There were some updates made to the Java scripts as well, as not updating them prevented the challenges to display on the web app. This was done with the generator: nx run openchallenges-*-service:generate

Preview

No changes to search pages e.g.
Screenshot 2023-12-07 at 5 03 13 PM

Organization profile no longer displays contact email:
Screenshot 2023-12-07 at 5 03 24 PM

API spec for challenges:
Screenshot 2023-12-07 at 5 06 12 PM

API spec for organizations:
Screenshot 2023-12-07 at 5 06 22 PM

@vpchung vpchung changed the title Epic 2064 fix(openchallenges): update OC data model and API specs Dec 8, 2023
@vpchung vpchung marked this pull request as ready for review December 8, 2023 01:04
@vpchung vpchung self-assigned this Dec 8, 2023
@tschaffter
Copy link
Member

@vpchung I need to review this PR before it gets merged (even if it meets the one-approval check)

Copy link
Member

@tschaffter tschaffter left a comment

Choose a reason for hiding this comment

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

Impressive PR! I can appreciate how thorough you have been when updating the code base!

TODO to myself:

  • Regenerate the API client for Angular and push to this branch if successful

@tschaffter
Copy link
Member

tschaffter commented Dec 13, 2023

@vpchung There are a few errors after updating the API client for Angular (nx run openchallenges-api-client-angular), which boil down to two changes:

  • challenge.platform may be undefined or null, hence its property like name may not be available
  • organization.description can now be undefined or null
Error: libs/openchallenges/challenge/src/lib/challenge-overview/challenge-overview.component.html:33:60 - error TS2533: Object is possibly 'null' or 'undefined'.

33           <td [ngClass]="{ 'text-grey': challenge.platform.name === '' }">
                                                              ~~~~

  libs/openchallenges/challenge/src/lib/challenge-overview/challenge-overview.component.ts:14:16
    14   templateUrl: './challenge-overview.component.html',
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Error occurs in the template of component ChallengeOverviewComponent.


Error: libs/openchallenges/challenge/src/lib/challenge-overview/challenge-overview.component.html:34:49 - error TS2533: Object is possibly 'null' or 'undefined'.

34             {{ useNaIfFalsey(challenge.platform.name) }}
                                                   ~~~~

  libs/openchallenges/challenge/src/lib/challenge-overview/challenge-overview.component.ts:14:16
    14   templateUrl: './challenge-overview.component.html',
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Error occurs in the template of component ChallengeOverviewComponent.


Error: libs/openchallenges/challenge/src/lib/challenge-stats/challenge-stats.component.html:27:28 - error TS2533: Object is possibly 'null' or 'undefined'.

27         challenge.platform.name === 'Other' ? 'platform' : challenge.platform.name
                              ~~~~

  libs/openchallenges/challenge/src/lib/challenge-stats/challenge-stats.component.ts:10:16
    10   templateUrl: './challenge-stats.component.html',
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Error occurs in the template of component ChallengeStatsComponent.


Error: libs/openchallenges/challenge/src/lib/challenge-stats/challenge-stats.component.html:27:79 - error TS2533: Object is possibly 'null' or 'undefined'.

27         challenge.platform.name === 'Other' ? 'platform' : challenge.platform.name
                                                                                 ~~~~

  libs/openchallenges/challenge/src/lib/challenge-stats/challenge-stats.component.ts:10:16
    10   templateUrl: './challenge-stats.component.html',
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Error occurs in the template of component ChallengeStatsComponent.


Error: libs/openchallenges/org-profile/src/lib/org-profile-overview/org-profile-overview.component.html:5:27 - error TS2345: Argument of type 'string | null | undefined' is not assignable to parameter of type 'string | undefined'.
  Type 'null' is not assignable to type 'string | undefined'.

5       <p>{{ useNaIfFalsey(org.description) }}</p>
                            ~~~~~~~~~~~~~~~

  libs/openchallenges/org-profile/src/lib/org-profile-overview/org-profile-overview.component.ts:14:16
    14   templateUrl: './org-profile-overview.component.html',
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Error occurs in the template of component OrgProfileOverviewComponent.


Error: libs/openchallenges/org-profile/src/lib/org-profile-overview/org-profile-overview.component.html:6:35 - error TS2533: Object is possibly 'null' or 'undefined'.

6       <div *ngIf="org.description.endsWith('...')">
                                    ~~~~~~~~

  libs/openchallenges/org-profile/src/lib/org-profile-overview/org-profile-overview.component.ts:14:16
    14   templateUrl: './org-profile-overview.component.html',
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Error occurs in the template of component OrgProfileOverviewComponent.




✖ Failed to compile.

@vpchung vpchung requested a review from tschaffter December 14, 2023 20:55
@vpchung vpchung merged commit 970da70 into Sage-Bionetworks:main Dec 15, 2023
6 checks passed
@vpchung vpchung deleted the epic-2064 branch December 15, 2023 02:51
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.

[Epic] Add constraints to all the properties of the OC Data and API models
3 participants