mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-05 09:48:44 +00:00
tokens + enums - make sqlx optional (#708)
This commit is contained in:
1 parent
138ec975de
commit
fed32ce1fd
60 files changed
+237
-160
No files matched your search
@@ -8,45 +8,45 @@ authors = [
|
||||
]
|
||||
publish = false
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
normal = ["workspace-build-acceleration"]
|
||||
|
||||
[lib]
|
||||
name = "mysql_queries"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
normal = ["workspace-build-acceleration"]
|
||||
|
||||
[dependencies]
|
||||
# cargo-hakari workspace hack (faster compile times)
|
||||
workspace-build-acceleration = { workspace = true }
|
||||
workspace-build-acceleration.workspace = true
|
||||
|
||||
# Internal
|
||||
bucket_paths = { path = "../../../lib/bucket_paths" }
|
||||
composite_identifiers = { path = "../../../schema/public/composite_identifiers" }
|
||||
enums = { workspace = true }
|
||||
errors = { workspace = true }
|
||||
idempotency = { workspace = true }
|
||||
enums = { workspace = true, features = ["database"] }
|
||||
errors.workspace = true
|
||||
idempotency.workspace = true
|
||||
reusable_types = { path = "../../../schema/public/reusable_types" }
|
||||
tokens = { workspace = true }
|
||||
tokens = { workspace = true, features = ["database"] }
|
||||
|
||||
# External
|
||||
anyhow = { workspace = true }
|
||||
chrono = { workspace = true }
|
||||
log = { workspace = true }
|
||||
anyhow.workspace = true
|
||||
chrono.workspace = true
|
||||
log.workspace = true
|
||||
|
||||
# Needed to safety check some queries we can't use escaping for
|
||||
once_cell = { workspace = true }
|
||||
regex = { workspace = true }
|
||||
once_cell.workspace = true
|
||||
regex.workspace = true
|
||||
|
||||
# Serialization
|
||||
serde = { workspace = true }
|
||||
serde_derive = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
serde.workspace = true
|
||||
serde_derive.workspace = true
|
||||
serde_json.workspace = true
|
||||
|
||||
# BigNum
|
||||
num-traits = "0.2.19"
|
||||
|
||||
tokio = { version = "1.38.0", features = ["full"] }
|
||||
rand = { workspace = true }
|
||||
rand.workspace = true
|
||||
sqlx = { version = "0.7.2", features = [ "mysql", "runtime-tokio", "tls-rustls", "chrono", "bigdecimal" ] }
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
@@ -8,27 +8,31 @@ authors = [
|
||||
]
|
||||
publish = false
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
normal = ["workspace-build-acceleration"]
|
||||
|
||||
[lib]
|
||||
name = "enums"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
normal = ["workspace-build-acceleration"]
|
||||
[features]
|
||||
default = []
|
||||
database = ["sqlx", "sqlx-core", "sqlx-mysql"]
|
||||
|
||||
[dependencies]
|
||||
# Workspace hack (faster compile times)
|
||||
workspace-build-acceleration = { workspace = true }
|
||||
workspace-build-acceleration.workspace = true
|
||||
|
||||
# Internal
|
||||
# (None yet)
|
||||
|
||||
# Serialization
|
||||
serde = { workspace = true }
|
||||
serde_derive = { workspace = true }
|
||||
serde.workspace = true
|
||||
serde_derive.workspace = true
|
||||
|
||||
sqlx = { version = "0.7.2", features = [ "mysql", "sqlite", "runtime-tokio-native-tls", "chrono" ] }
|
||||
sqlx-core = { version = "0.7.2" }
|
||||
sqlx-mysql= { version = "0.7.2" }
|
||||
sqlx = { version = "0.7.2", features = [ "mysql", "runtime-tokio-native-tls", "chrono" ], optional = true }
|
||||
sqlx-core = { version = "0.7.2" , optional = true }
|
||||
sqlx-mysql = { version = "0.7.2" , optional = true }
|
||||
|
||||
utoipa = { version = "4", features = ["chrono","actix_extras"] }
|
||||
|
||||
@@ -38,5 +42,5 @@ utoipa = { version = "4", features = ["chrono","actix_extras"] }
|
||||
strum = { version = "0.26", features = ["derive"] }
|
||||
|
||||
# Test serialization
|
||||
serde_json = { workspace = true }
|
||||
toml = { workspace = true }
|
||||
serde_json.workspace = true
|
||||
toml.workspace = true
|
||||
+10
-9
@@ -15,24 +15,25 @@ use strum::EnumIter;
|
||||
///
|
||||
/// DO NOT CHANGE VALUES WITHOUT A MIGRATION STRATEGY.
|
||||
#[cfg_attr(test, derive(EnumIter, EnumCount))]
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Debug, Deserialize, Serialize, sqlx::Type, Hash, Ord, PartialOrd)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, Copy, Eq, PartialEq, Debug, Deserialize, Serialize, Hash, Ord, PartialOrd))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, Copy, Eq, PartialEq, Debug, Deserialize, Serialize, sqlx::Type, Hash, Ord, PartialOrd))]
|
||||
pub enum GenericDownloadType {
|
||||
/// NB: Note - this is hifigan for Tacotron2.
|
||||
/// Some work will be needed to unify this with other hifigan types.
|
||||
#[serde(rename = "hifigan")]
|
||||
#[sqlx(rename = "hifigan")]
|
||||
#[cfg_attr(feature = "database", sqlx(rename = "hifigan"))]
|
||||
HifiGan,
|
||||
|
||||
/// NB: Note - this is hifigan for SoftVC (our internal codename is "rocketvc").
|
||||
/// Some work will need to be done to unify this with other hifigan types.
|
||||
#[serde(rename = "hifigan_rocket_vc")]
|
||||
#[sqlx(rename = "hifigan_rocket_vc")]
|
||||
#[cfg_attr(feature = "database", sqlx(rename = "hifigan_rocket_vc"))]
|
||||
HifiGanRocketVc,
|
||||
|
||||
/// NB: Note - this is hifigan for SoVitsSvc
|
||||
/// Some work will need to be done to unify this with other hifigan types.
|
||||
#[serde(rename = "hifigan_so_vits_svc")]
|
||||
#[sqlx(rename = "hifigan_so_vits_svc")]
|
||||
#[cfg_attr(feature = "database", sqlx(rename = "hifigan_so_vits_svc"))]
|
||||
HifiGanSoVitsSvc,
|
||||
|
||||
//#[serde(rename = "melgan_vocodes")]
|
||||
@@ -42,27 +43,27 @@ pub enum GenericDownloadType {
|
||||
/// NB: Our external-facing name for "softvc" is rocketvc.
|
||||
/// I wish we could stop being stupid about this.
|
||||
#[serde(rename = "rocket_vc")]
|
||||
#[sqlx(rename = "rocket_vc")]
|
||||
#[cfg_attr(feature = "database", sqlx(rename = "rocket_vc"))]
|
||||
RocketVc,
|
||||
|
||||
/// RVC (v2) voice conversion models
|
||||
#[serde(rename = "rvc_v2")]
|
||||
#[sqlx(rename = "rvc_v2")]
|
||||
#[cfg_attr(feature = "database", sqlx(rename = "rvc_v2"))]
|
||||
RvcV2,
|
||||
|
||||
/// so-vits-svc voice conversion models
|
||||
#[serde(rename = "so_vits_svc")]
|
||||
#[sqlx(rename = "so_vits_svc")]
|
||||
#[cfg_attr(feature = "database", sqlx(rename = "so_vits_svc"))]
|
||||
SoVitsSvc,
|
||||
|
||||
/// Tacotron TTS models.
|
||||
#[serde(rename = "tacotron2")]
|
||||
#[sqlx(rename = "tacotron2")]
|
||||
#[cfg_attr(feature = "database", sqlx(rename = "tacotron2"))]
|
||||
Tacotron2,
|
||||
|
||||
/// VITS TTS models.
|
||||
#[serde(rename = "vits")]
|
||||
#[sqlx(rename = "vits")]
|
||||
#[cfg_attr(feature = "database", sqlx(rename = "vits"))]
|
||||
Vits,
|
||||
}
|
||||
|
||||
|
||||
@@ -18,9 +18,10 @@ use utoipa::ToSchema;
|
||||
/// *DO NOT CHANGE VALUES WITHOUT A MIGRATION STRATEGY!*
|
||||
///
|
||||
#[cfg_attr(test, derive(EnumIter, EnumCount))]
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Deserialize, Serialize, sqlx::Type, ToSchema)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, Copy, Eq, PartialEq, Deserialize, Serialize, ToSchema))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, Copy, Eq, PartialEq, Deserialize, Serialize, sqlx::Type, ToSchema))]
|
||||
#[cfg_attr(feature = "database", sqlx(rename_all = "lowercase"))]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
#[sqlx(rename_all = "lowercase")]
|
||||
pub enum UserRatingValue {
|
||||
/// This is considered a ratings "soft deletion" and does not count towards a total score.
|
||||
/// This is the default rating.
|
||||
|
||||
@@ -19,9 +19,10 @@ use strum::EnumIter;
|
||||
/// DO NOT CHANGE VALUES WITHOUT A MIGRATION STRATEGY.
|
||||
|
||||
#[cfg_attr(test, derive(EnumIter, EnumCount))]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Ord, PartialOrd, Serialize, Deserialize, sqlx::Type)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, Copy, PartialEq, Eq, Hash, Ord, PartialOrd, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, Copy, PartialEq, Eq, Hash, Ord, PartialOrd, Serialize, Deserialize, sqlx::Type))]
|
||||
#[cfg_attr(feature = "database", sqlx(rename_all = "snake_case"))]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[sqlx(rename_all = "snake_case")]
|
||||
pub enum JobStatus {
|
||||
Pending,
|
||||
Started,
|
||||
|
||||
@@ -5,9 +5,10 @@ use strum::EnumIter;
|
||||
use utoipa::ToSchema;
|
||||
|
||||
#[cfg_attr(test, derive(EnumIter, EnumCount))]
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Deserialize, Serialize, sqlx::Type,ToSchema)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, Copy, Eq, PartialEq, Deserialize, Serialize, ToSchema))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, Copy, Eq, PartialEq, Deserialize, Serialize, sqlx::Type,ToSchema))]
|
||||
#[cfg_attr(feature = "database", sqlx(rename_all = "snake_case"))]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[sqlx(rename_all = "snake_case")]
|
||||
pub enum ViewAs {
|
||||
/// Public entities are able to be listed in public lists.
|
||||
/// It does not mean that they necessarily will be (eg. they could be "mod unapproved" or deleted).
|
||||
|
||||
@@ -18,9 +18,10 @@ use strum::EnumIter;
|
||||
use utoipa::ToSchema;
|
||||
|
||||
#[cfg_attr(test, derive(EnumIter, EnumCount))]
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Deserialize, Serialize, sqlx::Type,ToSchema)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, Copy, Eq, PartialEq, Deserialize, Serialize, ToSchema))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, Copy, Eq, PartialEq, Deserialize, Serialize, sqlx::Type, ToSchema))]
|
||||
#[cfg_attr(feature = "database", sqlx(rename_all = "lowercase"))]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
#[sqlx(rename_all = "lowercase")]
|
||||
pub enum Visibility {
|
||||
/// Public entities are able to be listed in public lists.
|
||||
/// It does not mean that they necessarily will be (eg. they could be "mod unapproved" or deleted).
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Debug, Deserialize, Serialize, sqlx::Type)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, Copy, Eq, PartialEq, Debug, Deserialize, Serialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, Copy, Eq, PartialEq, Debug, Deserialize, Serialize, sqlx::Type))]
|
||||
pub enum VocoderType {
|
||||
/// NB: Note - this is hifigan for Tacotron2.
|
||||
/// Some work will be needed to unify this with other hifigan types.
|
||||
#[serde(rename = "hifigan")]
|
||||
#[sqlx(rename = "hifigan")]
|
||||
#[cfg_attr(feature = "database", sqlx(rename = "hifigan"))]
|
||||
HifiGan,
|
||||
|
||||
#[serde(rename = "hifigan-superres")]
|
||||
#[sqlx(rename = "hifigan-superres")]
|
||||
#[cfg_attr(feature = "database", sqlx(rename = "hifigan-superres"))]
|
||||
HifiGanSuperResolution,
|
||||
|
||||
/// NB: Note - this is hifigan for SoftVC (our internal codename is "rocketvc").
|
||||
/// Some work will need to be done to unify this with other hifigan types.
|
||||
/// NB(bt, 2025-07-09): It was so silly to try to obscure this. Both FakeYou and Uberduck are irrelevant now.
|
||||
#[serde(rename = "hifigan_rocket_vc")]
|
||||
#[sqlx(rename = "hifigan_rocket_vc")]
|
||||
#[cfg_attr(feature = "database", sqlx(rename = "hifigan_rocket_vc"))]
|
||||
HifiGanRocketVc,
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#[cfg(feature = "database")]
|
||||
/// This overt approach is being taken because of the following error:
|
||||
///
|
||||
/// `MySqlDatabaseError { code: Some("HY000"), number: 1210, message: "Incorrect arguments to mysqld_stmt_execute" }`
|
||||
@@ -59,3 +60,9 @@ macro_rules! impl_mysql_enum_coders {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "database"))]
|
||||
macro_rules! impl_mysql_enum_coders {
|
||||
($t:ident) => {
|
||||
// Intentionally empty
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
|
||||
#[cfg(feature = "database")]
|
||||
/// Implement `MySqlFromRow` on a type.
|
||||
macro_rules! impl_mysql_from_row {
|
||||
($t:ident) => {
|
||||
@@ -61,3 +62,10 @@ macro_rules! impl_mysql_from_row {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "database"))]
|
||||
macro_rules! impl_mysql_from_row {
|
||||
($t:ident) => {
|
||||
// Intentionally empty
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
#[cfg(feature = "database")]
|
||||
/// This overt approach is being taken because of the following error:
|
||||
///
|
||||
/// `MySqlDatabaseError { code: Some("HY000"), number: 1210, message: "Incorrect arguments to mysqld_stmt_execute" }`
|
||||
@@ -47,3 +48,9 @@ macro_rules! impl_sqlite_enum_coders {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "database"))]
|
||||
macro_rules! impl_sqlite_enum_coders {
|
||||
($t:ident) => {
|
||||
// Intentionally empty
|
||||
}
|
||||
}
|
||||
@@ -1 +1,2 @@
|
||||
#[cfg(feature = "database")]
|
||||
pub mod mysql_from_row;
|
||||
@@ -8,32 +8,36 @@ authors = [
|
||||
]
|
||||
publish = false
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
normal = ["workspace-build-acceleration"]
|
||||
|
||||
[lib]
|
||||
name = "tokens"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
normal = ["workspace-build-acceleration"]
|
||||
[features]
|
||||
default = []
|
||||
database = ["sqlx", "sqlx-core", "sqlx-mysql"]
|
||||
|
||||
[dependencies]
|
||||
# Workspace hack (faster compile times)
|
||||
workspace-build-acceleration = { workspace = true }
|
||||
workspace-build-acceleration.workspace = true
|
||||
|
||||
# Internal
|
||||
# (none)
|
||||
|
||||
# Serialization
|
||||
serde = { workspace = true }
|
||||
serde_derive = { workspace = true }
|
||||
serde.workspace = true
|
||||
serde_derive.workspace = true
|
||||
|
||||
# Random
|
||||
rand = { version = "0.8.5", features = ["std_rng"] }
|
||||
|
||||
once_cell = { workspace = true }
|
||||
once_cell.workspace = true
|
||||
|
||||
sqlx = { version = "0.7.2", features = [ "mysql", "runtime-tokio", "tls-rustls", "chrono" ] }
|
||||
sqlx-core = { version = "0.7.2" }
|
||||
sqlx-mysql= { version = "0.7.2" }
|
||||
sqlx = { version = "0.7.2", features = [ "mysql", "runtime-tokio", "tls-rustls", "chrono" ], optional = true }
|
||||
sqlx-core = { version = "0.7.2", optional = true }
|
||||
sqlx-mysql= { version = "0.7.2", optional = true }
|
||||
|
||||
utoipa = { version = "4", features = ["chrono","actix_extras"] }
|
||||
|
||||
@@ -43,4 +47,4 @@ utoipa = { version = "4", features = ["chrono","actix_extras"] }
|
||||
strum = { version = "0.26", features = ["derive"] }
|
||||
|
||||
# Test serialization
|
||||
serde_json = { workspace = true }
|
||||
serde_json.workspace = true
|
||||
@@ -1,4 +1,5 @@
|
||||
|
||||
#[cfg(feature = "database")]
|
||||
/// Implement `MySqlTokenFromRow` on a type.
|
||||
macro_rules! impl_mysql_token_from_row {
|
||||
($t:ident) => {
|
||||
@@ -45,3 +46,10 @@ macro_rules! impl_mysql_token_from_row {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "database"))]
|
||||
macro_rules! impl_mysql_token_from_row {
|
||||
($t:ident) => {
|
||||
// Intentionally empty
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,9 @@ use crate::prefixes::TokenPrefix;
|
||||
/// A rare instance that is *not* a primary key.
|
||||
/// These are generated as cookies to track users for a better logged out experience and for analytics.
|
||||
/// We use these as indices into several columns (ML result types, uploads, etc.)
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize, Default)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize, Default))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize, Default))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct AnonymousVisitorTrackingToken(pub String);
|
||||
|
||||
impl_crockford_generator!(AnonymousVisitorTrackingToken, 32usize, TokenPrefix::AnonymousVisitorTracking, CrockfordLower);
|
||||
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::LegacyTokenPrefix;
|
||||
|
||||
/// External-facing key for the `api_tokens` table.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct ApiTokenExternal(pub String);
|
||||
|
||||
impl_string_token!(ApiTokenExternal);
|
||||
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::LegacyTokenPrefix;
|
||||
|
||||
/// Internal token for the `api_tokens` table.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct ApiTokenInternal(pub String);
|
||||
|
||||
impl_string_token!(ApiTokenInternal);
|
||||
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::TokenPrefix;
|
||||
|
||||
/// The primary key for Audit Logs.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct AuditLogToken(pub String);
|
||||
|
||||
impl_string_token!(AuditLogToken);
|
||||
|
||||
@@ -7,8 +7,9 @@ use utoipa::ToSchema;
|
||||
use crate::prefixes::TokenPrefix;
|
||||
|
||||
/// The primary key for Audit Logs.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize, ToSchema)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize, ToSchema))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize, ToSchema))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct BatchGenerationToken(pub String);
|
||||
|
||||
impl_crockford_generator!(BatchGenerationToken, 32usize, TokenPrefix::BatchGeneration, CrockfordLower);
|
||||
|
||||
@@ -7,8 +7,9 @@ use utoipa::ToSchema;
|
||||
use crate::prefixes::TokenPrefix;
|
||||
|
||||
/// The primary key for Audit Logs.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize, ToSchema)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize, ToSchema))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize, ToSchema))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct BetaKeyToken(pub String);
|
||||
|
||||
impl_crockford_generator!(BetaKeyToken, 32usize, TokenPrefix::BetaKey, CrockfordLower);
|
||||
|
||||
@@ -7,8 +7,9 @@ use utoipa::ToSchema;
|
||||
use crate::prefixes::TokenPrefix;
|
||||
|
||||
/// The primary key for Audit Logs.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize, ToSchema)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize, ToSchema))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize, ToSchema))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct BrowserSessionLogToken(pub String);
|
||||
|
||||
impl_crockford_generator!(BrowserSessionLogToken, 32usize, TokenPrefix::BrowserSessionLog, CrockfordLower);
|
||||
|
||||
@@ -7,8 +7,9 @@ use utoipa::ToSchema;
|
||||
use crate::prefixes::TokenPrefix;
|
||||
|
||||
/// The primary key for Audit Logs.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize, ToSchema)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize, ToSchema))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize, ToSchema))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct CommentToken(pub String);
|
||||
|
||||
impl_string_token!(CommentToken);
|
||||
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::TokenPrefix;
|
||||
|
||||
/// The primary key for email_sender_jobs
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct EmailSenderJobToken(pub String);
|
||||
|
||||
impl_string_token!(EmailSenderJobToken);
|
||||
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::LegacyTokenPrefix;
|
||||
|
||||
/// Primary key for the `firehose_entries` table.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct FirehoseEntryToken(pub String);
|
||||
|
||||
impl_string_token!(FirehoseEntryToken);
|
||||
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::TokenPrefix;
|
||||
|
||||
/// The primary key for "generic" inference jobs.
|
||||
#[derive(Clone, PartialEq, Eq, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct DownloadJobToken(String);
|
||||
|
||||
impl_string_token!(DownloadJobToken);
|
||||
|
||||
@@ -7,8 +7,9 @@ use utoipa::ToSchema;
|
||||
use crate::prefixes::TokenPrefix;
|
||||
|
||||
/// The primary key for "generic" inference jobs.
|
||||
#[derive(Clone, PartialEq, Eq, sqlx::Type, Debug, Serialize, Deserialize, Default, ToSchema)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize, Default, ToSchema))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, sqlx::Type, Debug, Serialize, Deserialize, Default, ToSchema))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct InferenceJobToken(String);
|
||||
|
||||
impl_crockford_generator!(InferenceJobToken, 32usize, TokenPrefix::InferenceJob, CrockfordLower);
|
||||
|
||||
@@ -7,8 +7,9 @@ use utoipa::ToSchema;
|
||||
use crate::prefixes::TokenPrefix;
|
||||
|
||||
/// The primary key for google_sign_in_accounts
|
||||
#[derive(Clone, PartialEq, Eq, sqlx::Type, Debug, Serialize, Deserialize, Default, ToSchema)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize, Default, ToSchema))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, sqlx::Type, Debug, Serialize, Deserialize, Default, ToSchema))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct GoogleSignInAccountToken(String);
|
||||
|
||||
impl_crockford_generator!(GoogleSignInAccountToken, 32usize, TokenPrefix::GoogleSignInAccount, CrockfordLower);
|
||||
|
||||
@@ -7,8 +7,9 @@ use utoipa::ToSchema;
|
||||
use crate::prefixes::TokenPrefix;
|
||||
|
||||
/// The primary key for Media Files
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize, ToSchema)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize, ToSchema))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize, ToSchema))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct MediaFileToken(pub String);
|
||||
|
||||
impl_string_token!(MediaFileToken);
|
||||
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::TokenPrefix;
|
||||
|
||||
/// The primary key for user media uploads (images, video, etc.)
|
||||
#[derive(Clone, PartialEq, Eq, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct MediaUploadToken(pub String);
|
||||
|
||||
impl_string_token!(MediaUploadToken);
|
||||
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::LegacyTokenPrefix;
|
||||
|
||||
/// The primary key for model categories.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct ModelCategoryToken(pub String);
|
||||
|
||||
impl_string_token!(ModelCategoryToken);
|
||||
|
||||
@@ -7,8 +7,9 @@ use utoipa::ToSchema;
|
||||
use crate::prefixes::TokenPrefix;
|
||||
|
||||
/// The primary key for the "model_weights" table.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize,ToSchema)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize,ToSchema))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize,ToSchema))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct ModelWeightToken(pub String);
|
||||
|
||||
impl_crockford_generator!(ModelWeightToken, 32usize, TokenPrefix::ModelWeight, CrockfordLower);
|
||||
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::TokenPrefix;
|
||||
|
||||
/// The primary key for `password_reset`s
|
||||
#[derive(Clone, PartialEq, Eq, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct PasswordResetToken(pub String);
|
||||
|
||||
impl_string_token!(PasswordResetToken);
|
||||
|
||||
@@ -7,8 +7,9 @@ use utoipa::ToSchema;
|
||||
use crate::prefixes::TokenPrefix;
|
||||
|
||||
/// The primary key for Prompts
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize, ToSchema)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize, ToSchema))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize, ToSchema))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct PromptToken(pub String);
|
||||
|
||||
impl_crockford_generator!(PromptToken, 32usize, TokenPrefix::Prompt, CrockfordLower);
|
||||
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::TokenPrefix;
|
||||
|
||||
/// The primary key for news stories (Sqlite)
|
||||
#[derive(Clone, PartialEq, Eq, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct NewsStoryToken(pub String);
|
||||
|
||||
impl_string_token!(NewsStoryToken);
|
||||
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::TokenPrefix;
|
||||
|
||||
/// The primary key for TTS render tasks (Sqlite / AiChatBotSidecar)
|
||||
#[derive(Clone, PartialEq, Eq, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct TtsRenderTaskToken(pub String);
|
||||
|
||||
impl_string_token!(TtsRenderTaskToken);
|
||||
|
||||
@@ -7,8 +7,9 @@ use utoipa::ToSchema;
|
||||
use crate::prefixes::TokenPrefix;
|
||||
|
||||
/// The primary key for Prompts
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize, ToSchema)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize, ToSchema))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize, ToSchema))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct TagToken(pub String);
|
||||
|
||||
impl_crockford_generator!(TagToken, 32usize, TokenPrefix::Tag, CrockfordLower);
|
||||
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::LegacyTokenPrefix;
|
||||
|
||||
/// Primary key for the `tts_inference_jobs` table.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct TtsInferenceJobToken(pub String);
|
||||
|
||||
impl_string_token!(TtsInferenceJobToken);
|
||||
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::LegacyTokenPrefix;
|
||||
|
||||
/// Primary key for the `tts_model_upload_jobs` table.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct TtsModelUploadJobToken(pub String);
|
||||
|
||||
impl_string_token!(TtsModelUploadJobToken);
|
||||
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::LegacyTokenPrefix;
|
||||
|
||||
/// The primary key for TTS models.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct TtsModelToken(pub String);
|
||||
|
||||
impl_string_token!(TtsModelToken);
|
||||
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::LegacyTokenPrefix;
|
||||
|
||||
/// Primary key for the `tts_results` table.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct TtsResultToken(pub String);
|
||||
|
||||
impl_string_token!(TtsResultToken);
|
||||
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::LegacyTokenPrefix;
|
||||
|
||||
/// primary key token for the `twitch_event_rules` table (this is deprecated)
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct TwitchEventRuleToken(pub String);
|
||||
|
||||
impl_string_token!(TwitchEventRuleToken);
|
||||
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::LegacyTokenPrefix;
|
||||
|
||||
/// "grouping token" for the `twitch_oauth_tokens` table (this is deprecated)
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct TwitchOauthGroupingToken(pub String);
|
||||
|
||||
impl_string_token!(TwitchOauthGroupingToken);
|
||||
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::LegacyTokenPrefix;
|
||||
|
||||
/// "internal token" for the `twitch_oauth_tokens` table (this is deprecated)
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct TwitchOauthInternalToken(pub String);
|
||||
|
||||
impl_string_token!(TwitchOauthInternalToken);
|
||||
|
||||
@@ -7,8 +7,9 @@ use utoipa::ToSchema;
|
||||
use crate::prefixes::TokenPrefix;
|
||||
|
||||
/// The primary key for Audit Logs.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize, ToSchema)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize, ToSchema))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize, ToSchema))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct UserBookmarkToken(pub String);
|
||||
|
||||
impl_string_token!(UserBookmarkToken);
|
||||
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::TokenPrefix;
|
||||
|
||||
/// Primary key for the `user_sessions` table.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct UserSessionToken(pub String);
|
||||
|
||||
impl_string_token!(UserSessionToken);
|
||||
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::LegacyTokenPrefix;
|
||||
|
||||
/// Primary key for the `user_subscriptions` table.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct UserSubscriptionToken(pub String);
|
||||
|
||||
impl_string_token!(UserSubscriptionToken);
|
||||
|
||||
@@ -7,8 +7,9 @@ use utoipa::ToSchema;
|
||||
use crate::prefixes::TokenPrefix;
|
||||
|
||||
/// The primary key for users.
|
||||
#[derive(Clone, PartialEq, Eq, sqlx::Type, Debug, Serialize, Deserialize, Default,ToSchema)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize, Default,ToSchema))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, sqlx::Type, Debug, Serialize, Deserialize, Default,ToSchema))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct UserToken(pub String);
|
||||
|
||||
impl_mysql_token_from_row!(UserToken);
|
||||
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::LegacyTokenPrefix;
|
||||
|
||||
/// The primary key for the `vocoder_models` table
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct VocoderModelToken(pub String);
|
||||
|
||||
impl_string_token!(VocoderModelToken);
|
||||
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::LegacyTokenPrefix;
|
||||
|
||||
/// Primary key for the `voice_clone_requests` table.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct VoiceCloneRequestToken(pub String);
|
||||
|
||||
impl_string_token!(VoiceCloneRequestToken);
|
||||
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::TokenPrefix;
|
||||
|
||||
/// The primary key for "generic" inference jobs.
|
||||
#[derive(Clone, PartialEq, Eq, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct VoiceConversionModelToken(pub String);
|
||||
|
||||
impl_string_token!(VoiceConversionModelToken);
|
||||
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::TokenPrefix;
|
||||
|
||||
/// The primary key for model categories.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct VoiceConversionResultToken(pub String);
|
||||
|
||||
impl_string_token!(VoiceConversionResultToken);
|
||||
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::LegacyTokenPrefix;
|
||||
|
||||
/// Primary key for the `w2l_inference_jobs` table.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct W2lInferenceJobToken(pub String);
|
||||
|
||||
impl_string_token!(W2lInferenceJobToken);
|
||||
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::LegacyTokenPrefix;
|
||||
|
||||
/// Primary key for the `w2l_results` table.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct W2lResultToken(pub String);
|
||||
|
||||
impl_string_token!(W2lResultToken);
|
||||
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::LegacyTokenPrefix;
|
||||
|
||||
/// Primary key for the `w2l_template_upload_jobs` table.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct W2lTemplateUploadJobToken(pub String);
|
||||
|
||||
impl_string_token!(W2lTemplateUploadJobToken);
|
||||
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::LegacyTokenPrefix;
|
||||
|
||||
/// The primary key for W2L templates.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct W2lTemplateToken(pub String);
|
||||
|
||||
impl_string_token!(W2lTemplateToken);
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
use std::fmt::Debug;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::prefixes::TokenPrefix;
|
||||
|
||||
/// The primary key for user weight uploads
|
||||
#[derive(Clone, PartialEq, Eq, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
pub struct WeightUploadToken(pub String);
|
||||
|
||||
impl_string_token!(WeightUploadToken);
|
||||
impl_crockford_generator!(WeightUploadToken, 32usize, TokenPrefix::WeightUpload, CrockfordLower);
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::TokenPrefix;
|
||||
|
||||
/// The primary key for the "zs_voice_dataset_samples" table.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct ZsVoiceDatasetSampleToken(pub String);
|
||||
|
||||
impl_string_token!(ZsVoiceDatasetSampleToken);
|
||||
|
||||
@@ -7,8 +7,9 @@ use utoipa::ToSchema;
|
||||
use crate::prefixes::TokenPrefix;
|
||||
|
||||
/// The primary key for the "zs_voice_datasets" table.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize, ToSchema)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize, ToSchema))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize, ToSchema))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct ZsVoiceDatasetToken(pub String);
|
||||
|
||||
impl_string_token!(ZsVoiceDatasetToken);
|
||||
|
||||
@@ -6,8 +6,9 @@ use serde::Serialize;
|
||||
use crate::prefixes::TokenPrefix;
|
||||
|
||||
/// The primary key for the "zs_voices" table.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
#[cfg_attr(not(feature = "database"), derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "database", sqlx(transparent))]
|
||||
pub struct ZsVoiceToken(pub String);
|
||||
|
||||
impl_string_token!(ZsVoiceToken);
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
#[cfg(feature = "database")]
|
||||
pub mod mysql_token_from_row;
|
||||
Reference in new issue
Block a user