Skip to content

feat: add opportunity.statusMatch column + auto-derive from opportunity_volunteer#414

Open
nadavosa wants to merge 2 commits intodevelopfrom
feat/opportunity-status-match
Open

feat: add opportunity.statusMatch column + auto-derive from opportunity_volunteer#414
nadavosa wants to merge 2 commits intodevelopfrom
feat/opportunity-status-match

Conversation

@nadavosa
Copy link
Copy Markdown
Collaborator

Summary

  • Migration: adds vol-past to volunteer_status_match_enum, adds status_match column to opportunity table (default vol-no-matches)
  • New resolveOpportunityMatchStatus() lib function (mirrors resolveVolunteerMatchStatus)
  • New updateOpportunityMatching() utility called on OpportunityVolunteer insert + update
  • Auto-sets opportunity.status = opp-active when ≥1 volunteer is active
  • DTOs: statusMatch added to dtoOpportunityGetList and dtoOpportunityGet

Status logic

statusMatch Condition
vol-no-matches No volunteers linked
vol-pending-match ≥1 pending, none matched
vol-matched ≥1 matched
vol-past Some active but fewer than numberVolunteers needed

Test plan

  • Run migration on staging, verify status_match column exists on opportunity
  • Link a volunteer to an opportunity → statusMatch updates to vol-pending-match
  • Change opportunity_volunteer.status to opp-matchedstatusMatch becomes vol-matched
  • Change to opp-activeopportunity.status becomes opp-active
  • GET /opportunity/:id returns statusMatch field

Depends on

Closes

#413

🤖 Generated with Claude Code

…ty_volunteer

Closes #413

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
);

if (error) {
dataSource.logger.log(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

please use unified logger (src/logger.ts)

const opportunityRepository = getRepository(dataSource, Opportunity);
const opportunity = await opportunityRepository.findOneBy({ id });
if (!opportunity) {
return dataSource.logger.log(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

please use logge

Per review feedback on PR #414.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

2 participants