diff --git a/packages/backend/native-utils/src/database/mod.rs b/packages/backend/native-utils/src/database/mod.rs index 80189a81..739f39bb 100644 --- a/packages/backend/native-utils/src/database/mod.rs +++ b/packages/backend/native-utils/src/database/mod.rs @@ -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}; diff --git a/packages/backend/native-utils/src/model/entity/abuse_user_report.rs b/packages/backend/native-utils/src/model/entity/abuse_user_report.rs index 24230b39..2a4e8a39 100644 --- a/packages/backend/native-utils/src/model/entity/abuse_user_report.rs +++ b/packages/backend/native-utils/src/model/entity/abuse_user_report.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/access_token.rs b/packages/backend/native-utils/src/model/entity/access_token.rs index a8065ecd..2912a043 100644 --- a/packages/backend/native-utils/src/model/entity/access_token.rs +++ b/packages/backend/native-utils/src/model/entity/access_token.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 use sea_orm::entity::prelude::*; -#[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)] diff --git a/packages/backend/native-utils/src/model/entity/ad.rs b/packages/backend/native-utils/src/model/entity/ad.rs index 2cf7a6fc..f1c42afa 100644 --- a/packages/backend/native-utils/src/model/entity/ad.rs +++ b/packages/backend/native-utils/src/model/entity/ad.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/announcement.rs b/packages/backend/native-utils/src/model/entity/announcement.rs index 5cdb690d..d6ce5e23 100644 --- a/packages/backend/native-utils/src/model/entity/announcement.rs +++ b/packages/backend/native-utils/src/model/entity/announcement.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/announcement_read.rs b/packages/backend/native-utils/src/model/entity/announcement_read.rs index 53ff8d6c..dcb9d99c 100644 --- a/packages/backend/native-utils/src/model/entity/announcement_read.rs +++ b/packages/backend/native-utils/src/model/entity/announcement_read.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/antenna.rs b/packages/backend/native-utils/src/model/entity/antenna.rs index 87da97bf..1371ec29 100644 --- a/packages/backend/native-utils/src/model/entity/antenna.rs +++ b/packages/backend/native-utils/src/model/entity/antenna.rs @@ -1,9 +1,9 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/app.rs b/packages/backend/native-utils/src/model/entity/app.rs index 42826ad7..20564853 100644 --- a/packages/backend/native-utils/src/model/entity/app.rs +++ b/packages/backend/native-utils/src/model/entity/app.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 use sea_orm::entity::prelude::*; -#[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)] diff --git a/packages/backend/native-utils/src/model/entity/attestation_challenge.rs b/packages/backend/native-utils/src/model/entity/attestation_challenge.rs index 5217b279..45aafa59 100644 --- a/packages/backend/native-utils/src/model/entity/attestation_challenge.rs +++ b/packages/backend/native-utils/src/model/entity/attestation_challenge.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/auth_session.rs b/packages/backend/native-utils/src/model/entity/auth_session.rs index 8ced191c..88b3e897 100644 --- a/packages/backend/native-utils/src/model/entity/auth_session.rs +++ b/packages/backend/native-utils/src/model/entity/auth_session.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/blocking.rs b/packages/backend/native-utils/src/model/entity/blocking.rs index 4f326f6f..1c01f2ec 100644 --- a/packages/backend/native-utils/src/model/entity/blocking.rs +++ b/packages/backend/native-utils/src/model/entity/blocking.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/channel.rs b/packages/backend/native-utils/src/model/entity/channel.rs index abc79b4f..ce883cce 100644 --- a/packages/backend/native-utils/src/model/entity/channel.rs +++ b/packages/backend/native-utils/src/model/entity/channel.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/channel_following.rs b/packages/backend/native-utils/src/model/entity/channel_following.rs index 93739459..f9e88f6a 100644 --- a/packages/backend/native-utils/src/model/entity/channel_following.rs +++ b/packages/backend/native-utils/src/model/entity/channel_following.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/channel_note_pining.rs b/packages/backend/native-utils/src/model/entity/channel_note_pining.rs index 50ec1ece..e5e4159e 100644 --- a/packages/backend/native-utils/src/model/entity/channel_note_pining.rs +++ b/packages/backend/native-utils/src/model/entity/channel_note_pining.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/clip.rs b/packages/backend/native-utils/src/model/entity/clip.rs index a51ef720..f8e0007d 100644 --- a/packages/backend/native-utils/src/model/entity/clip.rs +++ b/packages/backend/native-utils/src/model/entity/clip.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/clip_note.rs b/packages/backend/native-utils/src/model/entity/clip_note.rs index a8bfd456..b6e6fa2c 100644 --- a/packages/backend/native-utils/src/model/entity/clip_note.rs +++ b/packages/backend/native-utils/src/model/entity/clip_note.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/drive_file.rs b/packages/backend/native-utils/src/model/entity/drive_file.rs index 7c42b988..19816ee2 100644 --- a/packages/backend/native-utils/src/model/entity/drive_file.rs +++ b/packages/backend/native-utils/src/model/entity/drive_file.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/drive_folder.rs b/packages/backend/native-utils/src/model/entity/drive_folder.rs index 98a9f890..f79a18e8 100644 --- a/packages/backend/native-utils/src/model/entity/drive_folder.rs +++ b/packages/backend/native-utils/src/model/entity/drive_folder.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/emoji.rs b/packages/backend/native-utils/src/model/entity/emoji.rs index 610d33ef..95e78c5d 100644 --- a/packages/backend/native-utils/src/model/entity/emoji.rs +++ b/packages/backend/native-utils/src/model/entity/emoji.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 use sea_orm::entity::prelude::*; -#[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)] diff --git a/packages/backend/native-utils/src/model/entity/follow_request.rs b/packages/backend/native-utils/src/model/entity/follow_request.rs index 6f8b00b7..db0cff58 100644 --- a/packages/backend/native-utils/src/model/entity/follow_request.rs +++ b/packages/backend/native-utils/src/model/entity/follow_request.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/following.rs b/packages/backend/native-utils/src/model/entity/following.rs index 641e4153..fe7672cc 100644 --- a/packages/backend/native-utils/src/model/entity/following.rs +++ b/packages/backend/native-utils/src/model/entity/following.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/gallery_like.rs b/packages/backend/native-utils/src/model/entity/gallery_like.rs index e90dfedb..0d9119e3 100644 --- a/packages/backend/native-utils/src/model/entity/gallery_like.rs +++ b/packages/backend/native-utils/src/model/entity/gallery_like.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/gallery_post.rs b/packages/backend/native-utils/src/model/entity/gallery_post.rs index 1689441c..711f2059 100644 --- a/packages/backend/native-utils/src/model/entity/gallery_post.rs +++ b/packages/backend/native-utils/src/model/entity/gallery_post.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 use sea_orm::entity::prelude::*; -#[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)] diff --git a/packages/backend/native-utils/src/model/entity/hashtag.rs b/packages/backend/native-utils/src/model/entity/hashtag.rs index b4ed2dc9..3a7f67b1 100644 --- a/packages/backend/native-utils/src/model/entity/hashtag.rs +++ b/packages/backend/native-utils/src/model/entity/hashtag.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 use sea_orm::entity::prelude::*; -#[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)] diff --git a/packages/backend/native-utils/src/model/entity/instance.rs b/packages/backend/native-utils/src/model/entity/instance.rs index fc9c5bf8..b991f888 100644 --- a/packages/backend/native-utils/src/model/entity/instance.rs +++ b/packages/backend/native-utils/src/model/entity/instance.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/messaging_message.rs b/packages/backend/native-utils/src/model/entity/messaging_message.rs index a5dfd1cd..d9cebf56 100644 --- a/packages/backend/native-utils/src/model/entity/messaging_message.rs +++ b/packages/backend/native-utils/src/model/entity/messaging_message.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 use sea_orm::entity::prelude::*; -#[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)] diff --git a/packages/backend/native-utils/src/model/entity/meta.rs b/packages/backend/native-utils/src/model/entity/meta.rs index a74a4456..174a8bd7 100644 --- a/packages/backend/native-utils/src/model/entity/meta.rs +++ b/packages/backend/native-utils/src/model/entity/meta.rs @@ -1,10 +1,10 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 use super::sea_orm_active_enums::MetaSensitivemediadetectionEnum; use super::sea_orm_active_enums::MetaSensitivemediadetectionsensitivityEnum; use sea_orm::entity::prelude::*; -#[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)] @@ -175,6 +175,8 @@ pub struct Model { 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, } #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] diff --git a/packages/backend/native-utils/src/model/entity/migrations.rs b/packages/backend/native-utils/src/model/entity/migrations.rs index 54e44f2f..e12e83f0 100644 --- a/packages/backend/native-utils/src/model/entity/migrations.rs +++ b/packages/backend/native-utils/src/model/entity/migrations.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity.rs b/packages/backend/native-utils/src/model/entity/mod.rs similarity index 96% rename from packages/backend/native-utils/src/model/entity.rs rename to packages/backend/native-utils/src/model/entity/mod.rs index aad0aa1b..f3c82fed 100644 --- a/packages/backend/native-utils/src/model/entity.rs +++ b/packages/backend/native-utils/src/model/entity/mod.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 pub mod prelude; diff --git a/packages/backend/native-utils/src/model/entity/moderation_log.rs b/packages/backend/native-utils/src/model/entity/moderation_log.rs index eb882b89..b80407ec 100644 --- a/packages/backend/native-utils/src/model/entity/moderation_log.rs +++ b/packages/backend/native-utils/src/model/entity/moderation_log.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/muted_note.rs b/packages/backend/native-utils/src/model/entity/muted_note.rs index 23889854..d406201f 100644 --- a/packages/backend/native-utils/src/model/entity/muted_note.rs +++ b/packages/backend/native-utils/src/model/entity/muted_note.rs @@ -1,9 +1,9 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/muting.rs b/packages/backend/native-utils/src/model/entity/muting.rs index 7b46a0b2..bbe5d973 100644 --- a/packages/backend/native-utils/src/model/entity/muting.rs +++ b/packages/backend/native-utils/src/model/entity/muting.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/note.rs b/packages/backend/native-utils/src/model/entity/note.rs index 9c29e88b..debb9dab 100644 --- a/packages/backend/native-utils/src/model/entity/note.rs +++ b/packages/backend/native-utils/src/model/entity/note.rs @@ -1,9 +1,9 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 use super::sea_orm_active_enums::NoteVisibilityEnum; use sea_orm::entity::prelude::*; -#[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)] diff --git a/packages/backend/native-utils/src/model/entity/note_edit.rs b/packages/backend/native-utils/src/model/entity/note_edit.rs index f2fac0ad..8236a218 100644 --- a/packages/backend/native-utils/src/model/entity/note_edit.rs +++ b/packages/backend/native-utils/src/model/entity/note_edit.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 use sea_orm::entity::prelude::*; -#[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)] diff --git a/packages/backend/native-utils/src/model/entity/note_favorite.rs b/packages/backend/native-utils/src/model/entity/note_favorite.rs index 470ad55d..ff1a061d 100644 --- a/packages/backend/native-utils/src/model/entity/note_favorite.rs +++ b/packages/backend/native-utils/src/model/entity/note_favorite.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/note_reaction.rs b/packages/backend/native-utils/src/model/entity/note_reaction.rs index a4e9f490..9b83ac17 100644 --- a/packages/backend/native-utils/src/model/entity/note_reaction.rs +++ b/packages/backend/native-utils/src/model/entity/note_reaction.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/note_thread_muting.rs b/packages/backend/native-utils/src/model/entity/note_thread_muting.rs index 51688a08..ed5d1a08 100644 --- a/packages/backend/native-utils/src/model/entity/note_thread_muting.rs +++ b/packages/backend/native-utils/src/model/entity/note_thread_muting.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/note_unread.rs b/packages/backend/native-utils/src/model/entity/note_unread.rs index a444eb35..3b53c158 100644 --- a/packages/backend/native-utils/src/model/entity/note_unread.rs +++ b/packages/backend/native-utils/src/model/entity/note_unread.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/note_watching.rs b/packages/backend/native-utils/src/model/entity/note_watching.rs index 962ef081..b69f27e1 100644 --- a/packages/backend/native-utils/src/model/entity/note_watching.rs +++ b/packages/backend/native-utils/src/model/entity/note_watching.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/notification.rs b/packages/backend/native-utils/src/model/entity/notification.rs index 896b6c2d..825c50d8 100644 --- a/packages/backend/native-utils/src/model/entity/notification.rs +++ b/packages/backend/native-utils/src/model/entity/notification.rs @@ -1,9 +1,9 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/page.rs b/packages/backend/native-utils/src/model/entity/page.rs index 579d0114..f5343707 100644 --- a/packages/backend/native-utils/src/model/entity/page.rs +++ b/packages/backend/native-utils/src/model/entity/page.rs @@ -1,9 +1,9 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 use super::sea_orm_active_enums::PageVisibilityEnum; use sea_orm::entity::prelude::*; -#[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)] diff --git a/packages/backend/native-utils/src/model/entity/page_like.rs b/packages/backend/native-utils/src/model/entity/page_like.rs index 108b6b92..a119c9e7 100644 --- a/packages/backend/native-utils/src/model/entity/page_like.rs +++ b/packages/backend/native-utils/src/model/entity/page_like.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/password_reset_request.rs b/packages/backend/native-utils/src/model/entity/password_reset_request.rs index 45cc3de1..c911d4ef 100644 --- a/packages/backend/native-utils/src/model/entity/password_reset_request.rs +++ b/packages/backend/native-utils/src/model/entity/password_reset_request.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/poll.rs b/packages/backend/native-utils/src/model/entity/poll.rs index 6bb8d042..85eb8ebb 100644 --- a/packages/backend/native-utils/src/model/entity/poll.rs +++ b/packages/backend/native-utils/src/model/entity/poll.rs @@ -1,9 +1,9 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 use super::sea_orm_active_enums::PollNotevisibilityEnum; use sea_orm::entity::prelude::*; -#[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)] diff --git a/packages/backend/native-utils/src/model/entity/poll_vote.rs b/packages/backend/native-utils/src/model/entity/poll_vote.rs index bf26bf5d..a0c49f5a 100644 --- a/packages/backend/native-utils/src/model/entity/poll_vote.rs +++ b/packages/backend/native-utils/src/model/entity/poll_vote.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/prelude.rs b/packages/backend/native-utils/src/model/entity/prelude.rs index a859a9cc..8bb154f4 100644 --- a/packages/backend/native-utils/src/model/entity/prelude.rs +++ b/packages/backend/native-utils/src/model/entity/prelude.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 pub use super::abuse_user_report::Entity as AbuseUserReport; pub use super::access_token::Entity as AccessToken; diff --git a/packages/backend/native-utils/src/model/entity/promo_note.rs b/packages/backend/native-utils/src/model/entity/promo_note.rs index 288a0ea8..174b0d22 100644 --- a/packages/backend/native-utils/src/model/entity/promo_note.rs +++ b/packages/backend/native-utils/src/model/entity/promo_note.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/promo_read.rs b/packages/backend/native-utils/src/model/entity/promo_read.rs index 4e6224cf..7ea9ff62 100644 --- a/packages/backend/native-utils/src/model/entity/promo_read.rs +++ b/packages/backend/native-utils/src/model/entity/promo_read.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/registration_ticket.rs b/packages/backend/native-utils/src/model/entity/registration_ticket.rs index 798f1958..01f8c723 100644 --- a/packages/backend/native-utils/src/model/entity/registration_ticket.rs +++ b/packages/backend/native-utils/src/model/entity/registration_ticket.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/registry_item.rs b/packages/backend/native-utils/src/model/entity/registry_item.rs index 37b1f542..3a577414 100644 --- a/packages/backend/native-utils/src/model/entity/registry_item.rs +++ b/packages/backend/native-utils/src/model/entity/registry_item.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 use sea_orm::entity::prelude::*; -#[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)] diff --git a/packages/backend/native-utils/src/model/entity/relay.rs b/packages/backend/native-utils/src/model/entity/relay.rs index bed89c84..d6d5a485 100644 --- a/packages/backend/native-utils/src/model/entity/relay.rs +++ b/packages/backend/native-utils/src/model/entity/relay.rs @@ -1,9 +1,9 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/renote_muting.rs b/packages/backend/native-utils/src/model/entity/renote_muting.rs index 44751c14..3899b772 100644 --- a/packages/backend/native-utils/src/model/entity/renote_muting.rs +++ b/packages/backend/native-utils/src/model/entity/renote_muting.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/sea_orm_active_enums.rs b/packages/backend/native-utils/src/model/entity/sea_orm_active_enums.rs index d3d5bd3e..37fb64d9 100644 --- a/packages/backend/native-utils/src/model/entity/sea_orm_active_enums.rs +++ b/packages/backend/native-utils/src/model/entity/sea_orm_active_enums.rs @@ -1,14 +1,10 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 use sea_orm::entity::prelude::*; -use parse_display::Display; -#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Default, Display)] +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)] #[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "antenna_src_enum")] -#[display(style = "camelCase")] -#[display("'{}'")] pub enum AntennaSrcEnum { - #[default] #[sea_orm(string_value = "all")] All, #[sea_orm(string_value = "group")] @@ -22,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")] @@ -39,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", @@ -50,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")] @@ -58,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")] @@ -75,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", @@ -88,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", @@ -123,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", @@ -136,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", @@ -153,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", @@ -198,7 +186,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, +} diff --git a/packages/backend/native-utils/src/model/entity/signin.rs b/packages/backend/native-utils/src/model/entity/signin.rs index 60bbc33d..8a2d654e 100644 --- a/packages/backend/native-utils/src/model/entity/signin.rs +++ b/packages/backend/native-utils/src/model/entity/signin.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/sw_subscription.rs b/packages/backend/native-utils/src/model/entity/sw_subscription.rs index 1be9e046..a9cb302c 100644 --- a/packages/backend/native-utils/src/model/entity/sw_subscription.rs +++ b/packages/backend/native-utils/src/model/entity/sw_subscription.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/used_username.rs b/packages/backend/native-utils/src/model/entity/used_username.rs index 620950b6..ff4173f4 100644 --- a/packages/backend/native-utils/src/model/entity/used_username.rs +++ b/packages/backend/native-utils/src/model/entity/used_username.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/user.rs b/packages/backend/native-utils/src/model/entity/user.rs index 71344905..64de22db 100644 --- a/packages/backend/native-utils/src/model/entity/user.rs +++ b/packages/backend/native-utils/src/model/entity/user.rs @@ -1,9 +1,9 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 use super::sea_orm_active_enums::UserEmojimodpermEnum; use sea_orm::entity::prelude::*; -#[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)] diff --git a/packages/backend/native-utils/src/model/entity/user_group.rs b/packages/backend/native-utils/src/model/entity/user_group.rs index 74ee4f22..16f2638d 100644 --- a/packages/backend/native-utils/src/model/entity/user_group.rs +++ b/packages/backend/native-utils/src/model/entity/user_group.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/user_group_invitation.rs b/packages/backend/native-utils/src/model/entity/user_group_invitation.rs index baa6fea8..79ad987c 100644 --- a/packages/backend/native-utils/src/model/entity/user_group_invitation.rs +++ b/packages/backend/native-utils/src/model/entity/user_group_invitation.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/user_group_invite.rs b/packages/backend/native-utils/src/model/entity/user_group_invite.rs index dbbc055f..afc284e6 100644 --- a/packages/backend/native-utils/src/model/entity/user_group_invite.rs +++ b/packages/backend/native-utils/src/model/entity/user_group_invite.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/user_group_joining.rs b/packages/backend/native-utils/src/model/entity/user_group_joining.rs index e7741520..95fb0189 100644 --- a/packages/backend/native-utils/src/model/entity/user_group_joining.rs +++ b/packages/backend/native-utils/src/model/entity/user_group_joining.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/user_ip.rs b/packages/backend/native-utils/src/model/entity/user_ip.rs index ce0af264..91d5c6b9 100644 --- a/packages/backend/native-utils/src/model/entity/user_ip.rs +++ b/packages/backend/native-utils/src/model/entity/user_ip.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/user_keypair.rs b/packages/backend/native-utils/src/model/entity/user_keypair.rs index 0382d5d7..3d7dc9ab 100644 --- a/packages/backend/native-utils/src/model/entity/user_keypair.rs +++ b/packages/backend/native-utils/src/model/entity/user_keypair.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/user_list.rs b/packages/backend/native-utils/src/model/entity/user_list.rs index 7cc97213..fcb89668 100644 --- a/packages/backend/native-utils/src/model/entity/user_list.rs +++ b/packages/backend/native-utils/src/model/entity/user_list.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/user_list_joining.rs b/packages/backend/native-utils/src/model/entity/user_list_joining.rs index 4f28a21d..9b6a5ac7 100644 --- a/packages/backend/native-utils/src/model/entity/user_list_joining.rs +++ b/packages/backend/native-utils/src/model/entity/user_list_joining.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/user_note_pining.rs b/packages/backend/native-utils/src/model/entity/user_note_pining.rs index e657fcb5..b46ae46b 100644 --- a/packages/backend/native-utils/src/model/entity/user_note_pining.rs +++ b/packages/backend/native-utils/src/model/entity/user_note_pining.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/user_pending.rs b/packages/backend/native-utils/src/model/entity/user_pending.rs index 297fe553..ff48a434 100644 --- a/packages/backend/native-utils/src/model/entity/user_pending.rs +++ b/packages/backend/native-utils/src/model/entity/user_pending.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/user_profile.rs b/packages/backend/native-utils/src/model/entity/user_profile.rs index 57e9c8c1..dfec51d8 100644 --- a/packages/backend/native-utils/src/model/entity/user_profile.rs +++ b/packages/backend/native-utils/src/model/entity/user_profile.rs @@ -1,9 +1,10 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 use super::sea_orm_active_enums::UserProfileFfvisibilityEnum; +use super::sea_orm_active_enums::UserProfileMutingnotificationtypesEnum; use sea_orm::entity::prelude::*; -#[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)] @@ -51,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: Vec, + pub muting_notification_types: Vec, #[sea_orm(column_name = "noCrawle")] pub no_crawle: bool, #[sea_orm(column_name = "receiveAnnouncementEmail")] diff --git a/packages/backend/native-utils/src/model/entity/user_publickey.rs b/packages/backend/native-utils/src/model/entity/user_publickey.rs index b1f426c5..4f17f4ed 100644 --- a/packages/backend/native-utils/src/model/entity/user_publickey.rs +++ b/packages/backend/native-utils/src/model/entity/user_publickey.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/user_security_key.rs b/packages/backend/native-utils/src/model/entity/user_security_key.rs index 4bc97633..133e0684 100644 --- a/packages/backend/native-utils/src/model/entity/user_security_key.rs +++ b/packages/backend/native-utils/src/model/entity/user_security_key.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 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)] diff --git a/packages/backend/native-utils/src/model/entity/webhook.rs b/packages/backend/native-utils/src/model/entity/webhook.rs index b44b0aa8..add6737b 100644 --- a/packages/backend/native-utils/src/model/entity/webhook.rs +++ b/packages/backend/native-utils/src/model/entity/webhook.rs @@ -1,8 +1,8 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 use sea_orm::entity::prelude::*; -#[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)] diff --git a/packages/backend/native-utils/src/model/schema.rs b/packages/backend/native-utils/src/model/schema.rs index 4c0ca794..843a9351 100644 --- a/packages/backend/native-utils/src/model/schema.rs +++ b/packages/backend/native-utils/src/model/schema.rs @@ -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 { .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; - } -} diff --git a/packages/backend/native-utils/src/model/schema/antenna.rs b/packages/backend/native-utils/src/model/schema/antenna.rs deleted file mode 100644 index da2c3061..00000000 --- a/packages/backend/native-utils/src/model/schema/antenna.rs +++ /dev/null @@ -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, - pub name: String, - pub keywords: Vec>, - pub exclude_keywords: Vec>, - #[schema(inline)] - pub src: AntennaSrc, - pub user_list_id: Option, - pub user_group_id: Option, - pub users: Vec, - pub instances: Vec, - #[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 for super::AntennaSrc { - type Error = model::error::Error; - - fn try_from(value: AntennaSrcEnum) -> Result { - value.to_string().parse().map_err(model::error::Error::from) - } -} - -// ---- TODO: could be macro -impl Schema for super::Antenna {} -pub static VALIDATOR: Lazy = 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>, - pub exclude_keywords: Vec>, - #[schema(inline)] - pub src: NativeAntennaSrc, - pub user_list_id: Option, - pub user_group_id: Option, - pub users: Vec, - pub instances: Vec, - #[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 { - 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 = 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" - ] - ); - } -} diff --git a/packages/backend/native-utils/src/model/schema/app.rs b/packages/backend/native-utils/src/model/schema/app.rs deleted file mode 100644 index 1da7b352..00000000 --- a/packages/backend/native-utils/src/model/schema/app.rs +++ /dev/null @@ -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, - #[schema(inline)] - pub permission: Vec, - pub secret: Option, - pub is_authorized: Option, -} - -/// 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 for App {} - -pub static VALIDATOR: Lazy = 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 = 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"] - ); - } -} diff --git a/packages/backend/src/db/postgre.ts b/packages/backend/src/db/postgre.ts index 4090cc50..79d7ae30 100644 --- a/packages/backend/src/db/postgre.ts +++ b/packages/backend/src/db/postgre.ts @@ -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();