Files
sorsfonalak/crates/db/migrations/0007_birth_data_changes.sql
T
fecoandClaude Opus 5.5 e5cfbd6cdd
CI / test (push) Successful in 41s
CI / build (push) Successful in 4m11s
CI / deploy (push) Skipped
Detailed analysis button, loading wheel, birth data change limits
Backend:
- own birth data: three corrections within an hour of the first save,
  then one change per 24 hours (birth_data_changes); 429
  birth_data_change_limit with the user-facing message; /v1/me
  birth_change shows the notice; admins are not limited
- admins get detailed analyses free (no unit spent)
- POST /v1/payments/mock (MOCK_PAYMENTS): stand-in payment that adds a
  unit, until Stripe is connected; on in the compose files for now

Frontend:
- detailed analysis offer: admin starts it free, users with units
  confirm, others go through the (stand-in) payment step
- turning wheel with elapsed time while the summary or the analysis is
  being written
- no "adatok javítása" on the chart page (only in the profile), limit
  notice there; wheel hover highlighting removed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
2026-11-17 06:45:33 +00:00

16 lines
757 B
SQL

-- Every time a user's own (primary) birth data is set or changed. The
-- backend limits changes with it: after the first save, three corrections
-- within an hour, then one per 24 hours (admins are not limited).
CREATE TABLE birth_data_changes (
id uuid PRIMARY KEY,
user_id uuid NOT NULL REFERENCES users (id) ON DELETE CASCADE,
chart_id uuid REFERENCES charts (id) ON DELETE SET NULL,
created_at timestamptz NOT NULL DEFAULT now()
);
CREATE INDEX birth_data_changes_user_idx ON birth_data_changes (user_id, created_at);
-- The current primary charts count as the first save.
INSERT INTO birth_data_changes (id, user_id, chart_id, created_at)
SELECT gen_random_uuid(), owner_id, id, created_at FROM charts WHERE is_primary;