We can't rely on the fact that the test won't run fast enough such that both `created_at`s are the same time. This ensures the subsequent signup happens after the initial one and that the database doesn't overwrite the initial one.
58 lines
1.7 KiB
Rust
58 lines
1.7 KiB
Rust
use super::{SignupId, UserId};
|
|
use sea_orm::{entity::prelude::*, FromQueryResult};
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
|
|
#[sea_orm(table_name = "signups")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key)]
|
|
pub id: SignupId,
|
|
pub email_address: String,
|
|
pub email_confirmation_code: String,
|
|
pub email_confirmation_sent: bool,
|
|
pub created_at: DateTime,
|
|
pub device_id: Option<String>,
|
|
pub user_id: Option<UserId>,
|
|
pub inviting_user_id: Option<UserId>,
|
|
pub platform_mac: bool,
|
|
pub platform_linux: bool,
|
|
pub platform_windows: bool,
|
|
pub platform_unknown: bool,
|
|
pub editor_features: Option<Vec<String>>,
|
|
pub programming_languages: Option<Vec<String>>,
|
|
pub added_to_mailing_list: bool,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq, FromQueryResult, Serialize, Deserialize)]
|
|
pub struct Invite {
|
|
pub email_address: String,
|
|
pub email_confirmation_code: String,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Deserialize)]
|
|
pub struct NewSignup {
|
|
pub email_address: String,
|
|
pub platform_mac: bool,
|
|
pub platform_windows: bool,
|
|
pub platform_linux: bool,
|
|
pub editor_features: Vec<String>,
|
|
pub programming_languages: Vec<String>,
|
|
pub device_id: Option<String>,
|
|
pub added_to_mailing_list: bool,
|
|
pub created_at: Option<DateTime>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize, FromQueryResult)]
|
|
pub struct WaitlistSummary {
|
|
pub count: i64,
|
|
pub linux_count: i64,
|
|
pub mac_count: i64,
|
|
pub windows_count: i64,
|
|
pub unknown_count: i64,
|
|
}
|