Skip to content

Conversation

@quang-le
Copy link
Member

@quang-le quang-le commented Dec 24, 2025

What problem is this PR solving? Explain here in one sentence.

Related JIRA tickets : POLIO-1997, POLIO-2013

Self proofreading checklist

  • Did I use eslint and ruff formatters?
  • Is my code clear enough and well documented?
  • Are my typescript files well typed?
  • New translations have been added or updated if new strings have been introduced in the frontend
  • My migrations file are included
  • Are there enough tests?
  • Documentation has been included (for new feature)

Doc

In the tests

Changes

  • Add PrimaryKeyRelatedField to CampaignSerializer
  • Add custom validation for both integrated_to and integrated_campaigns
  • Add RetrieveCampaignSerializer to format front-end friendly response
  • Add tests

How to test

  • Using Django API, Bruno or Postman:
    • Get details for a campaign: the fields integrated_to and integrated_campaigns should be present
    • Update this campaigns:
      • Update integrated_to with another campaign's id and save
      • Update integrated_campaigns with a list of campaign ids and save

Expected behaviour:

  • integrated_to must be a polio campaign id
  • integrated_campaigns cannot contain polio campaigns ids
  • integrated_to must be null for a polio campaign
  • integrated_campaigns must be empty for non-polio campaign
  • if a campaign has multiple campaign types, it is considered a polio campaign if polio type is included in its types

Print screen / video

NA

@quang-le quang-le added the release Should be released in production at next deploy label Dec 24, 2025
@quang-le quang-le marked this pull request as draft December 24, 2025 15:57
@quang-le quang-le marked this pull request as ready for review December 24, 2025 17:33
@tdethier tdethier self-requested a review January 5, 2026 09:59
@tdethier
Copy link
Member

tdethier commented Jan 6, 2026

I forgot to include a general comment in the review so here it is @quang-le:

  • I couldn't make POST/PUT calls to the API with the DRF web view because I never was able to provide a valid value for Grouped campaigns - GET calls are fine and behave properly. Since it's not related to this PR, it's fine I guess
  • I added many comments in units tests, but it's more or less the same thing:
    • I would add more asserts on value in the DB to make sure that the result is ok in the system and not just in the returned payload
    • I would check the error message in case of a validation issue (to make sure that you are actually triggering the right error and not another one)
  • the api.campaigns.campaigns.py file is so huge, I hope we can manage to split it in multiple files in the future 😅 it will also make our lives easier in unit tests if we can cover the viewset behavior in a separate file from the serializers behavior

@quang-le quang-le merged commit 626b636 into develop Jan 6, 2026
7 checks passed
@quang-le quang-le deleted the POLIO-2013_integrated_campaign_api branch January 6, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release Should be released in production at next deploy

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants