Skip to content

Commit d1f811f

Browse files
committed
feat: add phone number field to user model and signup
1 parent 3324305 commit d1f811f

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Airtable is heavily relied upon. You need the following tables (change the IDs i
5050
* `email` - primary, email
5151
* `first_name` - single line text
5252
* `last_name` - single line text
53+
* `phone` - phone number
5354
* `owned_event` - link to another record in the Events table
5455
* `attending_events` - link to another record in the Events table, multiple can be linked
5556
* `projects` - link to another record in the Projects table, multiple can be linked

backend/podium/db/user.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import datetime
22
from typing import Annotated, Optional
33
from pydantic import BaseModel, EmailStr, StringConstraints
4-
54
from podium import constants
65

76
from podium.db import tables
@@ -12,6 +11,9 @@ class UserBase(BaseModel):
1211
first_name: str
1312
last_name: str
1413
email: EmailStr
14+
# International phone number format
15+
phone: Annotated[str, StringConstraints(pattern=r"^\+[1-9]\d{1,14}$")]
16+
# phone: Annotated[str, StringConstraints(pattern=r"^\+?[1-9]\d{1,14}$")]
1517
street_1: str
1618
street_2: Optional[str] = ""
1719
city: str

frontend/src/lib/client/types.gen.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ export type User_Output = {
140140
first_name: string;
141141
last_name: string;
142142
email: string;
143+
phone: string;
143144
street_1: string;
144145
street_2?: (string | null);
145146
city: string;
@@ -171,6 +172,7 @@ export type UserSignupPayload = {
171172
first_name: string;
172173
last_name: string;
173174
email: string;
175+
phone: string;
174176
street_1: string;
175177
street_2?: (string | null);
176178
city: string;

frontend/src/routes/login/+page.svelte

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
email: "",
2121
first_name: "",
2222
last_name: "",
23+
phone: "",
2324
street_1: "",
2425
street_2: "",
2526
city: "",
@@ -111,6 +112,7 @@
111112
email: "",
112113
first_name: "",
113114
last_name: "",
115+
phone: "",
114116
street_1: "",
115117
street_2: "",
116118
city: "",
@@ -253,7 +255,21 @@
253255
bind:value={userInfo.last_name}
254256
/>
255257
</label>
256-
258+
<label class="form-control">
259+
<div class="label">
260+
<span class="label-text">Phone</span>
261+
<span class="label-text-alt text-warning">
262+
International format without spaces or special characters
263+
</span>
264+
</div>
265+
<input
266+
id="phone"
267+
type="tel"
268+
class="input input-bordered grow"
269+
placeholder="+15555555555"
270+
bind:value={userInfo.phone}
271+
/>
272+
</label>
257273
<label class="form-control">
258274
<div class="label">
259275
<span class="label-text">Address line 1</span>

0 commit comments

Comments
 (0)