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

[Feature] Development programs backend #12481

Merged
merged 13 commits into from
Jan 14, 2025
Merged

Conversation

petertgiles
Copy link
Contributor

πŸ€– Resolves #12099

πŸ‘‹ Introduction

Adds backend modelling for development programs.

πŸ•΅οΈ Details

πŸ§ͺ Testing

  1. Rebuild app (with migrations, etc)
  2. Test using Graphiql - there is no UI yet

Some queries:

Query dev programs
query Communities {
  communities {
    id
    developmentPrograms {
      id
      name {en fr}
      descriptionForProfile {en fr}  
      descriptionForNominations {en fr}  		
      eligibleClassifications {group level}
    }
  }
}
Query my interest in dev programs
query Me {
  me {
    employeeProfile {
      communityInterests {
        id
        community {
          name {
            en
          }
        }
        interestInDevelopmentPrograms {
          id
          developmentProgram {
            name {
              en
            }
          }
          participationStatus
          completionDate
        }
      }
    }
  }
}
CreateCommunityInterest
mutation CreateCommunityInterest($createCommunityInterestInput: CreateCommunityInterestInput!) {
  createCommunityInterest(communityInterest: $createCommunityInterestInput) {
    id
  }
}
#-------------------------------------
{
  "createCommunityInterestInput": {
    "userId": "0b941616-2731-437c-89ac-5e2c63966288",
    "community": {
      "connect": "954d3de1-6fb0-40b6-9fa7-f23e0e79f8ac"
    },
    "interestInDevelopmentPrograms": {
      "create": [
        {
          "developmentProgramId": "0e3faf7e-8e96-46c2-8cc4-0f33b3f4d278"
        }
      ]
    }
  }
}
UpdateCommunityInterest
mutation UpdateCommunityInterest($id: UUID!, $updateCommunityInterestInput: UpdateCommunityInterestInput!) {
  updateCommunityInterest(
    id: $id
    communityInterest: $updateCommunityInterestInput
  ) {
    id
  }
}
#-----------------
{
  "id": "0a2f1017-6307-41f4-82f5-adf44d6d7e50",
  "updateCommunityInterestInput": {
    "interestInDevelopmentPrograms": {
      "create": [
        {
          "developmentProgramId": "8c1bd920-03d5-4aa8-a038-a3bcfcf271ad",
          "participationStatus": "COMPLETED",
          "completionDate": "2025-01-01"
        }
      ]
    }
  }
}
DeleteDevProgramInterest
mutation DeleteDevProgramInterest($id: UUID!, $updateCommunityInterestInput: UpdateCommunityInterestInput!) {
  updateCommunityInterest(
    id: $id
    communityInterest: $updateCommunityInterestInput
  ) {
    id
  }
}
#-------------------------------
{
  "id": "0a2f1017-6307-41f4-82f5-adf44d6d7e50",
  "updateCommunityInterestInput": {
    "interestInDevelopmentPrograms": {
      "delete": [
        "e882d6e5-2d09-44aa-9c1f-a58a9f58b8d6"
      ]
    }
  }
}

πŸ“Έ Screenshot

🚚 Deployment

public function rules(): array
{
return [
// developmentProgramId validated in the Create/UpdateCommunityInterestInputValidator
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately, it's a bit awkward that we can't validate this member of the input in its own validator. We don't have the community_id at this level and having two validators for the same field doesn't seem to work in Laravel.

Copy link
Contributor Author

@petertgiles petertgiles Jan 13, 2025

Choose a reason for hiding this comment

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

I've elected to not back-end localize this enum. On the applicant side, the UI uses the first person "I'm..." form of description and I don't see the descriptions on the admin side at all.

Copy link
Member

@esizer esizer left a comment

Choose a reason for hiding this comment

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

LGTM! πŸ‘ Learned some new laravel stuff while reviewing this πŸŽ‰

Looks like you just need to update the one test to match the new method args.

'description_for_profile' => FactoryHelpers::toFakeLocalizedString($this->faker->sentence()),
'description_for_nominations' => FactoryHelpers::toFakeLocalizedString($this->faker->sentence()),
'community_id' => function () {
$community = Community::inRandomOrder()->firstOr(fn () => Community::factory()->withWorkStreams()->create());
Copy link
Member

Choose a reason for hiding this comment

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

Oh this is cool! I did not know about firstOr.

Copy link
Member

Choose a reason for hiding this comment

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

So simple but so helpful πŸ˜›

@petertgiles petertgiles added this pull request to the merge queue Jan 14, 2025
Merged via the queue into main with commit c4d9102 Jan 14, 2025
11 checks passed
@petertgiles petertgiles deleted the 12099-dev-program-backend branch January 14, 2025 15:52
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.

✨ Backend model for Development Program
2 participants