Skip to content

Commit 73f2840

Browse files
committed
Data model and storage layer for storing user registrations
1 parent e49d5a3 commit 73f2840

21 files changed

+1489
-11
lines changed

crates/data-model/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@ pub use self::{
4848
users::{
4949
Authentication, AuthenticationMethod, BrowserSession, Password, User, UserEmail,
5050
UserEmailAuthentication, UserEmailAuthenticationCode, UserRecoverySession,
51-
UserRecoveryTicket,
51+
UserRecoveryTicket, UserRegistration, UserRegistrationPassword,
5252
},
5353
};

crates/data-model/src/users.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use chrono::{DateTime, Utc};
1010
use rand::Rng;
1111
use serde::Serialize;
1212
use ulid::Ulid;
13+
use url::Url;
1314

1415
use crate::UserAgent;
1516

@@ -112,6 +113,7 @@ impl UserRecoveryTicket {
112113
pub struct UserEmailAuthentication {
113114
pub id: Ulid,
114115
pub user_session_id: Option<Ulid>,
116+
pub user_registration_id: Option<Ulid>,
115117
pub email: String,
116118
pub created_at: DateTime<Utc>,
117119
pub completed_at: Option<DateTime<Utc>>,
@@ -192,3 +194,23 @@ impl UserEmail {
192194
]
193195
}
194196
}
197+
198+
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
199+
pub struct UserRegistrationPassword {
200+
pub hashed_password: String,
201+
pub version: u16,
202+
}
203+
204+
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
205+
pub struct UserRegistration {
206+
pub id: Ulid,
207+
pub username: Option<String>,
208+
pub display_name: Option<String>,
209+
pub terms_url: Option<Url>,
210+
pub email_authentication_id: Option<Ulid>,
211+
pub password: Option<UserRegistrationPassword>,
212+
pub ip_address: Option<IpAddr>,
213+
pub user_agent: Option<UserAgent>,
214+
pub created_at: DateTime<Utc>,
215+
pub completed_at: Option<DateTime<Utc>>,
216+
}

crates/storage-pg/.sqlx/query-0e1bce56e15751d82a622d532b279bfc50e22cb12ddf7495c7b0fedca61f9421.json

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/storage-pg/.sqlx/query-188a4aeef5a8b4bf3230c7176ded64d52804848df378dc74f8f54ec4404e094e.json

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/storage-pg/.sqlx/query-4968c60adef69c7215a7efe2021baffb050b2f475ae106155c2e2f210a81191a.json

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/storage-pg/.sqlx/query-7246c8ce575b97b349f281457d83866362043a7740b09f3754fa8f583d93a819.json

Lines changed: 82 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 10 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/storage-pg/.sqlx/query-83d1b0720dfde3209d77f1142aa19359913b8a934ca8a642b7bb43c9a7a58a6d.json

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/storage-pg/.sqlx/query-86cef19d7fc2ca255f0e58d3f68ac3e7cc3ce1f676f7b744d4a187a935a459ab.json

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/storage-pg/.sqlx/query-8f5ce493e8b8473ba03d5263915a8b231f9e7c211ab83487536008e48316c269.json

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)