Skip to content

feat: prefill Telegram and dietary restriction answers in registrations - #77

Merged
ccruzkauppila merged 2 commits into
ilmo-hackathon-consolidationfrom
feat/prefill
Nov 20, 2026
Merged

ccruzkauppila merged 2 commits into
ilmo-hackathon-consolidationfrom
feat/prefill

Conversation

@Henrisal

Copy link
Copy Markdown
Contributor

Summary

Registration prefilled only name and email. An admin can now mark a TEXT question as asking for Telegram or dietary restrictions, and its answer is prefilled from the user's registration profile.

sequenceDiagram
    participant Admin
    participant User
    participant Form as Registration form
    participant DB
    Admin->>DB: question.prefill = TELEGRAM | DIETARY_RESTRICTIONS
    User->>DB: setRegistrationProfile (settings page)
    Form->>DB: currentUser.registrationProfile
    DB-->>Form: answers[questionId] = profile value
    User->>DB: createRegistration (own email)
    DB->>DB: trigger saves non-empty prefill answers to profile
Loading
 app_public.event_questions
+  prefill question_prefill   -- TEXT questions only
+app_public.registration_profiles   -- RLS: own row only
+  user_id pk, telegram, dietary_restrictions
+app_public.set_registration_profile(telegram, dietary_restrictions)
+app_private.tg_registrations__save_registration_profile  -- after is_finished

The profile is a separate table because app_public.users is publicly readable. The trigger only saves when the registration email is one of the user's own emails, so registering a friend does not overwrite the profile. Empty answers never clear a saved value; the settings page does that.

Evidence

  • Before: registration form prefilled firstName, lastName, email only.
    After: marked questions are prefilled; verified manually in the dev environment.
  • New @app/db/__tests__/app_public/tables/registration_profiles.test.ts:
    set + update own profile, empty → null       ✓
    other user cannot read the profile           ✓
    anonymous set → LOGIN error                  ✓
    finishing own registration saves answers     ✓
    unanswered question keeps saved value        ✓
    registration for someone else saves nothing  ✓
    
  • pnpm test @app/db 118/118, pnpm test @app/server 169/169, pnpm tsc, prettier and eslint clean.

Merge Danger

Door: two-way

Additive schema only: a nullable column, a new table, a new function and trigger. The create_event_questions / update_event_questions input types gain a trailing prefill attribute, so SQL that casts a 6-field row(...) to them must add a 7th field (one existing test updated).

Blast Radius: registrations

The new trigger runs inside create_registration; a failure there would fail the registration. It skips over-length answers instead of violating the profile's length checks. current/3-registration-prefill.sql shares its number with 3-event-highlight-text.sql on feat/nattitapahtuma; renumber whichever merges second.

🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown

📦 Next.js Bundle Analysis for @app/client

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 266.48 KB (🟡 +480 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Twenty-six Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load % of Budget (450 KB)
/ 344.49 KB 610.97 KB 135.77% (🟡 +0.05%)
/404 221.93 KB 488.41 KB 108.54% (🟡 +0.05%)
/_error 226.84 KB 493.32 KB 109.63% (🟡 +0.05%)
/admin/emails 250.92 KB 517.4 KB 114.98% (🟡 +0.05%)
/admin/event-category/create 282.91 KB 549.39 KB 122.09% (🟡 +0.05%)
/admin/event-category/list 334.54 KB 601.02 KB 133.56% (🟡 +0.05%)
/admin/event-category/update/[id] 283.09 KB 549.57 KB 122.13% (🟡 +0.05%)
/admin/event/create 521.51 KB 787.99 KB 175.11% (🟡 +0.07%)
/admin/event/list 342.44 KB 608.92 KB 135.32% (🟡 +0.05%)
/admin/event/update/[id] 521.97 KB 788.45 KB 175.21% (🟡 +0.07%)
/admin/organization/[slug] 310.96 KB 577.44 KB 128.32% (🟡 +0.05%)
/admin/organization/create 259.77 KB 526.25 KB 116.95% (🟡 +0.05%)
/admin/users/list 334.83 KB 601.31 KB 133.62% (🟡 +0.06%)
/event/[slug] 367.25 KB 633.73 KB 140.83% (🟡 +0.06%)
/event/[slug]/register/[quotaId] 287.74 KB 554.22 KB 123.16% (🟡 +0.08%)
/forgot 239.69 KB 506.17 KB 112.48% (🟡 +0.05%)
/invitations/accept 223.48 KB 489.96 KB 108.88% (🟡 +0.05%)
/login 253.35 KB 519.83 KB 115.52% (🟡 +0.05%)
/reset 245.84 KB 512.32 KB 113.85% (🟡 +0.05%)
/settings/accounts 308.99 KB 575.47 KB 127.88% (🟡 +0.06%)
/settings/delete 243.46 KB 509.93 KB 113.32% (🟡 +0.05%)
/settings/emails 287.07 KB 553.55 KB 123.01% (🟡 +0.06%)
/settings/profile 249.4 KB 515.88 KB 114.64% (🟡 +0.15%)
/settings/security 255.75 KB 522.23 KB 116.05% (🟡 +0.06%)
/update-registration/[updateToken] 248.81 KB 515.29 KB 114.51% (🟡 +0.05%)
/verify 222.41 KB 488.89 KB 108.64% (🟡 +0.05%)
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.

@github-actions

Copy link
Copy Markdown

📦 Next.js Bundle Analysis for @app/client

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 266.48 KB (🟡 +480 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Twenty-six Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load % of Budget (450 KB)
/ 344.49 KB 610.97 KB 135.77% (🟡 +0.05%)
/404 221.93 KB 488.41 KB 108.54% (🟡 +0.05%)
/_error 226.84 KB 493.32 KB 109.63% (🟡 +0.05%)
/admin/emails 250.92 KB 517.4 KB 114.98% (🟡 +0.05%)
/admin/event-category/create 282.91 KB 549.39 KB 122.09% (🟡 +0.05%)
/admin/event-category/list 334.54 KB 601.02 KB 133.56% (🟡 +0.05%)
/admin/event-category/update/[id] 283.09 KB 549.57 KB 122.13% (🟡 +0.05%)
/admin/event/create 521.77 KB 788.25 KB 175.17% (🟡 +0.12%)
/admin/event/list 342.44 KB 608.92 KB 135.32% (🟡 +0.05%)
/admin/event/update/[id] 522.23 KB 788.71 KB 175.27% (🟡 +0.13%)
/admin/organization/[slug] 310.96 KB 577.44 KB 128.32% (🟡 +0.05%)
/admin/organization/create 259.77 KB 526.25 KB 116.95% (🟡 +0.05%)
/admin/users/list 334.83 KB 601.31 KB 133.62% (🟡 +0.06%)
/event/[slug] 367.25 KB 633.73 KB 140.83% (🟡 +0.06%)
/event/[slug]/register/[quotaId] 287.74 KB 554.22 KB 123.16% (🟡 +0.08%)
/forgot 239.69 KB 506.17 KB 112.48% (🟡 +0.05%)
/invitations/accept 223.48 KB 489.96 KB 108.88% (🟡 +0.05%)
/login 253.35 KB 519.83 KB 115.52% (🟡 +0.05%)
/reset 245.84 KB 512.32 KB 113.85% (🟡 +0.05%)
/settings/accounts 308.99 KB 575.47 KB 127.88% (🟡 +0.06%)
/settings/delete 243.46 KB 509.93 KB 113.32% (🟡 +0.05%)
/settings/emails 287.07 KB 553.55 KB 123.01% (🟡 +0.06%)
/settings/profile 249.4 KB 515.88 KB 114.64% (🟡 +0.15%)
/settings/security 255.75 KB 522.23 KB 116.05% (🟡 +0.06%)
/update-registration/[updateToken] 248.81 KB 515.29 KB 114.51% (🟡 +0.05%)
/verify 222.41 KB 488.89 KB 108.64% (🟡 +0.05%)
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.

Henrisal and others added 2 commits October 17, 2026 16:02
Registration prefilled only the name and email. Telegram handles and
dietary restrictions are asked with ordinary event questions, so an
admin can now mark a TEXT question as one or the other
(event_questions.prefill), and its answer is prefilled from the user's
registration profile.

The profile lives in its own table, readable only by its owner, because
app_public.users is publicly visible. Users edit it on the profile
settings page, and finishing a registration with one's own email saves
the non-empty answers to marked questions into it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Telegram and dietary restrictions are now options in the same type
select as Text, Radio and Checkbox instead of a separate prefill select
on TEXT questions. Picking one stores a TEXT question with `prefill`
set and fills in its label for every selected language, keeping labels
the admin has written themselves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

📦 Next.js Bundle Analysis for @app/client

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 266.48 KB (🟡 +480 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Twenty-six Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load % of Budget (450 KB)
/ 344.49 KB 610.97 KB 135.77% (🟡 +0.05%)
/404 221.93 KB 488.41 KB 108.54% (🟡 +0.05%)
/_error 226.84 KB 493.32 KB 109.63% (🟡 +0.05%)
/admin/emails 250.92 KB 517.4 KB 114.98% (🟡 +0.05%)
/admin/event-category/create 282.91 KB 549.39 KB 122.09% (🟡 +0.05%)
/admin/event-category/list 334.54 KB 601.02 KB 133.56% (🟡 +0.05%)
/admin/event-category/update/[id] 283.09 KB 549.57 KB 122.13% (🟡 +0.05%)
/admin/event/create 521.77 KB 788.25 KB 175.17% (🟡 +0.12%)
/admin/event/list 342.44 KB 608.92 KB 135.32% (🟡 +0.05%)
/admin/event/update/[id] 522.23 KB 788.71 KB 175.27% (🟡 +0.13%)
/admin/organization/[slug] 310.96 KB 577.44 KB 128.32% (🟡 +0.05%)
/admin/organization/create 259.77 KB 526.25 KB 116.95% (🟡 +0.05%)
/admin/users/list 334.83 KB 601.31 KB 133.62% (🟡 +0.06%)
/event/[slug] 367.25 KB 633.73 KB 140.83% (🟡 +0.06%)
/event/[slug]/register/[quotaId] 287.74 KB 554.22 KB 123.16% (🟡 +0.08%)
/forgot 239.69 KB 506.17 KB 112.48% (🟡 +0.05%)
/invitations/accept 223.48 KB 489.96 KB 108.88% (🟡 +0.05%)
/login 253.35 KB 519.83 KB 115.52% (🟡 +0.05%)
/reset 245.84 KB 512.32 KB 113.85% (🟡 +0.05%)
/settings/accounts 308.99 KB 575.47 KB 127.88% (🟡 +0.06%)
/settings/delete 243.46 KB 509.93 KB 113.32% (🟡 +0.05%)
/settings/emails 287.07 KB 553.55 KB 123.01% (🟡 +0.06%)
/settings/profile 249.4 KB 515.88 KB 114.64% (🟡 +0.15%)
/settings/security 255.75 KB 522.23 KB 116.05% (🟡 +0.06%)
/update-registration/[updateToken] 248.81 KB 515.29 KB 114.51% (🟡 +0.05%)
/verify 222.41 KB 488.89 KB 108.64% (🟡 +0.05%)
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.

@ccruzkauppila
ccruzkauppila changed the base branch from main to ilmo-hackathon-consolidation November 20, 2026 14:48
@ccruzkauppila
ccruzkauppila merged commit 7303c11 into ilmo-hackathon-consolidation Nov 20, 2026
14 checks passed
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