Skip to content

feat: implement certificate retirement API endpoint#429

Open
devAgatha wants to merge 1 commit into
AnnabelJoe:mainfrom
devAgatha:feat/270-certificate-retirement
Open

feat: implement certificate retirement API endpoint#429
devAgatha wants to merge 1 commit into
AnnabelJoe:mainfrom
devAgatha:feat/270-certificate-retirement

Conversation

@devAgatha
Copy link
Copy Markdown

Summary

Completes the certificate retirement flow: calls energy_token burn on Soroban, persists the tx hash, and emits an audit event.

Changes

  • supabase/migrations/20240101000005_certificate_retirement.sql — adds retire_tx_hash column to certificates and creates retirement_events audit table
  • src/lib/database.types.ts — updated types for retire_tx_hash and new retirement_events table
  • src/app/api/certificates/[id]/retire/route.ts — stores retire_tx_hash in DB, inserts retirement_events record, returns 409 if already retired

Acceptance Criteria

  • POST /api/certificates/:id/retire endpoint
  • Calls energy_token burn function on Soroban
  • Records retirement timestamp, beneficiary, and tx hash in DB
  • Returns 409 if certificate already retired
  • Emits retirement event for audit log

Closes #270

- POST /api/certificates/:id/retire calls energy_token burn on Soroban
- Records retirement timestamp, beneficiary, and retire_tx_hash in certificates table
- Returns 409 if certificate already retired
- Emits retirement_events record for audit log
- Add migration 005: retire_tx_hash column + retirement_events table
- Update database.types.ts with new fields

Closes AnnabelJoe#270
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.

Implement certificate retirement API endpoint

1 participant