upgrade dependencies (Rust)
Co-authored-by: Namekuji <nmkj@waah.day>
This commit is contained in:
parent
a5bf9da0da
commit
d240f8f4c3
90 changed files with 1482 additions and 2103 deletions
2155
packages/backend/native-utils/Cargo.lock
generated
2155
packages/backend/native-utils/Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -8,40 +8,39 @@ members = ["migration"]
|
|||
|
||||
[features]
|
||||
default = []
|
||||
noarray = []
|
||||
napi = ["dep:napi", "dep:napi-derive"]
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib", "lib"]
|
||||
|
||||
[dependencies]
|
||||
async-trait = "0.1.68"
|
||||
async-trait = "0.1.75"
|
||||
cfg-if = "1.0.0"
|
||||
chrono = "0.4.24"
|
||||
cuid2 = "0.1.0"
|
||||
chrono = "0.4.31"
|
||||
cuid2 = "0.1.2"
|
||||
derive_more = "0.99.17"
|
||||
jsonschema = "0.17.0"
|
||||
once_cell = "1.17.1"
|
||||
parse-display = "0.8.0"
|
||||
jsonschema = "0.17.1"
|
||||
once_cell = "1.19.0"
|
||||
parse-display = "0.8.2"
|
||||
rand = "0.8.5"
|
||||
schemars = { version = "0.8.12", features = ["chrono"] }
|
||||
sea-orm = { version = "0.11.3", features = ["sqlx-postgres", "postgres-array", "sqlx-sqlite", "runtime-tokio-rustls"] }
|
||||
serde = { version = "1.0.163", features = ["derive"] }
|
||||
serde_json = "1.0.96"
|
||||
thiserror = "1.0.40"
|
||||
tokio = { version = "1.28.1", features = ["full"] }
|
||||
utoipa = "3.3.0"
|
||||
schemars = { version = "0.8.16", features = ["chrono"] }
|
||||
sea-orm = { version = "0.12.10", features = ["sqlx-postgres", "runtime-tokio-rustls"] }
|
||||
serde = { version = "1.0.193", features = ["derive"] }
|
||||
serde_json = "1.0.108"
|
||||
thiserror = "1.0.52"
|
||||
tokio = { version = "1.35.1", features = ["full"] }
|
||||
utoipa = "4.1.0"
|
||||
|
||||
# Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
|
||||
napi = { version = "2.13.1", default-features = false, features = ["napi6", "tokio_rt"], optional = true }
|
||||
napi-derive = { version = "2.12.0", optional = true }
|
||||
napi = { version = "2.14.1", default-features = false, features = ["napi6", "tokio_rt"], optional = true }
|
||||
napi-derive = { version = "2.14.5", optional = true }
|
||||
basen = "0.1.0"
|
||||
|
||||
[dev-dependencies]
|
||||
pretty_assertions = "1.3.0"
|
||||
pretty_assertions = "1.4.0"
|
||||
|
||||
[build-dependencies]
|
||||
napi-build = "2.0.1"
|
||||
napi-build = "2.1.0"
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
||||
|
|
|
@ -13,26 +13,25 @@ default = []
|
|||
convert = ["dep:native-utils", "dep:indicatif", "dep:futures"]
|
||||
|
||||
[dependencies]
|
||||
serde_json = "1.0.96"
|
||||
serde_json = "1.0.108"
|
||||
native-utils = { path = "../", optional = true }
|
||||
indicatif = { version = "0.17.4", features = ["tokio"], optional = true }
|
||||
tokio = { version = "1.28.2", features = ["full"] }
|
||||
futures = { version = "0.3.28", optional = true }
|
||||
serde_yaml = "0.9.21"
|
||||
serde = { version = "1.0.163", features = ["derive"] }
|
||||
urlencoding = "2.1.2"
|
||||
redis = { version = "0.23.0", features = ["tokio-rustls-comp"] }
|
||||
sea-orm = "0.11.3"
|
||||
url = { version = "2.4.0", features = ["serde"] }
|
||||
indicatif = { version = "0.17.7", features = ["tokio"], optional = true }
|
||||
tokio = { version = "1.35.1", features = ["full"] }
|
||||
futures = { version = "0.3.30", optional = true }
|
||||
serde_yaml = "0.9.29"
|
||||
serde = { version = "1.0.193", features = ["derive"] }
|
||||
urlencoding = "2.1.3"
|
||||
redis = { version = "0.24.0", features = ["tokio-rustls-comp"] }
|
||||
sea-orm = "0.12.10"
|
||||
url = { version = "2.5.0", features = ["serde"] }
|
||||
basen = "0.1.0"
|
||||
|
||||
[dependencies.sea-orm-migration]
|
||||
version = "0.11.0"
|
||||
version = "0.12.10"
|
||||
features = [
|
||||
# Enable at least one `ASYNC_RUNTIME` and `DATABASE_DRIVER` feature if you want to run migration via CLI.
|
||||
# View the list of supported features at https://www.sea-ql.org/SeaORM/docs/install-and-config/database-and-async-runtime.
|
||||
# e.g.
|
||||
"runtime-tokio-rustls", # `ASYNC_RUNTIME` feature
|
||||
"sqlx-postgres", # `DATABASE_DRIVER` feature
|
||||
"sqlx-sqlite",
|
||||
]
|
||||
|
|
|
@ -46,6 +46,6 @@
|
|||
"lint": "cargo clippy --fix --allow-dirty --allow-staged && cargo fmt --all --",
|
||||
"cargo:test": "pnpm run cargo:unit && pnpm run cargo:integration",
|
||||
"cargo:unit": "cargo test unit_test && cargo test -F napi unit_test",
|
||||
"cargo:integration": "cargo test -F noarray int_test -- --test-threads=1"
|
||||
"cargo:integration": "cargo test int_test"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
pub mod error;
|
||||
|
||||
use cfg_if::cfg_if;
|
||||
use error::Error;
|
||||
use sea_orm::{Database, DbConn};
|
||||
|
||||
|
@ -16,17 +15,6 @@ pub fn get_database() -> Result<&'static DbConn, Error> {
|
|||
DB_CONN.get().ok_or(Error::Uninitialized)
|
||||
}
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "napi")] {
|
||||
use napi_derive::napi;
|
||||
|
||||
#[napi]
|
||||
pub async fn native_init_database(conn_uri: String) -> napi::Result<()> {
|
||||
init_database(conn_uri).await.map_err(Into::into)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod unit_test {
|
||||
use super::{error::Error, get_database};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use napi::{bindgen_prelude::*, Error, Status};
|
||||
use napi::{Error, Status};
|
||||
use napi_derive::napi;
|
||||
|
||||
static CHAR_COLLECTION: &str = "0123456789abcdefghijklmnopqrstuvwxyz";
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "abuse_user_report")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
use super::newtype::StringVec;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "access_token")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
@ -24,7 +22,7 @@ pub struct Model {
|
|||
pub description: Option<String>,
|
||||
#[sea_orm(column_name = "iconUrl")]
|
||||
pub icon_url: Option<String>,
|
||||
pub permission: StringVec,
|
||||
pub permission: Vec<String>,
|
||||
pub fetched: bool,
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "ad")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "announcement")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "announcement_read")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use super::{newtype, sea_orm_active_enums::AntennaSrcEnum};
|
||||
use super::sea_orm_active_enums::AntennaSrcEnum;
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "antenna")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
@ -17,7 +17,7 @@ pub struct Model {
|
|||
#[sea_orm(column_name = "userListId")]
|
||||
pub user_list_id: Option<String>,
|
||||
#[sea_orm(column_type = "JsonBinary")]
|
||||
pub keywords: newtype::JsonKeyword,
|
||||
pub keywords: Json,
|
||||
#[sea_orm(column_name = "withFile")]
|
||||
pub with_file: bool,
|
||||
pub expression: Option<String>,
|
||||
|
@ -28,11 +28,11 @@ pub struct Model {
|
|||
pub with_replies: bool,
|
||||
#[sea_orm(column_name = "userGroupJoiningId")]
|
||||
pub user_group_joining_id: Option<String>,
|
||||
pub users: newtype::StringVec,
|
||||
pub users: Vec<String>,
|
||||
#[sea_orm(column_name = "excludeKeywords", column_type = "JsonBinary")]
|
||||
pub exclude_keywords: newtype::JsonKeyword,
|
||||
pub exclude_keywords: Json,
|
||||
#[sea_orm(column_type = "JsonBinary")]
|
||||
pub instances: newtype::JsonStringVec,
|
||||
pub instances: Json,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
use super::newtype::StringVec;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "app")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
@ -16,7 +14,7 @@ pub struct Model {
|
|||
pub secret: String,
|
||||
pub name: String,
|
||||
pub description: String,
|
||||
pub permission: StringVec,
|
||||
pub permission: Vec<String>,
|
||||
#[sea_orm(column_name = "callbackUrl")]
|
||||
pub callback_url: Option<String>,
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "attestation_challenge")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "auth_session")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "blocking")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "channel")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "channel_following")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "channel_note_pining")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "clip")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "clip_note")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "drive_file")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "drive_folder")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
use super::newtype::StringVec;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "emoji")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
@ -17,7 +15,7 @@ pub struct Model {
|
|||
pub original_url: String,
|
||||
pub uri: Option<String>,
|
||||
pub r#type: Option<String>,
|
||||
pub aliases: StringVec,
|
||||
pub aliases: Vec<String>,
|
||||
pub category: Option<String>,
|
||||
#[sea_orm(column_name = "publicUrl")]
|
||||
pub public_url: String,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "follow_request")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "following")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "gallery_like")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
use super::newtype::StringVec;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "gallery_post")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
@ -18,12 +16,12 @@ pub struct Model {
|
|||
#[sea_orm(column_name = "userId")]
|
||||
pub user_id: String,
|
||||
#[sea_orm(column_name = "fileIds")]
|
||||
pub file_ids: StringVec,
|
||||
pub file_ids: Vec<String>,
|
||||
#[sea_orm(column_name = "isSensitive")]
|
||||
pub is_sensitive: bool,
|
||||
#[sea_orm(column_name = "likedCount")]
|
||||
pub liked_count: i32,
|
||||
pub tags: StringVec,
|
||||
pub tags: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
|
|
|
@ -1,37 +1,35 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
use super::newtype::StringVec;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "hashtag")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub id: String,
|
||||
pub name: String,
|
||||
#[sea_orm(column_name = "mentionedUserIds")]
|
||||
pub mentioned_user_ids: StringVec,
|
||||
pub mentioned_user_ids: Vec<String>,
|
||||
#[sea_orm(column_name = "mentionedUsersCount")]
|
||||
pub mentioned_users_count: i32,
|
||||
#[sea_orm(column_name = "mentionedLocalUserIds")]
|
||||
pub mentioned_local_user_ids: StringVec,
|
||||
pub mentioned_local_user_ids: Vec<String>,
|
||||
#[sea_orm(column_name = "mentionedLocalUsersCount")]
|
||||
pub mentioned_local_users_count: i32,
|
||||
#[sea_orm(column_name = "mentionedRemoteUserIds")]
|
||||
pub mentioned_remote_user_ids: StringVec,
|
||||
pub mentioned_remote_user_ids: Vec<String>,
|
||||
#[sea_orm(column_name = "mentionedRemoteUsersCount")]
|
||||
pub mentioned_remote_users_count: i32,
|
||||
#[sea_orm(column_name = "attachedUserIds")]
|
||||
pub attached_user_ids: StringVec,
|
||||
pub attached_user_ids: Vec<String>,
|
||||
#[sea_orm(column_name = "attachedUsersCount")]
|
||||
pub attached_users_count: i32,
|
||||
#[sea_orm(column_name = "attachedLocalUserIds")]
|
||||
pub attached_local_user_ids: StringVec,
|
||||
pub attached_local_user_ids: Vec<String>,
|
||||
#[sea_orm(column_name = "attachedLocalUsersCount")]
|
||||
pub attached_local_users_count: i32,
|
||||
#[sea_orm(column_name = "attachedRemoteUserIds")]
|
||||
pub attached_remote_user_ids: StringVec,
|
||||
pub attached_remote_user_ids: Vec<String>,
|
||||
#[sea_orm(column_name = "attachedRemoteUsersCount")]
|
||||
pub attached_remote_users_count: i32,
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "instance")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
use super::newtype::StringVec;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "messaging_message")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
@ -22,7 +20,7 @@ pub struct Model {
|
|||
pub file_id: Option<String>,
|
||||
#[sea_orm(column_name = "groupId")]
|
||||
pub group_id: Option<String>,
|
||||
pub reads: StringVec,
|
||||
pub reads: Vec<String>,
|
||||
pub uri: Option<String>,
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use super::sea_orm_active_enums::MetaSensitivemediadetectionEnum;
|
||||
use super::sea_orm_active_enums::MetaSensitivemediadetectionsensitivityEnum;
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
use super::newtype::StringVec;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "meta")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
@ -25,11 +23,11 @@ pub struct Model {
|
|||
pub disable_global_timeline: bool,
|
||||
#[sea_orm(column_name = "useStarForReactionFallback")]
|
||||
pub use_star_for_reaction_fallback: bool,
|
||||
pub langs: StringVec,
|
||||
pub langs: Vec<String>,
|
||||
#[sea_orm(column_name = "hiddenTags")]
|
||||
pub hidden_tags: StringVec,
|
||||
pub hidden_tags: Vec<String>,
|
||||
#[sea_orm(column_name = "blockedHosts")]
|
||||
pub blocked_hosts: StringVec,
|
||||
pub blocked_hosts: Vec<String>,
|
||||
#[sea_orm(column_name = "mascotImageUrl")]
|
||||
pub mascot_image_url: Option<String>,
|
||||
#[sea_orm(column_name = "bannerUrl")]
|
||||
|
@ -72,11 +70,9 @@ pub struct Model {
|
|||
#[sea_orm(column_name = "swPrivateKey")]
|
||||
pub sw_private_key: Option<String>,
|
||||
#[sea_orm(column_name = "pinnedUsers")]
|
||||
pub pinned_users: StringVec,
|
||||
pub pinned_users: Vec<String>,
|
||||
#[sea_orm(column_name = "ToSUrl")]
|
||||
pub to_s_url: Option<String>,
|
||||
#[sea_orm(column_name = "moreUrls", column_type = "JsonBinary")]
|
||||
pub more_urls: Json,
|
||||
#[sea_orm(column_name = "repositoryUrl")]
|
||||
pub repository_url: String,
|
||||
#[sea_orm(column_name = "feedbackUrl")]
|
||||
|
@ -114,7 +110,7 @@ pub struct Model {
|
|||
#[sea_orm(column_name = "objectStorageSetPublicRead")]
|
||||
pub object_storage_set_public_read: bool,
|
||||
#[sea_orm(column_name = "pinnedPages")]
|
||||
pub pinned_pages: StringVec,
|
||||
pub pinned_pages: Vec<String>,
|
||||
#[sea_orm(column_name = "backgroundImageUrl")]
|
||||
pub background_image_url: Option<String>,
|
||||
#[sea_orm(column_name = "logoImageUrl")]
|
||||
|
@ -124,7 +120,7 @@ pub struct Model {
|
|||
#[sea_orm(column_name = "objectStorageS3ForcePathStyle")]
|
||||
pub object_storage_s3_force_path_style: bool,
|
||||
#[sea_orm(column_name = "allowedHosts")]
|
||||
pub allowed_hosts: Option<StringVec>,
|
||||
pub allowed_hosts: Option<Vec<String>>,
|
||||
#[sea_orm(column_name = "secureMode")]
|
||||
pub secure_mode: Option<bool>,
|
||||
#[sea_orm(column_name = "privateMode")]
|
||||
|
@ -154,13 +150,13 @@ pub struct Model {
|
|||
#[sea_orm(column_name = "enableActiveEmailValidation")]
|
||||
pub enable_active_email_validation: bool,
|
||||
#[sea_orm(column_name = "customMOTD")]
|
||||
pub custom_motd: StringVec,
|
||||
pub custom_motd: Vec<String>,
|
||||
#[sea_orm(column_name = "customSplashIcons")]
|
||||
pub custom_splash_icons: StringVec,
|
||||
pub custom_splash_icons: Vec<String>,
|
||||
#[sea_orm(column_name = "disableRecommendedTimeline")]
|
||||
pub disable_recommended_timeline: bool,
|
||||
#[sea_orm(column_name = "recommendedInstances")]
|
||||
pub recommended_instances: StringVec,
|
||||
pub recommended_instances: Vec<String>,
|
||||
#[sea_orm(column_name = "enableGuestTimeline")]
|
||||
pub enable_guest_timeline: bool,
|
||||
#[sea_orm(column_name = "defaultReaction")]
|
||||
|
@ -170,13 +166,17 @@ pub struct Model {
|
|||
#[sea_orm(column_name = "libreTranslateApiKey")]
|
||||
pub libre_translate_api_key: Option<String>,
|
||||
#[sea_orm(column_name = "silencedHosts")]
|
||||
pub silenced_hosts: StringVec,
|
||||
pub silenced_hosts: Vec<String>,
|
||||
#[sea_orm(column_name = "experimentalFeatures", column_type = "JsonBinary")]
|
||||
pub experimental_features: Json,
|
||||
#[sea_orm(column_name = "enableServerMachineStats")]
|
||||
pub enable_server_machine_stats: bool,
|
||||
#[sea_orm(column_name = "enableIdenticonGeneration")]
|
||||
pub enable_identicon_generation: bool,
|
||||
#[sea_orm(column_name = "donationLink")]
|
||||
pub donation_link: Option<String>,
|
||||
#[sea_orm(column_name = "moreUrls", column_type = "JsonBinary")]
|
||||
pub more_urls: Json,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "migrations")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
pub mod prelude;
|
||||
|
||||
|
@ -32,7 +32,6 @@ pub mod migrations;
|
|||
pub mod moderation_log;
|
||||
pub mod muted_note;
|
||||
pub mod muting;
|
||||
pub mod newtype;
|
||||
pub mod note;
|
||||
pub mod note_edit;
|
||||
pub mod note_favorite;
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "moderation_log")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use super::sea_orm_active_enums::MutedNoteReasonEnum;
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "muted_note")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "muting")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
#[macro_export]
|
||||
macro_rules! impl_json_newtype {
|
||||
($a:tt) => {
|
||||
impl From<$a> for Value {
|
||||
fn from(source: $a) -> Self {
|
||||
Value::Json(serde_json::to_value(source).ok().map(Box::new))
|
||||
}
|
||||
}
|
||||
|
||||
impl TryGetable for $a {
|
||||
fn try_get_by<I: sea_orm::ColIdx>(
|
||||
res: &QueryResult,
|
||||
idx: I,
|
||||
) -> Result<Self, TryGetError> {
|
||||
let json_value: serde_json::Value =
|
||||
res.try_get_by(idx).map_err(TryGetError::DbErr)?;
|
||||
serde_json::from_value(json_value)
|
||||
.map_err(|e| TryGetError::DbErr(DbErr::Json(e.to_string())))
|
||||
}
|
||||
}
|
||||
|
||||
impl sea_query::ValueType for $a {
|
||||
fn try_from(v: Value) -> Result<Self, sea_query::ValueTypeErr> {
|
||||
match v {
|
||||
Value::Json(Some(x)) => Ok($a(
|
||||
serde_json::from_value(*x).map_err(|_| sea_query::ValueTypeErr)?
|
||||
)),
|
||||
_ => Err(sea_query::ValueTypeErr),
|
||||
}
|
||||
}
|
||||
|
||||
fn type_name() -> String {
|
||||
stringify!($a).to_owned()
|
||||
}
|
||||
|
||||
fn array_type() -> sea_query::ArrayType {
|
||||
sea_query::ArrayType::Json
|
||||
}
|
||||
|
||||
fn column_type() -> sea_query::ColumnType {
|
||||
sea_query::ColumnType::JsonBinary
|
||||
}
|
||||
}
|
||||
|
||||
impl sea_query::Nullable for $a {
|
||||
fn null() -> Value {
|
||||
Value::Json(None)
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
mod macros;
|
||||
|
||||
use cfg_if::cfg_if;
|
||||
use derive_more::{From, Into};
|
||||
use sea_orm::{sea_query, DbErr, QueryResult, TryGetError, TryGetable, Value};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::impl_json_newtype;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, From, Into, Default)]
|
||||
pub struct JsonKeyword(pub Vec<Vec<String>>);
|
||||
impl_json_newtype!(JsonKeyword);
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, From, Into, Default)]
|
||||
pub struct JsonStringVec(pub Vec<String>);
|
||||
impl_json_newtype!(JsonStringVec);
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, From, Into, Default)]
|
||||
pub struct JsonI32Vec(pub Vec<i32>);
|
||||
impl_json_newtype!(JsonI32Vec);
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "noarray")] {
|
||||
pub type StringVec = JsonStringVec;
|
||||
pub type I32Vec = JsonI32Vec;
|
||||
} else {
|
||||
pub type StringVec = Vec<String>;
|
||||
pub type I32Vec = Vec<i32>;
|
||||
}
|
||||
}
|
|
@ -1,11 +1,9 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use super::sea_orm_active_enums::NoteVisibilityEnum;
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
use super::newtype::StringVec;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "note")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
@ -34,16 +32,16 @@ pub struct Model {
|
|||
pub uri: Option<String>,
|
||||
pub score: i32,
|
||||
#[sea_orm(column_name = "fileIds")]
|
||||
pub file_ids: StringVec,
|
||||
pub file_ids: Vec<String>,
|
||||
#[sea_orm(column_name = "attachedFileTypes")]
|
||||
pub attached_file_types: StringVec,
|
||||
pub attached_file_types: Vec<String>,
|
||||
#[sea_orm(column_name = "visibleUserIds")]
|
||||
pub visible_user_ids: StringVec,
|
||||
pub mentions: StringVec,
|
||||
pub visible_user_ids: Vec<String>,
|
||||
pub mentions: Vec<String>,
|
||||
#[sea_orm(column_name = "mentionedRemoteUsers", column_type = "Text")]
|
||||
pub mentioned_remote_users: String,
|
||||
pub emojis: StringVec,
|
||||
pub tags: StringVec,
|
||||
pub emojis: Vec<String>,
|
||||
pub tags: Vec<String>,
|
||||
#[sea_orm(column_name = "hasPoll")]
|
||||
pub has_poll: bool,
|
||||
#[sea_orm(column_name = "userHost")]
|
||||
|
@ -63,6 +61,7 @@ pub struct Model {
|
|||
pub thread_id: Option<String>,
|
||||
#[sea_orm(column_name = "updatedAt")]
|
||||
pub updated_at: Option<DateTimeWithTimeZone>,
|
||||
pub lang: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
use super::newtype::StringVec;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "note_edit")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
@ -15,7 +13,7 @@ pub struct Model {
|
|||
pub text: Option<String>,
|
||||
pub cw: Option<String>,
|
||||
#[sea_orm(column_name = "fileIds")]
|
||||
pub file_ids: StringVec,
|
||||
pub file_ids: Vec<String>,
|
||||
#[sea_orm(column_name = "updatedAt")]
|
||||
pub updated_at: DateTimeWithTimeZone,
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "note_favorite")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "note_reaction")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "note_thread_muting")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "note_unread")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "note_watching")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use super::sea_orm_active_enums::NotificationTypeEnum;
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "notification")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use super::sea_orm_active_enums::PageVisibilityEnum;
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
use super::newtype::StringVec;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "page")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
@ -30,7 +28,7 @@ pub struct Model {
|
|||
pub variables: Json,
|
||||
pub visibility: PageVisibilityEnum,
|
||||
#[sea_orm(column_name = "visibleUserIds")]
|
||||
pub visible_user_ids: StringVec,
|
||||
pub visible_user_ids: Vec<String>,
|
||||
#[sea_orm(column_name = "likedCount")]
|
||||
pub liked_count: i32,
|
||||
#[sea_orm(column_name = "hideTitleWhenPinned")]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "page_like")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "password_reset_request")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use super::sea_orm_active_enums::PollNotevisibilityEnum;
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
use super::newtype::{I32Vec, StringVec};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "poll")]
|
||||
pub struct Model {
|
||||
#[sea_orm(column_name = "noteId", primary_key, auto_increment = false, unique)]
|
||||
|
@ -13,8 +11,8 @@ pub struct Model {
|
|||
#[sea_orm(column_name = "expiresAt")]
|
||||
pub expires_at: Option<DateTimeWithTimeZone>,
|
||||
pub multiple: bool,
|
||||
pub choices: StringVec,
|
||||
pub votes: I32Vec,
|
||||
pub choices: Vec<String>,
|
||||
pub votes: Vec<i32>,
|
||||
#[sea_orm(column_name = "noteVisibility")]
|
||||
pub note_visibility: PollNotevisibilityEnum,
|
||||
#[sea_orm(column_name = "userId")]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "poll_vote")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
pub use super::abuse_user_report::Entity as AbuseUserReport;
|
||||
pub use super::access_token::Entity as AccessToken;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "promo_note")]
|
||||
pub struct Model {
|
||||
#[sea_orm(column_name = "noteId", primary_key, auto_increment = false, unique)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "promo_read")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "registration_ticket")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
use super::newtype::StringVec;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "registry_item")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
@ -16,7 +14,7 @@ pub struct Model {
|
|||
#[sea_orm(column_name = "userId")]
|
||||
pub user_id: String,
|
||||
pub key: String,
|
||||
pub scope: StringVec,
|
||||
pub scope: Vec<String>,
|
||||
pub domain: Option<String>,
|
||||
#[sea_orm(column_type = "JsonBinary", nullable)]
|
||||
pub value: Option<Json>,
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use super::sea_orm_active_enums::RelayStatusEnum;
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "relay")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "renote_muting")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Default)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
|
||||
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "antenna_src_enum")]
|
||||
pub enum AntennaSrcEnum {
|
||||
#[default]
|
||||
#[sea_orm(string_value = "all")]
|
||||
All,
|
||||
#[sea_orm(string_value = "group")]
|
||||
|
@ -19,14 +18,13 @@ pub enum AntennaSrcEnum {
|
|||
#[sea_orm(string_value = "users")]
|
||||
Users,
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Default)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
|
||||
#[sea_orm(
|
||||
rs_type = "String",
|
||||
db_type = "Enum",
|
||||
enum_name = "meta_sensitivemediadetection_enum"
|
||||
)]
|
||||
pub enum MetaSensitivemediadetectionEnum {
|
||||
#[default]
|
||||
#[sea_orm(string_value = "all")]
|
||||
All,
|
||||
#[sea_orm(string_value = "local")]
|
||||
|
@ -36,7 +34,7 @@ pub enum MetaSensitivemediadetectionEnum {
|
|||
#[sea_orm(string_value = "remote")]
|
||||
Remote,
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Default)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
|
||||
#[sea_orm(
|
||||
rs_type = "String",
|
||||
db_type = "Enum",
|
||||
|
@ -47,7 +45,6 @@ pub enum MetaSensitivemediadetectionsensitivityEnum {
|
|||
High,
|
||||
#[sea_orm(string_value = "low")]
|
||||
Low,
|
||||
#[default]
|
||||
#[sea_orm(string_value = "medium")]
|
||||
Medium,
|
||||
#[sea_orm(string_value = "veryHigh")]
|
||||
|
@ -55,14 +52,13 @@ pub enum MetaSensitivemediadetectionsensitivityEnum {
|
|||
#[sea_orm(string_value = "veryLow")]
|
||||
VeryLow,
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Default)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
|
||||
#[sea_orm(
|
||||
rs_type = "String",
|
||||
db_type = "Enum",
|
||||
enum_name = "muted_note_reason_enum"
|
||||
)]
|
||||
pub enum MutedNoteReasonEnum {
|
||||
#[default]
|
||||
#[sea_orm(string_value = "manual")]
|
||||
Manual,
|
||||
#[sea_orm(string_value = "other")]
|
||||
|
@ -72,7 +68,7 @@ pub enum MutedNoteReasonEnum {
|
|||
#[sea_orm(string_value = "word")]
|
||||
Word,
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Default)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
|
||||
#[sea_orm(
|
||||
rs_type = "String",
|
||||
db_type = "Enum",
|
||||
|
@ -85,13 +81,12 @@ pub enum NoteVisibilityEnum {
|
|||
Hidden,
|
||||
#[sea_orm(string_value = "home")]
|
||||
Home,
|
||||
#[default]
|
||||
#[sea_orm(string_value = "public")]
|
||||
Public,
|
||||
#[sea_orm(string_value = "specified")]
|
||||
Specified,
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Default)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
|
||||
#[sea_orm(
|
||||
rs_type = "String",
|
||||
db_type = "Enum",
|
||||
|
@ -120,11 +115,10 @@ pub enum NotificationTypeEnum {
|
|||
ReceiveFollowRequest,
|
||||
#[sea_orm(string_value = "renote")]
|
||||
Renote,
|
||||
#[default]
|
||||
#[sea_orm(string_value = "reply")]
|
||||
Reply,
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Default)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
|
||||
#[sea_orm(
|
||||
rs_type = "String",
|
||||
db_type = "Enum",
|
||||
|
@ -133,13 +127,12 @@ pub enum NotificationTypeEnum {
|
|||
pub enum PageVisibilityEnum {
|
||||
#[sea_orm(string_value = "followers")]
|
||||
Followers,
|
||||
#[default]
|
||||
#[sea_orm(string_value = "public")]
|
||||
Public,
|
||||
#[sea_orm(string_value = "specified")]
|
||||
Specified,
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Default)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
|
||||
#[sea_orm(
|
||||
rs_type = "String",
|
||||
db_type = "Enum",
|
||||
|
@ -150,24 +143,22 @@ pub enum PollNotevisibilityEnum {
|
|||
Followers,
|
||||
#[sea_orm(string_value = "home")]
|
||||
Home,
|
||||
#[default]
|
||||
#[sea_orm(string_value = "public")]
|
||||
Public,
|
||||
#[sea_orm(string_value = "specified")]
|
||||
Specified,
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Default)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
|
||||
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "relay_status_enum")]
|
||||
pub enum RelayStatusEnum {
|
||||
#[sea_orm(string_value = "accepted")]
|
||||
Accepted,
|
||||
#[sea_orm(string_value = "rejected")]
|
||||
Rejected,
|
||||
#[default]
|
||||
#[sea_orm(string_value = "requesting")]
|
||||
Requesting,
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Default)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
|
||||
#[sea_orm(
|
||||
rs_type = "String",
|
||||
db_type = "Enum",
|
||||
|
@ -178,7 +169,38 @@ pub enum UserProfileFfvisibilityEnum {
|
|||
Followers,
|
||||
#[sea_orm(string_value = "private")]
|
||||
Private,
|
||||
#[default]
|
||||
#[sea_orm(string_value = "public")]
|
||||
Public,
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
|
||||
#[sea_orm(
|
||||
rs_type = "String",
|
||||
db_type = "Enum",
|
||||
enum_name = "user_profile_mutingnotificationtypes_enum"
|
||||
)]
|
||||
pub enum UserProfileMutingnotificationtypesEnum {
|
||||
#[sea_orm(string_value = "app")]
|
||||
App,
|
||||
#[sea_orm(string_value = "follow")]
|
||||
Follow,
|
||||
#[sea_orm(string_value = "followRequestAccepted")]
|
||||
FollowRequestAccepted,
|
||||
#[sea_orm(string_value = "groupInvited")]
|
||||
GroupInvited,
|
||||
#[sea_orm(string_value = "mention")]
|
||||
Mention,
|
||||
#[sea_orm(string_value = "pollEnded")]
|
||||
PollEnded,
|
||||
#[sea_orm(string_value = "pollVote")]
|
||||
PollVote,
|
||||
#[sea_orm(string_value = "quote")]
|
||||
Quote,
|
||||
#[sea_orm(string_value = "reaction")]
|
||||
Reaction,
|
||||
#[sea_orm(string_value = "receiveFollowRequest")]
|
||||
ReceiveFollowRequest,
|
||||
#[sea_orm(string_value = "renote")]
|
||||
Renote,
|
||||
#[sea_orm(string_value = "reply")]
|
||||
Reply,
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "signin")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "sw_subscription")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "used_username")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
use super::newtype::StringVec;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "user")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
@ -29,7 +27,7 @@ pub struct Model {
|
|||
pub avatar_id: Option<String>,
|
||||
#[sea_orm(column_name = "bannerId", unique)]
|
||||
pub banner_id: Option<String>,
|
||||
pub tags: StringVec,
|
||||
pub tags: Vec<String>,
|
||||
#[sea_orm(column_name = "isSuspended")]
|
||||
pub is_suspended: bool,
|
||||
#[sea_orm(column_name = "isSilenced")]
|
||||
|
@ -44,7 +42,7 @@ pub struct Model {
|
|||
pub is_admin: bool,
|
||||
#[sea_orm(column_name = "isModerator")]
|
||||
pub is_moderator: bool,
|
||||
pub emojis: StringVec,
|
||||
pub emojis: Vec<String>,
|
||||
pub host: Option<String>,
|
||||
pub inbox: Option<String>,
|
||||
#[sea_orm(column_name = "sharedInbox")]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "user_group")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "user_group_invitation")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "user_group_invite")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "user_group_joining")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "user_ip")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "user_keypair")]
|
||||
pub struct Model {
|
||||
#[sea_orm(column_name = "userId", primary_key, auto_increment = false, unique)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "user_list")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "user_list_joining")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "user_note_pining")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "user_pending")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use super::sea_orm_active_enums::UserProfileFfvisibilityEnum;
|
||||
use super::sea_orm_active_enums::UserProfileMutingnotificationtypesEnum;
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
use super::newtype::StringVec;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "user_profile")]
|
||||
pub struct Model {
|
||||
#[sea_orm(column_name = "userId", primary_key, auto_increment = false, unique)]
|
||||
|
@ -53,7 +52,7 @@ pub struct Model {
|
|||
#[sea_orm(column_name = "mutedWords", column_type = "JsonBinary")]
|
||||
pub muted_words: Json,
|
||||
#[sea_orm(column_name = "mutingNotificationTypes")]
|
||||
pub muting_notification_types: StringVec,
|
||||
pub muting_notification_types: Vec<UserProfileMutingnotificationtypesEnum>,
|
||||
#[sea_orm(column_name = "noCrawle")]
|
||||
pub no_crawle: bool,
|
||||
#[sea_orm(column_name = "receiveAnnouncementEmail")]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "user_publickey")]
|
||||
pub struct Model {
|
||||
#[sea_orm(column_name = "userId", primary_key, auto_increment = false, unique)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "user_security_key")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
use super::newtype::StringVec;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "webhook")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
@ -14,7 +12,7 @@ pub struct Model {
|
|||
#[sea_orm(column_name = "userId")]
|
||||
pub user_id: String,
|
||||
pub name: String,
|
||||
pub on: StringVec,
|
||||
pub on: Vec<String>,
|
||||
pub url: String,
|
||||
pub secret: String,
|
||||
pub active: bool,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pub mod entity;
|
||||
pub mod error;
|
||||
pub mod repository;
|
||||
// pub mod repository;
|
||||
pub mod schema;
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
pub mod antenna;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use schemars::JsonSchema;
|
||||
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
use async_trait::async_trait;
|
||||
use cfg_if::cfg_if;
|
||||
use sea_orm::EntityTrait;
|
||||
|
||||
use crate::database;
|
||||
use crate::model::entity::{antenna, user_group_joining};
|
||||
use crate::model::error::Error;
|
||||
use crate::model::schema::Antenna;
|
||||
|
||||
use super::macros::impl_pack_by_id;
|
||||
use super::Repository;
|
||||
|
||||
#[async_trait]
|
||||
impl Repository<Antenna> for antenna::Model {
|
||||
async fn pack(self) -> Result<Antenna, Error> {
|
||||
let db = database::get_database()?;
|
||||
let user_group_joining = match self.user_group_joining_id {
|
||||
None => None,
|
||||
Some(id) => user_group_joining::Entity::find_by_id(id).one(db).await?,
|
||||
};
|
||||
let user_group_id = match user_group_joining {
|
||||
None => None,
|
||||
Some(m) => Some(m.user_group_id),
|
||||
};
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "napi")] {
|
||||
let created_at: String = self.created_at.to_rfc3339();
|
||||
} else {
|
||||
let created_at: chrono::DateTime<chrono::Utc> = self.created_at.into();
|
||||
}
|
||||
}
|
||||
|
||||
Ok(Antenna {
|
||||
id: self.id,
|
||||
created_at,
|
||||
name: self.name,
|
||||
keywords: self.keywords.into(),
|
||||
exclude_keywords: self.exclude_keywords.into(),
|
||||
src: self.src.try_into()?,
|
||||
user_list_id: self.user_list_id,
|
||||
user_group_id,
|
||||
users: self.users,
|
||||
instances: self.instances.into(),
|
||||
case_sensitive: self.case_sensitive,
|
||||
notify: self.notify,
|
||||
with_replies: self.with_replies,
|
||||
with_file: self.with_file,
|
||||
has_unread_note: false,
|
||||
})
|
||||
}
|
||||
|
||||
async fn pack_by_id(id: String) -> Result<Antenna, Error> {
|
||||
impl_pack_by_id!(antenna::Entity, id)
|
||||
}
|
||||
}
|
|
@ -1,7 +1,3 @@
|
|||
pub mod antenna;
|
||||
pub mod app;
|
||||
|
||||
use cfg_if::cfg_if;
|
||||
use jsonschema::JSONSchema;
|
||||
use schemars::{schema_for, JsonSchema};
|
||||
|
||||
|
@ -20,16 +16,3 @@ pub trait Schema<T: JsonSchema> {
|
|||
.expect("Unable to compile schema")
|
||||
}
|
||||
}
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "napi")] {
|
||||
// Will be disabled once we completely migrate to rust
|
||||
pub use antenna::NativeAntennaSchema as Antenna;
|
||||
pub use antenna::NativeAntennaSrc as AntennaSrc;
|
||||
} else {
|
||||
pub use antenna::Antenna;
|
||||
pub use antenna::AntennaSrc;
|
||||
pub use app::App;
|
||||
pub use app::AppPermission;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,217 +0,0 @@
|
|||
use cfg_if::cfg_if;
|
||||
use jsonschema::JSONSchema;
|
||||
use once_cell::sync::Lazy;
|
||||
use parse_display::FromStr;
|
||||
use schemars::JsonSchema;
|
||||
use utoipa::ToSchema;
|
||||
|
||||
use super::Schema;
|
||||
use crate::model;
|
||||
use crate::model::entity::sea_orm_active_enums::AntennaSrcEnum;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, JsonSchema, ToSchema)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Antenna {
|
||||
pub id: String,
|
||||
pub created_at: chrono::DateTime<chrono::Utc>,
|
||||
pub name: String,
|
||||
pub keywords: Vec<Vec<String>>,
|
||||
pub exclude_keywords: Vec<Vec<String>>,
|
||||
#[schema(inline)]
|
||||
pub src: AntennaSrc,
|
||||
pub user_list_id: Option<String>,
|
||||
pub user_group_id: Option<String>,
|
||||
pub users: Vec<String>,
|
||||
pub instances: Vec<String>,
|
||||
#[serde(default)]
|
||||
pub case_sensitive: bool,
|
||||
#[serde(default)]
|
||||
pub notify: bool,
|
||||
#[serde(default)]
|
||||
pub with_replies: bool,
|
||||
#[serde(default)]
|
||||
pub with_file: bool,
|
||||
#[serde(default)]
|
||||
pub has_unread_note: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, FromStr, PartialEq, Eq, JsonSchema, ToSchema)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[display(style = "camelCase")]
|
||||
#[display("'{}'")]
|
||||
pub enum AntennaSrc {
|
||||
Home,
|
||||
All,
|
||||
Users,
|
||||
List,
|
||||
Group,
|
||||
Instances,
|
||||
}
|
||||
|
||||
impl TryFrom<AntennaSrcEnum> for super::AntennaSrc {
|
||||
type Error = model::error::Error;
|
||||
|
||||
fn try_from(value: AntennaSrcEnum) -> Result<Self, Self::Error> {
|
||||
value.to_string().parse().map_err(model::error::Error::from)
|
||||
}
|
||||
}
|
||||
|
||||
// ---- TODO: could be macro
|
||||
impl Schema<Self> for super::Antenna {}
|
||||
pub static VALIDATOR: Lazy<JSONSchema> = Lazy::new(super::Antenna::validator);
|
||||
// ----
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "napi")] {
|
||||
use napi::bindgen_prelude::{FromNapiValue, ToNapiValue};
|
||||
use napi_derive::napi;
|
||||
|
||||
use crate::model::entity::antenna;
|
||||
use crate::model::repository::Repository;
|
||||
|
||||
/// For NAPI because [chrono] is not supported.
|
||||
#[napi(object)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, JsonSchema, ToSchema)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct NativeAntennaSchema {
|
||||
pub id: String,
|
||||
pub created_at: String,
|
||||
pub name: String,
|
||||
pub keywords: Vec<Vec<String>>,
|
||||
pub exclude_keywords: Vec<Vec<String>>,
|
||||
#[schema(inline)]
|
||||
pub src: NativeAntennaSrc,
|
||||
pub user_list_id: Option<String>,
|
||||
pub user_group_id: Option<String>,
|
||||
pub users: Vec<String>,
|
||||
pub instances: Vec<String>,
|
||||
#[serde(default)]
|
||||
pub case_sensitive: bool,
|
||||
#[serde(default)]
|
||||
pub notify: bool,
|
||||
#[serde(default)]
|
||||
pub with_replies: bool,
|
||||
#[serde(default)]
|
||||
pub with_file: bool,
|
||||
#[serde(default)]
|
||||
pub has_unread_note: bool,
|
||||
}
|
||||
|
||||
#[napi(string_enum)]
|
||||
#[derive(Debug, FromStr, PartialEq, Eq, JsonSchema, ToSchema)]
|
||||
#[display("'{}'")]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub enum NativeAntennaSrc {
|
||||
home,
|
||||
all,
|
||||
users,
|
||||
list,
|
||||
group,
|
||||
instances,
|
||||
}
|
||||
|
||||
#[napi]
|
||||
pub async fn native_pack_antenna_by_id(id: String) -> napi::Result<NativeAntennaSchema> {
|
||||
antenna::Model::pack_by_id(id).await.map_err(Into::into)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod unit_test {
|
||||
use cfg_if::cfg_if;
|
||||
use pretty_assertions::assert_eq;
|
||||
use serde_json::json;
|
||||
|
||||
use crate::model::{entity::sea_orm_active_enums::AntennaSrcEnum, schema::AntennaSrc};
|
||||
|
||||
use super::VALIDATOR;
|
||||
|
||||
#[test]
|
||||
fn src_from_active_enum() {
|
||||
let src = AntennaSrc::try_from(AntennaSrcEnum::All).unwrap();
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "napi")] {
|
||||
assert_eq!(src, AntennaSrc::all);
|
||||
} else {
|
||||
assert_eq!(src, AntennaSrc::All);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn antenna_valid() {
|
||||
let instance = json!({
|
||||
"id": "9fil64s6g7cskdrb",
|
||||
"createdAt": "2023-05-24T06:56:14.323Z",
|
||||
"name": "Valid Antenna",
|
||||
"keywords": [["first", "keyword"], ["second"]],
|
||||
"excludeKeywords": [["excluding", "keywrods"], ["from", "antenna"]],
|
||||
"src": "users",
|
||||
// "userListId" and "userGroupId" can be null or be omitted
|
||||
"userListId": null,
|
||||
"users": ["9fil64s6g7cskdrb", "9fil66brl1udxau2"],
|
||||
"instances": [],
|
||||
// "caseSensitive", "notify", "withReplies", "withFile", and
|
||||
// "hasUnreadNote" are false if ommited
|
||||
"notify": false,
|
||||
"withReplies": false,
|
||||
"withFile": false,
|
||||
"hasUnreadNote": false,
|
||||
});
|
||||
|
||||
assert!(VALIDATOR.is_valid(&instance));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn antenna_invalid() {
|
||||
let instance = json!({
|
||||
// "id" is required
|
||||
"id": null,
|
||||
// trailing "Z" is missing
|
||||
"createdAt": "2023-05-24T07:36:34.389",
|
||||
// "name" is required
|
||||
// "keywords" must be an array
|
||||
"keywords": "invalid keyword",
|
||||
// "excludeKeywords" is required
|
||||
"excludeKeywords": null,
|
||||
// "src" must be one of "home", "all", "users", "list", "group", and
|
||||
// "instances"
|
||||
"src": "invalid_src",
|
||||
// "userListId" is string
|
||||
"userListId": ["9f4ziiqfxw"],
|
||||
// "users" must be an array of strings
|
||||
"users": [1, "9fil64s6g7cskdrb"],
|
||||
"instances": ["9fil65jzhtjpi3xn"],
|
||||
// "caseSensitive" is boolean
|
||||
"caseSensitive": 0,
|
||||
"notify": true,
|
||||
"withReplies": true,
|
||||
"withFile": true,
|
||||
"hasUnreadNote": true,
|
||||
});
|
||||
|
||||
let result = VALIDATOR
|
||||
.validate(&instance)
|
||||
.expect_err("validation must fail");
|
||||
let mut paths: Vec<String> = result
|
||||
.map(|e| e.instance_path.to_string())
|
||||
.filter(|e| !e.is_empty())
|
||||
.collect();
|
||||
paths.sort();
|
||||
assert_eq!(
|
||||
paths,
|
||||
vec![
|
||||
"/caseSensitive",
|
||||
#[cfg(not(feature = "napi"))]
|
||||
"/createdAt",
|
||||
"/excludeKeywords",
|
||||
"/id",
|
||||
"/keywords",
|
||||
"/src",
|
||||
"/userListId",
|
||||
"/users/0"
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,147 +0,0 @@
|
|||
use jsonschema::JSONSchema;
|
||||
use once_cell::sync::Lazy;
|
||||
use schemars::JsonSchema;
|
||||
use utoipa::ToSchema;
|
||||
|
||||
use super::Schema;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, JsonSchema, ToSchema)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct App {
|
||||
pub id: String,
|
||||
pub name: String,
|
||||
#[schemars(url)]
|
||||
pub callback_url: Option<String>,
|
||||
#[schema(inline)]
|
||||
pub permission: Vec<AppPermission>,
|
||||
pub secret: Option<String>,
|
||||
pub is_authorized: Option<bool>,
|
||||
}
|
||||
|
||||
/// This represents `permissions` in `packages/firefish-js/src/consts.ts`.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, JsonSchema, ToSchema)]
|
||||
pub enum AppPermission {
|
||||
#[serde(rename = "read:account")]
|
||||
ReadAccount,
|
||||
#[serde(rename = "write:account")]
|
||||
WriteAccount,
|
||||
#[serde(rename = "read:blocks")]
|
||||
ReadBlocks,
|
||||
#[serde(rename = "write:blocks")]
|
||||
WriteBlocks,
|
||||
#[serde(rename = "read:drive")]
|
||||
ReadDrive,
|
||||
#[serde(rename = "write:drive")]
|
||||
WriteDrive,
|
||||
#[serde(rename = "read:favorites")]
|
||||
ReadFavorites,
|
||||
#[serde(rename = "write:favorites")]
|
||||
WriteFavorites,
|
||||
#[serde(rename = "read:following")]
|
||||
ReadFollowing,
|
||||
#[serde(rename = "write:following")]
|
||||
WriteFollowing,
|
||||
#[serde(rename = "read:messaging")]
|
||||
ReadMessaging,
|
||||
#[serde(rename = "write:messaging")]
|
||||
WriteMessaging,
|
||||
#[serde(rename = "read:mutes")]
|
||||
ReadMutes,
|
||||
#[serde(rename = "write:mutes")]
|
||||
WriteMutes,
|
||||
#[serde(rename = "read:notes")]
|
||||
ReadNotes,
|
||||
#[serde(rename = "write:notes")]
|
||||
WriteNotes,
|
||||
#[serde(rename = "read:notifications")]
|
||||
ReadNotifications,
|
||||
#[serde(rename = "write:notifications")]
|
||||
WriteNotifications,
|
||||
#[serde(rename = "read:reactions")]
|
||||
ReadReactions,
|
||||
#[serde(rename = "write:reactions")]
|
||||
WriteReactions,
|
||||
#[serde(rename = "write:votes")]
|
||||
WriteVotes,
|
||||
#[serde(rename = "read:pages")]
|
||||
ReadPages,
|
||||
#[serde(rename = "write:pages")]
|
||||
WritePages,
|
||||
#[serde(rename = "read:page-likes")]
|
||||
ReadPageLikes,
|
||||
#[serde(rename = "write:page-likes")]
|
||||
WritePageLikes,
|
||||
#[serde(rename = "read:user-groups")]
|
||||
ReadUserGroups,
|
||||
#[serde(rename = "write:user-groups")]
|
||||
WriteUserGroups,
|
||||
#[serde(rename = "read:channels")]
|
||||
ReadChannels,
|
||||
#[serde(rename = "write:channels")]
|
||||
WriteChannels,
|
||||
#[serde(rename = "read:gallery")]
|
||||
ReadGallery,
|
||||
#[serde(rename = "write:gallery")]
|
||||
WriteGallery,
|
||||
#[serde(rename = "read:gallery-likes")]
|
||||
ReadGalleryLikes,
|
||||
#[serde(rename = "write:gallery-likes")]
|
||||
WriteGalleryLikes,
|
||||
}
|
||||
|
||||
impl Schema<Self> for App {}
|
||||
|
||||
pub static VALIDATOR: Lazy<JSONSchema> = Lazy::new(App::validator);
|
||||
|
||||
#[cfg(test)]
|
||||
mod unit_test {
|
||||
use pretty_assertions::assert_eq;
|
||||
use serde_json::json;
|
||||
|
||||
use crate::util::id::{create_id, init_id};
|
||||
use crate::util::random::gen_string;
|
||||
|
||||
use super::VALIDATOR;
|
||||
|
||||
#[test]
|
||||
fn app_valid() {
|
||||
init_id(16, "");
|
||||
let instance = json!({
|
||||
"id": create_id(0).unwrap(),
|
||||
"name": "Test App",
|
||||
"secret": gen_string(24),
|
||||
"callbackUrl": "urn:ietf:wg:oauth:2.0:oob",
|
||||
"permission": ["read:account", "write:account", "read:notes"],
|
||||
});
|
||||
|
||||
assert!(VALIDATOR.is_valid(&instance));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn app_invalid() {
|
||||
init_id(16, "");
|
||||
let instance = json!({
|
||||
"id": create_id(0).unwrap(),
|
||||
// "name" is required
|
||||
"name": null,
|
||||
// "permission" must be one of the app permissions
|
||||
"permission": ["write:invalid_perm", "write:notes"],
|
||||
// "secret" is a nullable string
|
||||
"secret": 123,
|
||||
// "is_authorized" is a nullable boolean
|
||||
"isAuthorized": "true-ish",
|
||||
});
|
||||
let result = VALIDATOR
|
||||
.validate(&instance)
|
||||
.expect_err("validation must fail");
|
||||
let mut paths: Vec<String> = result
|
||||
.map(|e| e.instance_path.to_string())
|
||||
.filter(|e| !e.is_empty())
|
||||
.collect();
|
||||
paths.sort();
|
||||
assert_eq!(
|
||||
paths,
|
||||
vec!["/isAuthorized", "/name", "/permission/0", "/secret"]
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,216 +0,0 @@
|
|||
#![cfg(not(feature = "napi"))]
|
||||
|
||||
mod model;
|
||||
|
||||
use chrono::Utc;
|
||||
use native_utils::database;
|
||||
use native_utils::model::entity;
|
||||
use native_utils::model::entity::sea_orm_active_enums::AntennaSrcEnum;
|
||||
use native_utils::util::{
|
||||
id::{create_id, init_id},
|
||||
random::gen_string,
|
||||
};
|
||||
use sea_orm::{
|
||||
sea_query::TableCreateStatement, ActiveModelTrait, ConnectionTrait, DbBackend, DbConn, DbErr,
|
||||
EntityTrait, IntoActiveModel, TransactionTrait,
|
||||
};
|
||||
|
||||
/// Insert predefined entries in the database.
|
||||
async fn prepare() {
|
||||
database::init_database("sqlite::memory:")
|
||||
.await
|
||||
.expect("Unable to initialize database connection");
|
||||
let db = database::get_database().expect("Unable to get database connection from pool");
|
||||
setup_schema(db).await;
|
||||
setup_model(db).await;
|
||||
}
|
||||
|
||||
/// Setup schemas in the database.
|
||||
async fn setup_schema(db: &DbConn) {
|
||||
let schema = sea_orm::Schema::new(DbBackend::Sqlite);
|
||||
let mut stmts: Vec<TableCreateStatement> = Vec::new();
|
||||
macro_rules! create_table_statement {
|
||||
($a:tt) => {
|
||||
stmts.push(schema.create_table_from_entity(entity::$a::Entity).if_not_exists().to_owned());
|
||||
};
|
||||
($a:tt, $($b:tt),+) => {
|
||||
create_table_statement!($a);
|
||||
create_table_statement!($($b),+);
|
||||
};
|
||||
}
|
||||
create_table_statement!(
|
||||
abuse_user_report,
|
||||
access_token,
|
||||
ad,
|
||||
announcement_read,
|
||||
announcement,
|
||||
antenna_note,
|
||||
antenna,
|
||||
app,
|
||||
attestation_challenge,
|
||||
auth_session,
|
||||
blocking,
|
||||
channel_following,
|
||||
channel_note_pining,
|
||||
channel,
|
||||
clip_note,
|
||||
clip,
|
||||
drive_file,
|
||||
drive_folder,
|
||||
emoji,
|
||||
following,
|
||||
follow_request,
|
||||
gallery_like,
|
||||
gallery_post,
|
||||
hashtag,
|
||||
instance,
|
||||
messaging_message,
|
||||
meta,
|
||||
migrations,
|
||||
moderation_log,
|
||||
muted_note,
|
||||
muting,
|
||||
note_edit,
|
||||
note_favorite,
|
||||
note_reaction,
|
||||
note,
|
||||
note_thread_muting,
|
||||
note_unread,
|
||||
note_watching,
|
||||
notification,
|
||||
page_like,
|
||||
page,
|
||||
password_reset_request,
|
||||
poll,
|
||||
poll_vote,
|
||||
promo_note,
|
||||
promo_read,
|
||||
registration_ticket,
|
||||
registry_item,
|
||||
relay,
|
||||
renote_muting,
|
||||
signin,
|
||||
sw_subscription,
|
||||
used_username,
|
||||
user_group_invitation,
|
||||
user_group_invite,
|
||||
user_group_joining,
|
||||
user_group,
|
||||
user_ip,
|
||||
user_keypair,
|
||||
user_list_joining,
|
||||
user_list,
|
||||
user_note_pining,
|
||||
user_pending,
|
||||
user_profile,
|
||||
user_publickey,
|
||||
user,
|
||||
user_security_key,
|
||||
webhook
|
||||
);
|
||||
db.transaction::<_, (), DbErr>(|txn| {
|
||||
Box::pin(async move {
|
||||
for stmt in stmts {
|
||||
txn.execute(txn.get_database_backend().build(&stmt)).await?;
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
})
|
||||
.await
|
||||
.expect("Unable to setup schemas");
|
||||
}
|
||||
|
||||
/// Delete all entries in the database.
|
||||
async fn cleanup() {
|
||||
let db = database::get_database().expect("Unable to get database connection from pool");
|
||||
db.transaction::<_, (), DbErr>(|txn| {
|
||||
Box::pin(async move {
|
||||
entity::user::Entity::delete_many().exec(txn).await.unwrap();
|
||||
entity::antenna::Entity::delete_many()
|
||||
.exec(txn)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
Ok(())
|
||||
})
|
||||
})
|
||||
.await
|
||||
.expect("Unable to delete predefined models");
|
||||
}
|
||||
|
||||
async fn setup_model(db: &DbConn) {
|
||||
init_id(16, "");
|
||||
|
||||
db.transaction::<_, (), DbErr>(|txn| {
|
||||
Box::pin(async move {
|
||||
let user_id = create_id(0).unwrap();
|
||||
let name = "Alice";
|
||||
let user_model = entity::user::Model {
|
||||
id: user_id.to_owned(),
|
||||
created_at: Utc::now().into(),
|
||||
username: name.to_lowercase(),
|
||||
username_lower: name.to_lowercase(),
|
||||
name: Some(name.to_string()),
|
||||
token: Some(gen_string(16)),
|
||||
is_admin: true,
|
||||
..Default::default()
|
||||
};
|
||||
user_model
|
||||
.into_active_model()
|
||||
.reset_all()
|
||||
.insert(txn)
|
||||
.await?;
|
||||
let antenna_model = entity::antenna::Model {
|
||||
id: create_id(0).unwrap(),
|
||||
created_at: Utc::now().into(),
|
||||
user_id: user_id.to_owned(),
|
||||
name: "Alice Antenna".to_string(),
|
||||
src: AntennaSrcEnum::All,
|
||||
keywords: vec![
|
||||
vec!["foo".to_string(), "bar".to_string()],
|
||||
vec!["foobar".to_string()],
|
||||
]
|
||||
.into(),
|
||||
exclude_keywords: vec![
|
||||
vec!["abc".to_string()],
|
||||
vec!["def".to_string(), "ghi".to_string()],
|
||||
]
|
||||
.into(),
|
||||
notify: true,
|
||||
case_sensitive: true,
|
||||
..Default::default()
|
||||
};
|
||||
antenna_model
|
||||
.into_active_model()
|
||||
.reset_all()
|
||||
.insert(txn)
|
||||
.await?;
|
||||
let note_model = entity::note::Model {
|
||||
id: create_id(0).unwrap(),
|
||||
created_at: Utc::now().into(),
|
||||
text: Some("Testing 123".to_string()),
|
||||
user_id: user_id.to_owned(),
|
||||
..Default::default()
|
||||
};
|
||||
note_model
|
||||
.into_active_model()
|
||||
.reset_all()
|
||||
.insert(txn)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
})
|
||||
})
|
||||
.await
|
||||
.expect("Unable to setup predefined models");
|
||||
}
|
||||
|
||||
mod int_test {
|
||||
use super::{cleanup, prepare};
|
||||
|
||||
#[tokio::test]
|
||||
async fn can_prepare_and_cleanup() {
|
||||
prepare().await;
|
||||
cleanup().await;
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
mod repository;
|
|
@ -1 +0,0 @@
|
|||
mod antenna;
|
|
@ -1,116 +0,0 @@
|
|||
mod int_test {
|
||||
use native_utils::{database, model, util};
|
||||
|
||||
use model::{
|
||||
entity::{antenna, antenna_note, note, user},
|
||||
repository::Repository,
|
||||
schema,
|
||||
};
|
||||
use pretty_assertions::assert_eq;
|
||||
use sea_orm::{ActiveModelTrait, ColumnTrait, EntityTrait, IntoActiveModel, QueryFilter};
|
||||
|
||||
use crate::{cleanup, prepare};
|
||||
|
||||
#[tokio::test]
|
||||
async fn can_pack() {
|
||||
prepare().await;
|
||||
let db = database::get_database().unwrap();
|
||||
|
||||
let alice_antenna = user::Entity::find()
|
||||
.filter(user::Column::Username.eq("alice"))
|
||||
.find_also_related(antenna::Entity)
|
||||
.one(db)
|
||||
.await
|
||||
.unwrap()
|
||||
.expect("alice not found")
|
||||
.1
|
||||
.expect("alice's antenna not found");
|
||||
|
||||
let packed = alice_antenna
|
||||
.to_owned()
|
||||
.pack()
|
||||
.await
|
||||
.expect("Unable to pack");
|
||||
|
||||
let packed_by_id = antenna::Model::pack_by_id(alice_antenna.id.to_owned())
|
||||
.await
|
||||
.expect("Unable to pack");
|
||||
|
||||
let result = schema::Antenna {
|
||||
id: alice_antenna.id,
|
||||
created_at: alice_antenna.created_at.into(),
|
||||
name: "Alice Antenna".to_string(),
|
||||
keywords: vec![
|
||||
vec!["foo".to_string(), "bar".to_string()],
|
||||
vec!["foobar".to_string()],
|
||||
],
|
||||
exclude_keywords: vec![
|
||||
vec!["abc".to_string()],
|
||||
vec!["def".to_string(), "ghi".to_string()],
|
||||
],
|
||||
src: schema::AntennaSrc::All,
|
||||
user_list_id: None,
|
||||
user_group_id: None,
|
||||
users: vec![],
|
||||
instances: vec![],
|
||||
case_sensitive: true,
|
||||
notify: true,
|
||||
with_replies: false,
|
||||
with_file: false,
|
||||
has_unread_note: false,
|
||||
};
|
||||
|
||||
assert_eq!(packed, result);
|
||||
assert_eq!(packed_by_id, result);
|
||||
|
||||
cleanup().await;
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn unread_note() {
|
||||
prepare().await;
|
||||
let db = database::get_database().unwrap();
|
||||
|
||||
let (alice, alice_antenna) = user::Entity::find()
|
||||
.filter(user::Column::Username.eq("alice"))
|
||||
.find_also_related(antenna::Entity)
|
||||
.one(db)
|
||||
.await
|
||||
.unwrap()
|
||||
.expect("alice not found");
|
||||
let alice_antenna = alice_antenna.expect("alice's antenna not found");
|
||||
let packed = alice_antenna
|
||||
.to_owned()
|
||||
.pack()
|
||||
.await
|
||||
.expect("Unable to pack");
|
||||
assert_eq!(packed.has_unread_note, false);
|
||||
|
||||
let note_model = note::Entity::find()
|
||||
.filter(note::Column::UserId.eq(alice.id))
|
||||
.one(db)
|
||||
.await
|
||||
.unwrap()
|
||||
.expect("note not found");
|
||||
let antenna_note = antenna_note::Model {
|
||||
id: util::id::create_id(0).unwrap(),
|
||||
antenna_id: alice_antenna.id.to_owned(),
|
||||
note_id: note_model.id.to_owned(),
|
||||
read: false,
|
||||
};
|
||||
antenna_note
|
||||
.into_active_model()
|
||||
.reset_all()
|
||||
.insert(db)
|
||||
.await
|
||||
.unwrap();
|
||||
let packed = alice_antenna
|
||||
.to_owned()
|
||||
.pack()
|
||||
.await
|
||||
.expect("Unable to pack");
|
||||
assert_eq!(packed.has_unread_note, true);
|
||||
|
||||
cleanup().await;
|
||||
}
|
||||
}
|
|
@ -77,9 +77,6 @@ import { entities as charts } from "@/services/chart/entities.js";
|
|||
import { dbLogger } from "./logger.js";
|
||||
import { redisClient } from "./redis.js";
|
||||
|
||||
// TODO?: should we avoid importing things from built directory?
|
||||
import { nativeInitDatabase } from "native-utils/built/index.js";
|
||||
|
||||
const sqlLogger = dbLogger.createSubLogger("sql", "gray", false);
|
||||
|
||||
class MyCustomLogger implements Logger {
|
||||
|
@ -222,11 +219,6 @@ export const db = new DataSource({
|
|||
});
|
||||
|
||||
export async function initDb(force = false) {
|
||||
await nativeInitDatabase(
|
||||
`postgres://${config.db.user}:${encodeURIComponent(config.db.pass)}@${
|
||||
config.db.host
|
||||
}:${config.db.port}/${config.db.db}`,
|
||||
);
|
||||
if (force) {
|
||||
if (db.isInitialized) {
|
||||
await db.destroy();
|
||||
|
|
|
@ -1,14 +1,33 @@
|
|||
import { db } from "@/db/postgre.js";
|
||||
import { Antenna } from "@/models/entities/antenna.js";
|
||||
import {
|
||||
NativeAntennaSchema,
|
||||
nativePackAntennaById,
|
||||
} from "native-utils/built/index.js";
|
||||
import type { Packed } from "@/misc/schema.js";
|
||||
import { UserGroupJoinings } from "@/models/index.js";
|
||||
|
||||
export const AntennaRepository = db.getRepository(Antenna).extend({
|
||||
async pack(src: Antenna["id"] | Antenna): Promise<NativeAntennaSchema> {
|
||||
const id = typeof src === "object" ? src.id : src;
|
||||
async pack(src: Antenna["id"] | Antenna): Promise<Packed<"Antenna">> {
|
||||
const antenna =
|
||||
typeof src === "object" ? src : await this.findOneByOrFail({ id: src });
|
||||
|
||||
return await nativePackAntennaById(id);
|
||||
const userGroupJoining = antenna.userGroupJoiningId
|
||||
? await UserGroupJoinings.findOneBy({ id: antenna.userGroupJoiningId })
|
||||
: null;
|
||||
|
||||
return {
|
||||
id: antenna.id,
|
||||
createdAt: antenna.createdAt.toISOString(),
|
||||
name: antenna.name,
|
||||
keywords: antenna.keywords,
|
||||
excludeKeywords: antenna.excludeKeywords,
|
||||
src: antenna.src,
|
||||
userListId: antenna.userListId,
|
||||
userGroupId: userGroupJoining ? userGroupJoining.userGroupId : null,
|
||||
users: antenna.users,
|
||||
instances: antenna.instances,
|
||||
caseSensitive: antenna.caseSensitive,
|
||||
notify: antenna.notify,
|
||||
withReplies: antenna.withReplies,
|
||||
withFile: antenna.withFile,
|
||||
hasUnreadNote: false,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue