Skip to content

Feat/settings page#15

Closed
FaresM7 wants to merge 5 commits into
mainfrom
feat/settings-page
Closed

Feat/settings page#15
FaresM7 wants to merge 5 commits into
mainfrom
feat/settings-page

Conversation

@FaresM7
Copy link
Copy Markdown
Collaborator

@FaresM7 FaresM7 commented May 9, 2026

Pull Request

What does this PR do?

Please include a concise summary of the changes and/or features you are introducing with this PR.

Related Issues and PRs

What types of changes does your code introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

Checklist:

  • My code follows the code style of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • Any dependent changes have been merged and published in downstream modules

FaresM7 added 4 commits May 9, 2026 09:14
Stores runtime-configurable values (report recipients, PIN override)
so they can be changed through the admin UI without a redeployment.

- New admin_settings table with RLS (service role only)
- Seeds report_recipients and admin_pin rows as empty strings
- Adds anon SELECT policy on transactions_archive for stats queries
- Adds admin_settings types to database.types.ts
…y-pin

- settings.ts: GET/POST for admin_settings key-value pairs (PIN auth)
- archive.ts: manually archive+prune current month without sending email
- change-pin.ts: verify current PIN then write new PIN to settings table
- verify-pin.ts: dual-source PIN lookup (DB admin_pin → ADMIN_PIN env var)
  so PIN changes take effect immediately without redeployment
- Add fetchRecipients(): reads report_recipients from admin_settings,
  falls back to ADMIN_EMAIL env var for backward compatibility
- sendEmail() now accepts recipients[] instead of reading ADMIN_EMAIL
  internally, enabling multi-recipient support
- runMonthlyReport() fetches recipients in parallel with PDF/Excel gen
- Berichtsempfänger: add/remove email recipients stored in admin_settings
- PIN ändern: change admin PIN with current-PIN verification; updates
  sessionStorage so the active session keeps working immediately
- Datenverwaltung: live + archive stats cards, manual archive trigger
  (archive + prune without sending email, shows archived row count)
- Über die App: version, Datenschutz link, hackathon attribution
- Replace settings placeholder in AdminDashboard with <SettingsPage />
@vercel
Copy link
Copy Markdown

vercel Bot commented May 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
kaffeelisten Ready Ready Preview, Comment May 9, 2026 8:33am

…-active

PostgreSQL applies a SELECT policy's USING clause as implicit WITH CHECK
on any UPDATE that would make the row invisible. The old policy
anon_read_active_members (USING active = true) caused setting active = false
to fail with 42501 — the new row violated the visibility check of the SELECT
policy even though the explicit UPDATE WITH CHECK was (true).

Fix: replace with anon_read_members (USING true). The member-facing flow
already filters active = true in application code so behaviour is unchanged
for members. Admin can now deactivate and reactivate without error.
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