Skip to content

Support updating all partner config fields via PATCH /partner/:id #1043

@bl00dymarie

Description

@bl00dymarie

Overview

ℹ️ This is ticket 5/6 of #1038 Epic: Extract Partner Config from Frontend to Database.

The PATCH /v1/partner/:id endpoint currently only supports updating the active (boolean) field. We need to extend it so that all the new partner config fields (added in #1039) can also be updated. This allows the Chayn team to modify partner branding data (logos, websites, social links, footer text) via the API without needing a code deployment.

❗️ Blockers: #1039 (database migration) must be merged first

Action Items

  • Update src/partner/dtos/update-partner.dto.ts to add the new optional fields:

    • active (boolean, optional — keep existing)
    • logo (optional string)
    • logoAlt (optional string)
    • partnershipLogo (optional string)
    • partnershipLogoAlt (optional string)
    • bloomGirlIllustration (optional string)
    • website (optional string)
    • footerLine1 (optional string)
    • footerLine2 (optional string)
    • facebookUrl (optional string)
    • twitterUrl (optional string)
    • instagramUrl (optional string)
    • youtubeUrl (optional string)
    • tiktokUrl (optional string)
    • githubUrl (optional string)
    • Make the existing active field optional too (with @IsOptional()) so callers can update other fields without always specifying active
  • Use @IsOptional(), @IsString(), and @ApiProperty({ type: String, required: false }) decorators

  • For URL fields, consider adding @IsUrl() validation (same as Ticket 2, covers website, facebookUrl, twitterUrl, instagramUrl, youtubeUrl, tiktokUrl, githubUrl)

  • Update src/partner/partner.service.ts — the updatePartnerActiveStatus method currently only sets isActive:

    // Current:
        .set({ active: active })
    // Needs to handle all updatable fields
    • Refactor to accept all DTO fields and pass them through to the update query
    • Be careful to map activeisActive (the DTO field name differs from the entity column name)
    • Only set fields that are provided (don't overwrite existing values with undefined)
  • Update the existing tests in src/partner/partner.service.spec.ts:

    • Add test case for updating a single new field (e.g. website)
    • Add test case for updating multiple fields at once
    • Add test case for partial update (only some fields provided)
    • Verify the activeisActive mapping still works
  • Run all tests: npm run test

  • Test manually via PATCH /v1/partner/:id with various field combinations

Resources

  • DTO to update: src/partner/dtos/update-partner.dto.ts
  • Service to update: src/partner/partner.service.ts (line 62, [updatePartnerActiveStatus](https://github.com/chaynHQ/bloom-backend/blob/develop/src/partner/partner.service.ts#L62) method)
  • Existing tests: src/partner/partner.service.spec.ts
  • Entity for reference: src/entities/partner.entity.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity: moderateTime needed to do this ticket will be moderate e.g. 1-2 daysstate: blockedTask is blocked.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions