Skip to content

Commit dbb5316

Browse files
committed
Data model and storage layer for storing user registrations
1 parent e0f4882 commit dbb5316

20 files changed

+1423
-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: 23 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,24 @@ 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: 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 post_auth_action: Option<serde_json::Value>,
213+
pub ip_address: Option<IpAddr>,
214+
pub user_agent: Option<UserAgent>,
215+
pub created_at: DateTime<Utc>,
216+
pub completed_at: Option<DateTime<Utc>>,
217+
}

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-6772b17585f26365e70ec3e342100c6890d2d63f54f1306e1bb95ca6ca123777.json

Lines changed: 88 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-7fd19dac2c15091e7f8bd85531d2b99d8a42cc89fe7bb6e9411a886f68e38628.json renamed to crates/storage-pg/.sqlx/query-7e367e416d18fcf9b227bf053421410b4b7b4af441f0a138c5421d1111cb9f79.json

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-8d240d72d651f59d53bed7380710038e9d00492b1e282237c0ec0e03bc36a9c0.json

Lines changed: 19 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)