Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
Remove name field (and remove existing data) (#935)
Browse files Browse the repository at this point in the history
* Remove name field (and remove existing data)

* run prep, fmt

* fix dummy data
  • Loading branch information
Geometrically authored Sep 7, 2024
1 parent 637a923 commit 2e35f36
Show file tree
Hide file tree
Showing 14 changed files with 67 additions and 133 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

1 change: 1 addition & 0 deletions migrations/20240701213559_remove-user-names.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE users DROP COLUMN name;
1 change: 0 additions & 1 deletion src/auth/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ where
let user = User {
id: UserId::from(db_user.id),
username: db_user.username,
name: db_user.name,
email: db_user.email,
email_verified: Some(db_user.email_verified),
avatar_url: db_user.avatar_url,
Expand Down
9 changes: 3 additions & 6 deletions src/database/models/user_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ pub struct User {
pub totp_secret: Option<String>,

pub username: String,
pub name: Option<String>,
pub email: Option<String>,
pub email_verified: bool,
pub avatar_url: Option<String>,
Expand All @@ -57,7 +56,7 @@ impl User {
sqlx::query!(
"
INSERT INTO users (
id, username, name, email,
id, username, email,
avatar_url, bio, created,
github_id, discord_id, gitlab_id, google_id, steam_id, microsoft_id,
email_verified, password, paypal_id, paypal_country, paypal_email,
Expand All @@ -67,12 +66,11 @@ impl User {
$1, $2, $3, $4, $5,
$6, $7,
$8, $9, $10, $11, $12, $13,
$14, $15, $16, $17, $18, $19, $20
$14, $15, $16, $17, $18, $19
)
",
self.id as UserId,
&self.username,
self.name.as_ref(),
self.email.as_ref(),
self.avatar_url.as_ref(),
self.bio.as_ref(),
Expand Down Expand Up @@ -166,7 +164,7 @@ impl User {

let users = sqlx::query!(
"
SELECT id, name, email,
SELECT id, email,
avatar_url, username, bio,
created, role, badges,
balance,
Expand All @@ -189,7 +187,6 @@ impl User {
google_id: u.google_id,
steam_id: u.steam_id,
microsoft_id: u.microsoft_id,
name: u.name,
email: u.email,
email_verified: u.email_verified,
avatar_url: u.avatar_url,
Expand Down
2 changes: 1 addition & 1 deletion src/models/v2/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl From<crate::models::v3::users::User> for LegacyUser {
Self {
id: data.id,
username: data.username,
name: data.name,
name: None,
email: data.email,
email_verified: data.email_verified,
avatar_url: data.avatar_url,
Expand Down
2 changes: 0 additions & 2 deletions src/models/v3/users.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ impl Default for Badges {
pub struct User {
pub id: UserId,
pub username: String,
pub name: Option<String>,
pub avatar_url: Option<String>,
pub bio: Option<String>,
pub created: DateTime<Utc>,
Expand Down Expand Up @@ -73,7 +72,6 @@ impl From<DBUser> for User {
Self {
id: data.id.into(),
username: data.username,
name: data.name,
email: None,
email_verified: None,
avatar_url: data.avatar_url,
Expand Down
2 changes: 1 addition & 1 deletion src/routes/internal/billing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ pub async fn stripe_webhook(
let price = match metadata.product_price.prices {
Price::OneTime { price } => Some(price),
Price::Recurring { intervals } => {
if let Some((subscription_id, interval)) =
if let Some((_subscription_id, interval)) =
metadata.user_subscription_data
{
if let Some(mut user_subscription) = metadata.user_subscription {
Expand Down
Loading

0 comments on commit 2e35f36

Please sign in to comment.