From 4e82dab1eb13a1411aefa172c779e5a2a74e85dd Mon Sep 17 00:00:00 2001 From: Namekuji Date: Thu, 25 May 2023 02:34:48 -0400 Subject: [PATCH] add entities and two schemas --- packages/backend/native-utils/.editorconfig | 3 + packages/backend/native-utils/Cargo.toml | 3 + packages/backend/native-utils/build.rs | 2 +- .../native-utils/crates/model/Cargo.toml | 17 + .../model/src/entity/abuse_user_report.rs | 56 +++ .../crates/model/src/entity/access_token.rs | 70 +++ .../crates/model/src/entity/ad.rs | 27 ++ .../crates/model/src/entity/announcement.rs | 33 ++ .../model/src/entity/announcement_read.rs | 51 +++ .../crates/model/src/entity/antenna.rs | 93 ++++ .../crates/model/src/entity/antenna_note.rs | 50 +++ .../crates/model/src/entity/app.rs | 57 +++ .../model/src/entity/attestation_challenge.rs | 38 ++ .../crates/model/src/entity/auth_session.rs | 52 +++ .../crates/model/src/entity/blocking.rs | 39 ++ .../crates/model/src/entity/channel.rs | 83 ++++ .../model/src/entity/channel_following.rs | 51 +++ .../model/src/entity/channel_note_pining.rs | 51 +++ .../crates/model/src/entity/clip.rs | 47 ++ .../crates/model/src/entity/clip_note.rs | 49 ++ .../crates/model/src/entity/drive_file.rs | 114 +++++ .../crates/model/src/entity/drive_folder.rs | 54 +++ .../crates/model/src/entity/emoji.rs | 31 ++ .../crates/model/src/entity/follow_request.rs | 61 +++ .../crates/model/src/entity/following.rs | 51 +++ .../crates/model/src/entity/gallery_like.rs | 51 +++ .../crates/model/src/entity/gallery_post.rs | 54 +++ .../crates/model/src/entity/hashtag.rs | 41 ++ .../crates/model/src/entity/instance.rs | 59 +++ .../model/src/entity/messaging_message.rs | 76 ++++ .../crates/model/src/entity/meta.rs | 211 +++++++++ .../crates/model/src/entity/migrations.rs | 18 + .../crates/model/src/entity/mod.rs | 75 ++++ .../crates/model/src/entity/moderation_log.rs | 38 ++ .../crates/model/src/entity/muted_note.rs | 51 +++ .../crates/model/src/entity/muting.rs | 41 ++ .../crates/model/src/entity/note.rs | 235 ++++++++++ .../crates/model/src/entity/note_edit.rs | 40 ++ .../crates/model/src/entity/note_favorite.rs | 51 +++ .../crates/model/src/entity/note_reaction.rs | 52 +++ .../model/src/entity/note_thread_muting.rs | 37 ++ .../crates/model/src/entity/note_unread.rs | 57 +++ .../crates/model/src/entity/note_watching.rs | 53 +++ .../crates/model/src/entity/notification.rs | 115 +++++ .../crates/model/src/entity/page.rs | 90 ++++ .../crates/model/src/entity/page_like.rs | 51 +++ .../src/entity/password_reset_request.rs | 36 ++ .../crates/model/src/entity/poll.rs | 43 ++ .../crates/model/src/entity/poll_vote.rs | 52 +++ .../crates/model/src/entity/prelude.rs | 72 +++ .../crates/model/src/entity/promo_note.rs | 35 ++ .../crates/model/src/entity/promo_read.rs | 51 +++ .../model/src/entity/registration_ticket.rs | 19 + .../crates/model/src/entity/registry_item.rs | 42 ++ .../crates/model/src/entity/relay.rs | 19 + .../crates/model/src/entity/renote_muting.rs | 22 + .../crates/model/src/entity/reversi_game.rs | 68 +++ .../model/src/entity/reversi_matching.rs | 39 ++ .../model/src/entity/sea_orm_active_enums.rs | 175 ++++++++ .../crates/model/src/entity/signin.rs | 39 ++ .../model/src/entity/sw_subscription.rs | 40 ++ .../crates/model/src/entity/used_username.rs | 18 + .../crates/model/src/entity/user.rs | 425 ++++++++++++++++++ .../crates/model/src/entity/user_group.rs | 70 +++ .../model/src/entity/user_group_invitation.rs | 59 +++ .../model/src/entity/user_group_invite.rs | 51 +++ .../model/src/entity/user_group_joining.rs | 59 +++ .../crates/model/src/entity/user_ip.rs | 21 + .../crates/model/src/entity/user_keypair.rs | 35 ++ .../crates/model/src/entity/user_list.rs | 52 +++ .../model/src/entity/user_list_joining.rs | 51 +++ .../model/src/entity/user_note_pining.rs | 51 +++ .../crates/model/src/entity/user_pending.rs | 22 + .../crates/model/src/entity/user_profile.rs | 111 +++++ .../crates/model/src/entity/user_publickey.rs | 35 ++ .../model/src/entity/user_security_key.rs | 38 ++ .../crates/model/src/entity/webhook.rs | 44 ++ .../native-utils/crates/model/src/lib.rs | 3 + .../model/src/repository/abuse_user_report.rs | 1 + .../crates/model/src/repository/mod.rs | 1 + .../crates/model/src/schema/antenna.rs | 128 ++++++ .../crates/model/src/schema/app.rs | 108 +++++ .../crates/model/src/schema/mod.rs | 21 + packages/backend/native-utils/rustfmt.toml | 2 - packages/backend/native-utils/src/lib.rs | 1 - .../backend/native-utils/src/mastodon_api.rs | 78 ++-- 86 files changed, 4873 insertions(+), 43 deletions(-) create mode 100644 packages/backend/native-utils/.editorconfig create mode 100644 packages/backend/native-utils/crates/model/Cargo.toml create mode 100644 packages/backend/native-utils/crates/model/src/entity/abuse_user_report.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/access_token.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/ad.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/announcement.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/announcement_read.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/antenna.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/antenna_note.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/app.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/attestation_challenge.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/auth_session.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/blocking.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/channel.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/channel_following.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/channel_note_pining.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/clip.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/clip_note.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/drive_file.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/drive_folder.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/emoji.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/follow_request.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/following.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/gallery_like.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/gallery_post.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/hashtag.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/instance.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/messaging_message.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/meta.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/migrations.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/mod.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/moderation_log.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/muted_note.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/muting.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/note.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/note_edit.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/note_favorite.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/note_reaction.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/note_thread_muting.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/note_unread.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/note_watching.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/notification.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/page.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/page_like.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/password_reset_request.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/poll.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/poll_vote.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/prelude.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/promo_note.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/promo_read.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/registration_ticket.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/registry_item.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/relay.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/renote_muting.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/reversi_game.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/reversi_matching.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/sea_orm_active_enums.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/signin.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/sw_subscription.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/used_username.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/user.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/user_group.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/user_group_invitation.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/user_group_invite.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/user_group_joining.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/user_ip.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/user_keypair.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/user_list.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/user_list_joining.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/user_note_pining.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/user_pending.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/user_profile.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/user_publickey.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/user_security_key.rs create mode 100644 packages/backend/native-utils/crates/model/src/entity/webhook.rs create mode 100644 packages/backend/native-utils/crates/model/src/lib.rs create mode 100644 packages/backend/native-utils/crates/model/src/repository/abuse_user_report.rs create mode 100644 packages/backend/native-utils/crates/model/src/repository/mod.rs create mode 100644 packages/backend/native-utils/crates/model/src/schema/antenna.rs create mode 100644 packages/backend/native-utils/crates/model/src/schema/app.rs create mode 100644 packages/backend/native-utils/crates/model/src/schema/mod.rs delete mode 100644 packages/backend/native-utils/rustfmt.toml diff --git a/packages/backend/native-utils/.editorconfig b/packages/backend/native-utils/.editorconfig new file mode 100644 index 000000000..889b72e11 --- /dev/null +++ b/packages/backend/native-utils/.editorconfig @@ -0,0 +1,3 @@ +[*.rs] +indent_style = space +indent_size = 4 diff --git a/packages/backend/native-utils/Cargo.toml b/packages/backend/native-utils/Cargo.toml index 4f7fb4c39..6f3c0e23f 100644 --- a/packages/backend/native-utils/Cargo.toml +++ b/packages/backend/native-utils/Cargo.toml @@ -3,6 +3,9 @@ edition = "2021" name = "native-utils" version = "0.0.0" +[workspace] +members = ["crates/*"] + [lib] crate-type = ["cdylib"] diff --git a/packages/backend/native-utils/build.rs b/packages/backend/native-utils/build.rs index 1f866b6a3..9fc236788 100644 --- a/packages/backend/native-utils/build.rs +++ b/packages/backend/native-utils/build.rs @@ -1,5 +1,5 @@ extern crate napi_build; fn main() { - napi_build::setup(); + napi_build::setup(); } diff --git a/packages/backend/native-utils/crates/model/Cargo.toml b/packages/backend/native-utils/crates/model/Cargo.toml new file mode 100644 index 000000000..7b492a89d --- /dev/null +++ b/packages/backend/native-utils/crates/model/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "model" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +chrono = "0.4.24" +jsonschema = "0.17.0" +once_cell = "1.17.1" +schemars = { version = "0.8.12", features = ["chrono"] } +sea-orm = { version = "0.11.3", features = ["postgres-array", "sqlx-postgres", "runtime-tokio-rustls", "mock"] } +serde = { version = "1.0.163", features = ["derive"] } +serde_json = "1.0.96" +tokio = { version = "1.28.1", features = ["sync"] } +utoipa = "3.3.0" diff --git a/packages/backend/native-utils/crates/model/src/entity/abuse_user_report.rs b/packages/backend/native-utils/crates/model/src/entity/abuse_user_report.rs new file mode 100644 index 000000000..163a686ab --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/abuse_user_report.rs @@ -0,0 +1,56 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "abuse_user_report")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "targetUserId")] + pub target_user_id: String, + #[sea_orm(column_name = "reporterId")] + pub reporter_id: String, + #[sea_orm(column_name = "assigneeId")] + pub assignee_id: Option, + pub resolved: bool, + pub comment: String, + #[sea_orm(column_name = "targetUserHost")] + pub target_user_host: Option, + #[sea_orm(column_name = "reporterHost")] + pub reporter_host: Option, + pub forwarded: bool, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::ReporterId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User3, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::AssigneeId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "SetNull" + )] + User2, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::TargetUserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User1, +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/access_token.rs b/packages/backend/native-utils/crates/model/src/entity/access_token.rs new file mode 100644 index 000000000..ba3a43d64 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/access_token.rs @@ -0,0 +1,70 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "access_token")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + pub token: String, + pub hash: String, + #[sea_orm(column_name = "userId")] + pub user_id: String, + #[sea_orm(column_name = "appId")] + pub app_id: Option, + #[sea_orm(column_name = "lastUsedAt")] + pub last_used_at: Option, + pub session: Option, + pub name: Option, + pub description: Option, + #[sea_orm(column_name = "iconUrl")] + pub icon_url: Option, + pub permission: Vec, + pub fetched: bool, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::app::Entity", + from = "Column::AppId", + to = "super::app::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + App, + #[sea_orm(has_many = "super::notification::Entity")] + Notification, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::App.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Notification.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/ad.rs b/packages/backend/native-utils/crates/model/src/entity/ad.rs new file mode 100644 index 000000000..4e31c7b0d --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/ad.rs @@ -0,0 +1,27 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "ad")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "expiresAt")] + pub expires_at: DateTimeWithTimeZone, + pub place: String, + pub priority: String, + pub url: String, + #[sea_orm(column_name = "imageUrl")] + pub image_url: String, + pub memo: String, + pub ratio: i32, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation {} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/announcement.rs b/packages/backend/native-utils/crates/model/src/entity/announcement.rs new file mode 100644 index 000000000..0f02a1ca9 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/announcement.rs @@ -0,0 +1,33 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "announcement")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + pub text: String, + pub title: String, + #[sea_orm(column_name = "imageUrl")] + pub image_url: Option, + #[sea_orm(column_name = "updatedAt")] + pub updated_at: Option, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm(has_many = "super::announcement_read::Entity")] + AnnouncementRead, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::AnnouncementRead.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/announcement_read.rs b/packages/backend/native-utils/crates/model/src/entity/announcement_read.rs new file mode 100644 index 000000000..ad7dcc6f2 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/announcement_read.rs @@ -0,0 +1,51 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "announcement_read")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "userId")] + pub user_id: String, + #[sea_orm(column_name = "announcementId")] + pub announcement_id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::announcement::Entity", + from = "Column::AnnouncementId", + to = "super::announcement::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + Announcement, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Announcement.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/antenna.rs b/packages/backend/native-utils/crates/model/src/entity/antenna.rs new file mode 100644 index 000000000..f9c040b59 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/antenna.rs @@ -0,0 +1,93 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use super::sea_orm_active_enums::AntennaSrcEnum; +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "antenna")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "userId")] + pub user_id: String, + pub name: String, + pub src: AntennaSrcEnum, + #[sea_orm(column_name = "userListId")] + pub user_list_id: Option, + #[sea_orm(column_type = "JsonBinary")] + pub keywords: Json, + #[sea_orm(column_name = "withFile")] + pub with_file: bool, + pub expression: Option, + pub notify: bool, + #[sea_orm(column_name = "caseSensitive")] + pub case_sensitive: bool, + #[sea_orm(column_name = "withReplies")] + pub with_replies: bool, + #[sea_orm(column_name = "userGroupJoiningId")] + pub user_group_joining_id: Option, + pub users: Vec, + #[sea_orm(column_name = "excludeKeywords", column_type = "JsonBinary")] + pub exclude_keywords: Json, + #[sea_orm(column_type = "JsonBinary")] + pub instances: Json, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm(has_many = "super::antenna_note::Entity")] + AntennaNote, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, + #[sea_orm( + belongs_to = "super::user_group_joining::Entity", + from = "Column::UserGroupJoiningId", + to = "super::user_group_joining::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + UserGroupJoining, + #[sea_orm( + belongs_to = "super::user_list::Entity", + from = "Column::UserListId", + to = "super::user_list::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + UserList, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::AntennaNote.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::UserGroupJoining.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::UserList.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/antenna_note.rs b/packages/backend/native-utils/crates/model/src/entity/antenna_note.rs new file mode 100644 index 000000000..ecf7b88f7 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/antenna_note.rs @@ -0,0 +1,50 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "antenna_note")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "noteId")] + pub note_id: String, + #[sea_orm(column_name = "antennaId")] + pub antenna_id: String, + pub read: bool, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::antenna::Entity", + from = "Column::AntennaId", + to = "super::antenna::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + Antenna, + #[sea_orm( + belongs_to = "super::note::Entity", + from = "Column::NoteId", + to = "super::note::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + Note, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Antenna.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Note.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/app.rs b/packages/backend/native-utils/crates/model/src/entity/app.rs new file mode 100644 index 000000000..bd6ae5acf --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/app.rs @@ -0,0 +1,57 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "app")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "userId")] + pub user_id: Option, + pub secret: String, + pub name: String, + pub description: String, + pub permission: Vec, + #[sea_orm(column_name = "callbackUrl")] + pub callback_url: Option, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm(has_many = "super::access_token::Entity")] + AccessToken, + #[sea_orm(has_many = "super::auth_session::Entity")] + AuthSession, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "SetNull" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::AccessToken.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::AuthSession.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/attestation_challenge.rs b/packages/backend/native-utils/crates/model/src/entity/attestation_challenge.rs new file mode 100644 index 000000000..25da1ae57 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/attestation_challenge.rs @@ -0,0 +1,38 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "attestation_challenge")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "userId", primary_key, auto_increment = false)] + pub user_id: String, + pub challenge: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "registrationChallenge")] + pub registration_challenge: bool, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/auth_session.rs b/packages/backend/native-utils/crates/model/src/entity/auth_session.rs new file mode 100644 index 000000000..c3b2fab54 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/auth_session.rs @@ -0,0 +1,52 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "auth_session")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + pub token: String, + #[sea_orm(column_name = "userId")] + pub user_id: Option, + #[sea_orm(column_name = "appId")] + pub app_id: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::app::Entity", + from = "Column::AppId", + to = "super::app::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + App, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::App.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/blocking.rs b/packages/backend/native-utils/crates/model/src/entity/blocking.rs new file mode 100644 index 000000000..c9092e50d --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/blocking.rs @@ -0,0 +1,39 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "blocking")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "blockeeId")] + pub blockee_id: String, + #[sea_orm(column_name = "blockerId")] + pub blocker_id: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::BlockerId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User2, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::BlockeeId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User1, +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/channel.rs b/packages/backend/native-utils/crates/model/src/entity/channel.rs new file mode 100644 index 000000000..b39b57f56 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/channel.rs @@ -0,0 +1,83 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "channel")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "lastNotedAt")] + pub last_noted_at: Option, + #[sea_orm(column_name = "userId")] + pub user_id: Option, + pub name: String, + pub description: Option, + #[sea_orm(column_name = "bannerId")] + pub banner_id: Option, + #[sea_orm(column_name = "notesCount")] + pub notes_count: i32, + #[sea_orm(column_name = "usersCount")] + pub users_count: i32, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm(has_many = "super::channel_following::Entity")] + ChannelFollowing, + #[sea_orm(has_many = "super::channel_note_pining::Entity")] + ChannelNotePining, + #[sea_orm( + belongs_to = "super::drive_file::Entity", + from = "Column::BannerId", + to = "super::drive_file::Column::Id", + on_update = "NoAction", + on_delete = "SetNull" + )] + DriveFile, + #[sea_orm(has_many = "super::note::Entity")] + Note, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "SetNull" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::ChannelFollowing.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::ChannelNotePining.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::DriveFile.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Note.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/channel_following.rs b/packages/backend/native-utils/crates/model/src/entity/channel_following.rs new file mode 100644 index 000000000..a415b6c32 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/channel_following.rs @@ -0,0 +1,51 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "channel_following")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "followeeId")] + pub followee_id: String, + #[sea_orm(column_name = "followerId")] + pub follower_id: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::channel::Entity", + from = "Column::FolloweeId", + to = "super::channel::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + Channel, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::FollowerId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Channel.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/channel_note_pining.rs b/packages/backend/native-utils/crates/model/src/entity/channel_note_pining.rs new file mode 100644 index 000000000..16f80b91d --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/channel_note_pining.rs @@ -0,0 +1,51 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "channel_note_pining")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "channelId")] + pub channel_id: String, + #[sea_orm(column_name = "noteId")] + pub note_id: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::channel::Entity", + from = "Column::ChannelId", + to = "super::channel::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + Channel, + #[sea_orm( + belongs_to = "super::note::Entity", + from = "Column::NoteId", + to = "super::note::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + Note, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Channel.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Note.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/clip.rs b/packages/backend/native-utils/crates/model/src/entity/clip.rs new file mode 100644 index 000000000..6cf1ac1c8 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/clip.rs @@ -0,0 +1,47 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "clip")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "userId")] + pub user_id: String, + pub name: String, + #[sea_orm(column_name = "isPublic")] + pub is_public: bool, + pub description: Option, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm(has_many = "super::clip_note::Entity")] + ClipNote, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::ClipNote.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/clip_note.rs b/packages/backend/native-utils/crates/model/src/entity/clip_note.rs new file mode 100644 index 000000000..ba7114c3b --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/clip_note.rs @@ -0,0 +1,49 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "clip_note")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "noteId")] + pub note_id: String, + #[sea_orm(column_name = "clipId")] + pub clip_id: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::clip::Entity", + from = "Column::ClipId", + to = "super::clip::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + Clip, + #[sea_orm( + belongs_to = "super::note::Entity", + from = "Column::NoteId", + to = "super::note::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + Note, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Clip.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Note.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/drive_file.rs b/packages/backend/native-utils/crates/model/src/entity/drive_file.rs new file mode 100644 index 000000000..5b3d17b00 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/drive_file.rs @@ -0,0 +1,114 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "drive_file")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "userId")] + pub user_id: Option, + #[sea_orm(column_name = "userHost")] + pub user_host: Option, + pub md5: String, + pub name: String, + pub r#type: String, + pub size: i32, + pub comment: Option, + #[sea_orm(column_type = "JsonBinary")] + pub properties: Json, + #[sea_orm(column_name = "storedInternal")] + pub stored_internal: bool, + pub url: String, + #[sea_orm(column_name = "thumbnailUrl")] + pub thumbnail_url: Option, + #[sea_orm(column_name = "webpublicUrl")] + pub webpublic_url: Option, + #[sea_orm(column_name = "accessKey")] + pub access_key: Option, + #[sea_orm(column_name = "thumbnailAccessKey")] + pub thumbnail_access_key: Option, + #[sea_orm(column_name = "webpublicAccessKey")] + pub webpublic_access_key: Option, + pub uri: Option, + pub src: Option, + #[sea_orm(column_name = "folderId")] + pub folder_id: Option, + #[sea_orm(column_name = "isSensitive")] + pub is_sensitive: bool, + #[sea_orm(column_name = "isLink")] + pub is_link: bool, + pub blurhash: Option, + #[sea_orm(column_name = "webpublicType")] + pub webpublic_type: Option, + #[sea_orm(column_name = "requestHeaders", column_type = "JsonBinary", nullable)] + pub request_headers: Option, + #[sea_orm(column_name = "requestIp")] + pub request_ip: Option, + #[sea_orm(column_name = "maybeSensitive")] + pub maybe_sensitive: bool, + #[sea_orm(column_name = "maybePorn")] + pub maybe_porn: bool, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm(has_many = "super::channel::Entity")] + Channel, + #[sea_orm( + belongs_to = "super::drive_folder::Entity", + from = "Column::FolderId", + to = "super::drive_folder::Column::Id", + on_update = "NoAction", + on_delete = "SetNull" + )] + DriveFolder, + #[sea_orm(has_many = "super::messaging_message::Entity")] + MessagingMessage, + #[sea_orm(has_many = "super::page::Entity")] + Page, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "SetNull" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Channel.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::DriveFolder.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::MessagingMessage.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Page.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/drive_folder.rs b/packages/backend/native-utils/crates/model/src/entity/drive_folder.rs new file mode 100644 index 000000000..9756f7053 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/drive_folder.rs @@ -0,0 +1,54 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "drive_folder")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + pub name: String, + #[sea_orm(column_name = "userId")] + pub user_id: Option, + #[sea_orm(column_name = "parentId")] + pub parent_id: Option, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm(has_many = "super::drive_file::Entity")] + DriveFile, + #[sea_orm( + belongs_to = "Entity", + from = "Column::ParentId", + to = "Column::Id", + on_update = "NoAction", + on_delete = "SetNull" + )] + SelfRef, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::DriveFile.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/emoji.rs b/packages/backend/native-utils/crates/model/src/entity/emoji.rs new file mode 100644 index 000000000..9dff7c719 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/emoji.rs @@ -0,0 +1,31 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "emoji")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "updatedAt")] + pub updated_at: Option, + pub name: String, + pub host: Option, + #[sea_orm(column_name = "originalUrl")] + pub original_url: String, + pub uri: Option, + pub r#type: Option, + pub aliases: Vec, + pub category: Option, + #[sea_orm(column_name = "publicUrl")] + pub public_url: String, + pub license: Option, + pub width: Option, + pub height: Option, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation {} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/follow_request.rs b/packages/backend/native-utils/crates/model/src/entity/follow_request.rs new file mode 100644 index 000000000..32e31a09d --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/follow_request.rs @@ -0,0 +1,61 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "follow_request")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "followeeId")] + pub followee_id: String, + #[sea_orm(column_name = "followerId")] + pub follower_id: String, + #[sea_orm(column_name = "requestId")] + pub request_id: Option, + #[sea_orm(column_name = "followerHost")] + pub follower_host: Option, + #[sea_orm(column_name = "followerInbox")] + pub follower_inbox: Option, + #[sea_orm(column_name = "followerSharedInbox")] + pub follower_shared_inbox: Option, + #[sea_orm(column_name = "followeeHost")] + pub followee_host: Option, + #[sea_orm(column_name = "followeeInbox")] + pub followee_inbox: Option, + #[sea_orm(column_name = "followeeSharedInbox")] + pub followee_shared_inbox: Option, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm(has_many = "super::notification::Entity")] + Notification, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::FolloweeId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User2, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::FollowerId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User1, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Notification.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/following.rs b/packages/backend/native-utils/crates/model/src/entity/following.rs new file mode 100644 index 000000000..6f339e05d --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/following.rs @@ -0,0 +1,51 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "following")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "followeeId")] + pub followee_id: String, + #[sea_orm(column_name = "followerId")] + pub follower_id: String, + #[sea_orm(column_name = "followerHost")] + pub follower_host: Option, + #[sea_orm(column_name = "followerInbox")] + pub follower_inbox: Option, + #[sea_orm(column_name = "followerSharedInbox")] + pub follower_shared_inbox: Option, + #[sea_orm(column_name = "followeeHost")] + pub followee_host: Option, + #[sea_orm(column_name = "followeeInbox")] + pub followee_inbox: Option, + #[sea_orm(column_name = "followeeSharedInbox")] + pub followee_shared_inbox: Option, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::FolloweeId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User2, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::FollowerId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User1, +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/gallery_like.rs b/packages/backend/native-utils/crates/model/src/entity/gallery_like.rs new file mode 100644 index 000000000..0fdbf07ef --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/gallery_like.rs @@ -0,0 +1,51 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "gallery_like")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "userId")] + pub user_id: String, + #[sea_orm(column_name = "postId")] + pub post_id: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::gallery_post::Entity", + from = "Column::PostId", + to = "super::gallery_post::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + GalleryPost, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::GalleryPost.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/gallery_post.rs b/packages/backend/native-utils/crates/model/src/entity/gallery_post.rs new file mode 100644 index 000000000..a23ebbd8f --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/gallery_post.rs @@ -0,0 +1,54 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "gallery_post")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "updatedAt")] + pub updated_at: DateTimeWithTimeZone, + pub title: String, + pub description: Option, + #[sea_orm(column_name = "userId")] + pub user_id: String, + #[sea_orm(column_name = "fileIds")] + pub file_ids: Vec, + #[sea_orm(column_name = "isSensitive")] + pub is_sensitive: bool, + #[sea_orm(column_name = "likedCount")] + pub liked_count: i32, + pub tags: Vec, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm(has_many = "super::gallery_like::Entity")] + GalleryLike, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::GalleryLike.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/hashtag.rs b/packages/backend/native-utils/crates/model/src/entity/hashtag.rs new file mode 100644 index 000000000..a83ebbf29 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/hashtag.rs @@ -0,0 +1,41 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[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: Vec, + #[sea_orm(column_name = "mentionedUsersCount")] + pub mentioned_users_count: i32, + #[sea_orm(column_name = "mentionedLocalUserIds")] + pub mentioned_local_user_ids: Vec, + #[sea_orm(column_name = "mentionedLocalUsersCount")] + pub mentioned_local_users_count: i32, + #[sea_orm(column_name = "mentionedRemoteUserIds")] + pub mentioned_remote_user_ids: Vec, + #[sea_orm(column_name = "mentionedRemoteUsersCount")] + pub mentioned_remote_users_count: i32, + #[sea_orm(column_name = "attachedUserIds")] + pub attached_user_ids: Vec, + #[sea_orm(column_name = "attachedUsersCount")] + pub attached_users_count: i32, + #[sea_orm(column_name = "attachedLocalUserIds")] + pub attached_local_user_ids: Vec, + #[sea_orm(column_name = "attachedLocalUsersCount")] + pub attached_local_users_count: i32, + #[sea_orm(column_name = "attachedRemoteUserIds")] + pub attached_remote_user_ids: Vec, + #[sea_orm(column_name = "attachedRemoteUsersCount")] + pub attached_remote_users_count: i32, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation {} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/instance.rs b/packages/backend/native-utils/crates/model/src/entity/instance.rs new file mode 100644 index 000000000..405648efc --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/instance.rs @@ -0,0 +1,59 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "instance")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "caughtAt")] + pub caught_at: DateTimeWithTimeZone, + pub host: String, + #[sea_orm(column_name = "usersCount")] + pub users_count: i32, + #[sea_orm(column_name = "notesCount")] + pub notes_count: i32, + #[sea_orm(column_name = "followingCount")] + pub following_count: i32, + #[sea_orm(column_name = "followersCount")] + pub followers_count: i32, + #[sea_orm(column_name = "latestRequestSentAt")] + pub latest_request_sent_at: Option, + #[sea_orm(column_name = "latestStatus")] + pub latest_status: Option, + #[sea_orm(column_name = "latestRequestReceivedAt")] + pub latest_request_received_at: Option, + #[sea_orm(column_name = "lastCommunicatedAt")] + pub last_communicated_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "isNotResponding")] + pub is_not_responding: bool, + #[sea_orm(column_name = "softwareName")] + pub software_name: Option, + #[sea_orm(column_name = "softwareVersion")] + pub software_version: Option, + #[sea_orm(column_name = "openRegistrations")] + pub open_registrations: Option, + pub name: Option, + pub description: Option, + #[sea_orm(column_name = "maintainerName")] + pub maintainer_name: Option, + #[sea_orm(column_name = "maintainerEmail")] + pub maintainer_email: Option, + #[sea_orm(column_name = "infoUpdatedAt")] + pub info_updated_at: Option, + #[sea_orm(column_name = "isSuspended")] + pub is_suspended: bool, + #[sea_orm(column_name = "iconUrl")] + pub icon_url: Option, + #[sea_orm(column_name = "themeColor")] + pub theme_color: Option, + #[sea_orm(column_name = "faviconUrl")] + pub favicon_url: Option, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation {} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/messaging_message.rs b/packages/backend/native-utils/crates/model/src/entity/messaging_message.rs new file mode 100644 index 000000000..cfb896371 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/messaging_message.rs @@ -0,0 +1,76 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "messaging_message")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "userId")] + pub user_id: String, + #[sea_orm(column_name = "recipientId")] + pub recipient_id: Option, + pub text: Option, + #[sea_orm(column_name = "isRead")] + pub is_read: bool, + #[sea_orm(column_name = "fileId")] + pub file_id: Option, + #[sea_orm(column_name = "groupId")] + pub group_id: Option, + pub reads: Vec, + pub uri: Option, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::drive_file::Entity", + from = "Column::FileId", + to = "super::drive_file::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + DriveFile, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User2, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::RecipientId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User1, + #[sea_orm( + belongs_to = "super::user_group::Entity", + from = "Column::GroupId", + to = "super::user_group::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + UserGroup, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::DriveFile.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::UserGroup.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/meta.rs b/packages/backend/native-utils/crates/model/src/entity/meta.rs new file mode 100644 index 000000000..768c725aa --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/meta.rs @@ -0,0 +1,211 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use super::sea_orm_active_enums::MetaSensitivemediadetectionEnum; +use super::sea_orm_active_enums::MetaSensitivemediadetectionsensitivityEnum; +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "meta")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + pub name: Option, + pub description: Option, + #[sea_orm(column_name = "maintainerName")] + pub maintainer_name: Option, + #[sea_orm(column_name = "maintainerEmail")] + pub maintainer_email: Option, + #[sea_orm(column_name = "disableRegistration")] + pub disable_registration: bool, + #[sea_orm(column_name = "disableLocalTimeline")] + pub disable_local_timeline: bool, + #[sea_orm(column_name = "disableGlobalTimeline")] + pub disable_global_timeline: bool, + #[sea_orm(column_name = "useStarForReactionFallback")] + pub use_star_for_reaction_fallback: bool, + pub langs: Vec, + #[sea_orm(column_name = "hiddenTags")] + pub hidden_tags: Vec, + #[sea_orm(column_name = "blockedHosts")] + pub blocked_hosts: Vec, + #[sea_orm(column_name = "mascotImageUrl")] + pub mascot_image_url: Option, + #[sea_orm(column_name = "bannerUrl")] + pub banner_url: Option, + #[sea_orm(column_name = "errorImageUrl")] + pub error_image_url: Option, + #[sea_orm(column_name = "iconUrl")] + pub icon_url: Option, + #[sea_orm(column_name = "cacheRemoteFiles")] + pub cache_remote_files: bool, + #[sea_orm(column_name = "enableRecaptcha")] + pub enable_recaptcha: bool, + #[sea_orm(column_name = "recaptchaSiteKey")] + pub recaptcha_site_key: Option, + #[sea_orm(column_name = "recaptchaSecretKey")] + pub recaptcha_secret_key: Option, + #[sea_orm(column_name = "localDriveCapacityMb")] + pub local_drive_capacity_mb: i32, + #[sea_orm(column_name = "remoteDriveCapacityMb")] + pub remote_drive_capacity_mb: i32, + #[sea_orm(column_name = "summalyProxy")] + pub summaly_proxy: Option, + #[sea_orm(column_name = "enableEmail")] + pub enable_email: bool, + pub email: Option, + #[sea_orm(column_name = "smtpSecure")] + pub smtp_secure: bool, + #[sea_orm(column_name = "smtpHost")] + pub smtp_host: Option, + #[sea_orm(column_name = "smtpPort")] + pub smtp_port: Option, + #[sea_orm(column_name = "smtpUser")] + pub smtp_user: Option, + #[sea_orm(column_name = "smtpPass")] + pub smtp_pass: Option, + #[sea_orm(column_name = "enableServiceWorker")] + pub enable_service_worker: bool, + #[sea_orm(column_name = "swPublicKey")] + pub sw_public_key: Option, + #[sea_orm(column_name = "swPrivateKey")] + pub sw_private_key: Option, + #[sea_orm(column_name = "enableTwitterIntegration")] + pub enable_twitter_integration: bool, + #[sea_orm(column_name = "twitterConsumerKey")] + pub twitter_consumer_key: Option, + #[sea_orm(column_name = "twitterConsumerSecret")] + pub twitter_consumer_secret: Option, + #[sea_orm(column_name = "enableGithubIntegration")] + pub enable_github_integration: bool, + #[sea_orm(column_name = "githubClientId")] + pub github_client_id: Option, + #[sea_orm(column_name = "githubClientSecret")] + pub github_client_secret: Option, + #[sea_orm(column_name = "enableDiscordIntegration")] + pub enable_discord_integration: bool, + #[sea_orm(column_name = "discordClientId")] + pub discord_client_id: Option, + #[sea_orm(column_name = "discordClientSecret")] + pub discord_client_secret: Option, + #[sea_orm(column_name = "pinnedUsers")] + pub pinned_users: Vec, + #[sea_orm(column_name = "ToSUrl")] + pub to_s_url: Option, + #[sea_orm(column_name = "repositoryUrl")] + pub repository_url: String, + #[sea_orm(column_name = "feedbackUrl")] + pub feedback_url: Option, + #[sea_orm(column_name = "useObjectStorage")] + pub use_object_storage: bool, + #[sea_orm(column_name = "objectStorageBucket")] + pub object_storage_bucket: Option, + #[sea_orm(column_name = "objectStoragePrefix")] + pub object_storage_prefix: Option, + #[sea_orm(column_name = "objectStorageBaseUrl")] + pub object_storage_base_url: Option, + #[sea_orm(column_name = "objectStorageEndpoint")] + pub object_storage_endpoint: Option, + #[sea_orm(column_name = "objectStorageRegion")] + pub object_storage_region: Option, + #[sea_orm(column_name = "objectStorageAccessKey")] + pub object_storage_access_key: Option, + #[sea_orm(column_name = "objectStorageSecretKey")] + pub object_storage_secret_key: Option, + #[sea_orm(column_name = "objectStoragePort")] + pub object_storage_port: Option, + #[sea_orm(column_name = "objectStorageUseSSL")] + pub object_storage_use_ssl: bool, + #[sea_orm(column_name = "proxyAccountId")] + pub proxy_account_id: Option, + #[sea_orm(column_name = "objectStorageUseProxy")] + pub object_storage_use_proxy: bool, + #[sea_orm(column_name = "enableHcaptcha")] + pub enable_hcaptcha: bool, + #[sea_orm(column_name = "hcaptchaSiteKey")] + pub hcaptcha_site_key: Option, + #[sea_orm(column_name = "hcaptchaSecretKey")] + pub hcaptcha_secret_key: Option, + #[sea_orm(column_name = "objectStorageSetPublicRead")] + pub object_storage_set_public_read: bool, + #[sea_orm(column_name = "pinnedPages")] + pub pinned_pages: Vec, + #[sea_orm(column_name = "backgroundImageUrl")] + pub background_image_url: Option, + #[sea_orm(column_name = "logoImageUrl")] + pub logo_image_url: Option, + #[sea_orm(column_name = "pinnedClipId")] + pub pinned_clip_id: Option, + #[sea_orm(column_name = "objectStorageS3ForcePathStyle")] + pub object_storage_s3_force_path_style: bool, + #[sea_orm(column_name = "allowedHosts")] + pub allowed_hosts: Option>, + #[sea_orm(column_name = "secureMode")] + pub secure_mode: Option, + #[sea_orm(column_name = "privateMode")] + pub private_mode: Option, + #[sea_orm(column_name = "deeplAuthKey")] + pub deepl_auth_key: Option, + #[sea_orm(column_name = "deeplIsPro")] + pub deepl_is_pro: bool, + #[sea_orm(column_name = "emailRequiredForSignup")] + pub email_required_for_signup: bool, + #[sea_orm(column_name = "themeColor")] + pub theme_color: Option, + #[sea_orm(column_name = "defaultLightTheme")] + pub default_light_theme: Option, + #[sea_orm(column_name = "defaultDarkTheme")] + pub default_dark_theme: Option, + #[sea_orm(column_name = "sensitiveMediaDetection")] + pub sensitive_media_detection: MetaSensitivemediadetectionEnum, + #[sea_orm(column_name = "sensitiveMediaDetectionSensitivity")] + pub sensitive_media_detection_sensitivity: MetaSensitivemediadetectionsensitivityEnum, + #[sea_orm(column_name = "setSensitiveFlagAutomatically")] + pub set_sensitive_flag_automatically: bool, + #[sea_orm(column_name = "enableIpLogging")] + pub enable_ip_logging: bool, + #[sea_orm(column_name = "enableSensitiveMediaDetectionForVideos")] + pub enable_sensitive_media_detection_for_videos: bool, + #[sea_orm(column_name = "enableActiveEmailValidation")] + pub enable_active_email_validation: bool, + #[sea_orm(column_name = "customMOTD")] + pub custom_motd: Vec, + #[sea_orm(column_name = "customSplashIcons")] + pub custom_splash_icons: Vec, + #[sea_orm(column_name = "disableRecommendedTimeline")] + pub disable_recommended_timeline: bool, + #[sea_orm(column_name = "recommendedInstances")] + pub recommended_instances: Vec, + #[sea_orm(column_name = "enableGuestTimeline")] + pub enable_guest_timeline: bool, + #[sea_orm(column_name = "defaultReaction")] + pub default_reaction: String, + #[sea_orm(column_name = "libreTranslateApiUrl")] + pub libre_translate_api_url: Option, + #[sea_orm(column_name = "libreTranslateApiKey")] + pub libre_translate_api_key: Option, + #[sea_orm(column_name = "silencedHosts")] + pub silenced_hosts: Vec, + #[sea_orm(column_name = "experimentalFeatures", column_type = "JsonBinary")] + pub experimental_features: Json, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::ProxyAccountId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "SetNull" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/migrations.rs b/packages/backend/native-utils/crates/model/src/entity/migrations.rs new file mode 100644 index 000000000..c53c3fc89 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/migrations.rs @@ -0,0 +1,18 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "migrations")] +pub struct Model { + #[sea_orm(primary_key)] + pub id: i32, + pub timestamp: i64, + pub name: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation {} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/mod.rs b/packages/backend/native-utils/crates/model/src/entity/mod.rs new file mode 100644 index 000000000..077f9fa6e --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/mod.rs @@ -0,0 +1,75 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +pub mod prelude; + +pub mod abuse_user_report; +pub mod access_token; +pub mod ad; +pub mod announcement; +pub mod announcement_read; +pub mod antenna; +pub mod antenna_note; +pub mod app; +pub mod attestation_challenge; +pub mod auth_session; +pub mod blocking; +pub mod channel; +pub mod channel_following; +pub mod channel_note_pining; +pub mod clip; +pub mod clip_note; +pub mod drive_file; +pub mod drive_folder; +pub mod emoji; +pub mod follow_request; +pub mod following; +pub mod gallery_like; +pub mod gallery_post; +pub mod hashtag; +pub mod instance; +pub mod messaging_message; +pub mod meta; +pub mod migrations; +pub mod moderation_log; +pub mod muted_note; +pub mod muting; +pub mod note; +pub mod note_edit; +pub mod note_favorite; +pub mod note_reaction; +pub mod note_thread_muting; +pub mod note_unread; +pub mod note_watching; +pub mod notification; +pub mod page; +pub mod page_like; +pub mod password_reset_request; +pub mod poll; +pub mod poll_vote; +pub mod promo_note; +pub mod promo_read; +pub mod registration_ticket; +pub mod registry_item; +pub mod relay; +pub mod renote_muting; +pub mod reversi_game; +pub mod reversi_matching; +pub mod sea_orm_active_enums; +pub mod signin; +pub mod sw_subscription; +pub mod used_username; +pub mod user; +pub mod user_group; +pub mod user_group_invitation; +pub mod user_group_invite; +pub mod user_group_joining; +pub mod user_ip; +pub mod user_keypair; +pub mod user_list; +pub mod user_list_joining; +pub mod user_note_pining; +pub mod user_pending; +pub mod user_profile; +pub mod user_publickey; +pub mod user_security_key; +pub mod webhook; diff --git a/packages/backend/native-utils/crates/model/src/entity/moderation_log.rs b/packages/backend/native-utils/crates/model/src/entity/moderation_log.rs new file mode 100644 index 000000000..eb49d4f15 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/moderation_log.rs @@ -0,0 +1,38 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "moderation_log")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "userId")] + pub user_id: String, + pub r#type: String, + #[sea_orm(column_type = "JsonBinary")] + pub info: Json, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/muted_note.rs b/packages/backend/native-utils/crates/model/src/entity/muted_note.rs new file mode 100644 index 000000000..17328a829 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/muted_note.rs @@ -0,0 +1,51 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use super::sea_orm_active_enums::MutedNoteReasonEnum; +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "muted_note")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "noteId")] + pub note_id: String, + #[sea_orm(column_name = "userId")] + pub user_id: String, + pub reason: MutedNoteReasonEnum, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::note::Entity", + from = "Column::NoteId", + to = "super::note::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + Note, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Note.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/muting.rs b/packages/backend/native-utils/crates/model/src/entity/muting.rs new file mode 100644 index 000000000..60020b60b --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/muting.rs @@ -0,0 +1,41 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "muting")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "muteeId")] + pub mutee_id: String, + #[sea_orm(column_name = "muterId")] + pub muter_id: String, + #[sea_orm(column_name = "expiresAt")] + pub expires_at: Option, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::MuterId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User2, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::MuteeId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User1, +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/note.rs b/packages/backend/native-utils/crates/model/src/entity/note.rs new file mode 100644 index 000000000..cc3ec289f --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/note.rs @@ -0,0 +1,235 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use super::sea_orm_active_enums::NoteVisibilityEnum; +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "note")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "replyId")] + pub reply_id: Option, + #[sea_orm(column_name = "renoteId")] + pub renote_id: Option, + #[sea_orm(column_type = "Text", nullable)] + pub text: Option, + pub name: Option, + pub cw: Option, + #[sea_orm(column_name = "userId")] + pub user_id: String, + #[sea_orm(column_name = "localOnly")] + pub local_only: bool, + #[sea_orm(column_name = "renoteCount")] + pub renote_count: i16, + #[sea_orm(column_name = "repliesCount")] + pub replies_count: i16, + #[sea_orm(column_type = "JsonBinary")] + pub reactions: Json, + pub visibility: NoteVisibilityEnum, + pub uri: Option, + pub score: i32, + #[sea_orm(column_name = "fileIds")] + pub file_ids: Vec, + #[sea_orm(column_name = "attachedFileTypes")] + pub attached_file_types: Vec, + #[sea_orm(column_name = "visibleUserIds")] + pub visible_user_ids: Vec, + pub mentions: Vec, + #[sea_orm(column_name = "mentionedRemoteUsers", column_type = "Text")] + pub mentioned_remote_users: String, + pub emojis: Vec, + pub tags: Vec, + #[sea_orm(column_name = "hasPoll")] + pub has_poll: bool, + #[sea_orm(column_name = "userHost")] + pub user_host: Option, + #[sea_orm(column_name = "replyUserId")] + pub reply_user_id: Option, + #[sea_orm(column_name = "replyUserHost")] + pub reply_user_host: Option, + #[sea_orm(column_name = "renoteUserId")] + pub renote_user_id: Option, + #[sea_orm(column_name = "renoteUserHost")] + pub renote_user_host: Option, + pub url: Option, + #[sea_orm(column_name = "channelId")] + pub channel_id: Option, + #[sea_orm(column_name = "threadId")] + pub thread_id: Option, + #[sea_orm(column_name = "updatedAt")] + pub updated_at: Option, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm(has_many = "super::antenna_note::Entity")] + AntennaNote, + #[sea_orm( + belongs_to = "super::channel::Entity", + from = "Column::ChannelId", + to = "super::channel::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + Channel, + #[sea_orm(has_many = "super::channel_note_pining::Entity")] + ChannelNotePining, + #[sea_orm(has_many = "super::clip_note::Entity")] + ClipNote, + #[sea_orm(has_many = "super::muted_note::Entity")] + MutedNote, + #[sea_orm( + belongs_to = "Entity", + from = "Column::ReplyId", + to = "Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + SelfRef2, + #[sea_orm( + belongs_to = "Entity", + from = "Column::RenoteId", + to = "Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + SelfRef1, + #[sea_orm(has_many = "super::note_edit::Entity")] + NoteEdit, + #[sea_orm(has_many = "super::note_favorite::Entity")] + NoteFavorite, + #[sea_orm(has_many = "super::note_reaction::Entity")] + NoteReaction, + #[sea_orm(has_many = "super::note_unread::Entity")] + NoteUnread, + #[sea_orm(has_many = "super::note_watching::Entity")] + NoteWatching, + #[sea_orm(has_many = "super::notification::Entity")] + Notification, + #[sea_orm(has_one = "super::poll::Entity")] + Poll, + #[sea_orm(has_many = "super::poll_vote::Entity")] + PollVote, + #[sea_orm(has_one = "super::promo_note::Entity")] + PromoNote, + #[sea_orm(has_many = "super::promo_read::Entity")] + PromoRead, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, + #[sea_orm(has_many = "super::user_note_pining::Entity")] + UserNotePining, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::AntennaNote.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Channel.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::ChannelNotePining.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::ClipNote.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::MutedNote.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::NoteEdit.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::NoteFavorite.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::NoteReaction.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::NoteUnread.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::NoteWatching.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Notification.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Poll.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::PollVote.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::PromoNote.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::PromoRead.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::UserNotePining.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/note_edit.rs b/packages/backend/native-utils/crates/model/src/entity/note_edit.rs new file mode 100644 index 000000000..7b87613dd --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/note_edit.rs @@ -0,0 +1,40 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "note_edit")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "noteId")] + pub note_id: String, + #[sea_orm(column_type = "Text", nullable)] + pub text: Option, + pub cw: Option, + #[sea_orm(column_name = "fileIds")] + pub file_ids: Vec, + #[sea_orm(column_name = "updatedAt")] + pub updated_at: DateTimeWithTimeZone, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::note::Entity", + from = "Column::NoteId", + to = "super::note::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + Note, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Note.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/note_favorite.rs b/packages/backend/native-utils/crates/model/src/entity/note_favorite.rs new file mode 100644 index 000000000..b5c96a9a6 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/note_favorite.rs @@ -0,0 +1,51 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "note_favorite")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "userId")] + pub user_id: String, + #[sea_orm(column_name = "noteId")] + pub note_id: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::note::Entity", + from = "Column::NoteId", + to = "super::note::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + Note, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Note.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/note_reaction.rs b/packages/backend/native-utils/crates/model/src/entity/note_reaction.rs new file mode 100644 index 000000000..52526aa9f --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/note_reaction.rs @@ -0,0 +1,52 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "note_reaction")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "userId")] + pub user_id: String, + #[sea_orm(column_name = "noteId")] + pub note_id: String, + pub reaction: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::note::Entity", + from = "Column::NoteId", + to = "super::note::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + Note, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Note.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/note_thread_muting.rs b/packages/backend/native-utils/crates/model/src/entity/note_thread_muting.rs new file mode 100644 index 000000000..572a03750 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/note_thread_muting.rs @@ -0,0 +1,37 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "note_thread_muting")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "userId")] + pub user_id: String, + #[sea_orm(column_name = "threadId")] + pub thread_id: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/note_unread.rs b/packages/backend/native-utils/crates/model/src/entity/note_unread.rs new file mode 100644 index 000000000..80fae4335 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/note_unread.rs @@ -0,0 +1,57 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "note_unread")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "userId")] + pub user_id: String, + #[sea_orm(column_name = "noteId")] + pub note_id: String, + #[sea_orm(column_name = "noteUserId")] + pub note_user_id: String, + #[sea_orm(column_name = "isSpecified")] + pub is_specified: bool, + #[sea_orm(column_name = "isMentioned")] + pub is_mentioned: bool, + #[sea_orm(column_name = "noteChannelId")] + pub note_channel_id: Option, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::note::Entity", + from = "Column::NoteId", + to = "super::note::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + Note, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Note.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/note_watching.rs b/packages/backend/native-utils/crates/model/src/entity/note_watching.rs new file mode 100644 index 000000000..1ff7af52e --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/note_watching.rs @@ -0,0 +1,53 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "note_watching")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "userId")] + pub user_id: String, + #[sea_orm(column_name = "noteId")] + pub note_id: String, + #[sea_orm(column_name = "noteUserId")] + pub note_user_id: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::note::Entity", + from = "Column::NoteId", + to = "super::note::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + Note, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Note.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/notification.rs b/packages/backend/native-utils/crates/model/src/entity/notification.rs new file mode 100644 index 000000000..c2d9115f3 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/notification.rs @@ -0,0 +1,115 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use super::sea_orm_active_enums::NotificationTypeEnum; +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "notification")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "notifieeId")] + pub notifiee_id: String, + #[sea_orm(column_name = "notifierId")] + pub notifier_id: Option, + #[sea_orm(column_name = "isRead")] + pub is_read: bool, + #[sea_orm(column_name = "noteId")] + pub note_id: Option, + pub reaction: Option, + pub choice: Option, + #[sea_orm(column_name = "followRequestId")] + pub follow_request_id: Option, + pub r#type: NotificationTypeEnum, + #[sea_orm(column_name = "userGroupInvitationId")] + pub user_group_invitation_id: Option, + #[sea_orm(column_name = "customBody")] + pub custom_body: Option, + #[sea_orm(column_name = "customHeader")] + pub custom_header: Option, + #[sea_orm(column_name = "customIcon")] + pub custom_icon: Option, + #[sea_orm(column_name = "appAccessTokenId")] + pub app_access_token_id: Option, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::access_token::Entity", + from = "Column::AppAccessTokenId", + to = "super::access_token::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + AccessToken, + #[sea_orm( + belongs_to = "super::follow_request::Entity", + from = "Column::FollowRequestId", + to = "super::follow_request::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + FollowRequest, + #[sea_orm( + belongs_to = "super::note::Entity", + from = "Column::NoteId", + to = "super::note::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + Note, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::NotifierId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User2, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::NotifieeId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User1, + #[sea_orm( + belongs_to = "super::user_group_invitation::Entity", + from = "Column::UserGroupInvitationId", + to = "super::user_group_invitation::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + UserGroupInvitation, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::AccessToken.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::FollowRequest.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Note.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::UserGroupInvitation.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/page.rs b/packages/backend/native-utils/crates/model/src/entity/page.rs new file mode 100644 index 000000000..32f082daf --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/page.rs @@ -0,0 +1,90 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use super::sea_orm_active_enums::PageVisibilityEnum; +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "page")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "updatedAt")] + pub updated_at: DateTimeWithTimeZone, + pub title: String, + pub name: String, + pub summary: Option, + #[sea_orm(column_name = "alignCenter")] + pub align_center: bool, + pub font: String, + #[sea_orm(column_name = "userId")] + pub user_id: String, + #[sea_orm(column_name = "eyeCatchingImageId")] + pub eye_catching_image_id: Option, + #[sea_orm(column_type = "JsonBinary")] + pub content: Json, + #[sea_orm(column_type = "JsonBinary")] + pub variables: Json, + pub visibility: PageVisibilityEnum, + #[sea_orm(column_name = "visibleUserIds")] + pub visible_user_ids: Vec, + #[sea_orm(column_name = "likedCount")] + pub liked_count: i32, + #[sea_orm(column_name = "hideTitleWhenPinned")] + pub hide_title_when_pinned: bool, + pub script: String, + #[sea_orm(column_name = "isPublic")] + pub is_public: bool, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::drive_file::Entity", + from = "Column::EyeCatchingImageId", + to = "super::drive_file::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + DriveFile, + #[sea_orm(has_many = "super::page_like::Entity")] + PageLike, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, + #[sea_orm(has_one = "super::user_profile::Entity")] + UserProfile, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::DriveFile.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::PageLike.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::UserProfile.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/page_like.rs b/packages/backend/native-utils/crates/model/src/entity/page_like.rs new file mode 100644 index 000000000..e9de78eb6 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/page_like.rs @@ -0,0 +1,51 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "page_like")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "userId")] + pub user_id: String, + #[sea_orm(column_name = "pageId")] + pub page_id: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::page::Entity", + from = "Column::PageId", + to = "super::page::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + Page, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Page.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/password_reset_request.rs b/packages/backend/native-utils/crates/model/src/entity/password_reset_request.rs new file mode 100644 index 000000000..472b93db9 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/password_reset_request.rs @@ -0,0 +1,36 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "password_reset_request")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + pub token: String, + #[sea_orm(column_name = "userId")] + pub user_id: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/poll.rs b/packages/backend/native-utils/crates/model/src/entity/poll.rs new file mode 100644 index 000000000..0facabd9a --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/poll.rs @@ -0,0 +1,43 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use super::sea_orm_active_enums::PollNotevisibilityEnum; +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "poll")] +pub struct Model { + #[sea_orm(column_name = "noteId", primary_key, auto_increment = false, unique)] + pub note_id: String, + #[sea_orm(column_name = "expiresAt")] + pub expires_at: Option, + pub multiple: bool, + pub choices: Vec, + pub votes: Vec, + #[sea_orm(column_name = "noteVisibility")] + pub note_visibility: PollNotevisibilityEnum, + #[sea_orm(column_name = "userId")] + pub user_id: String, + #[sea_orm(column_name = "userHost")] + pub user_host: Option, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::note::Entity", + from = "Column::NoteId", + to = "super::note::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + Note, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Note.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/poll_vote.rs b/packages/backend/native-utils/crates/model/src/entity/poll_vote.rs new file mode 100644 index 000000000..29b6928ef --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/poll_vote.rs @@ -0,0 +1,52 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "poll_vote")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "userId")] + pub user_id: String, + #[sea_orm(column_name = "noteId")] + pub note_id: String, + pub choice: i32, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::note::Entity", + from = "Column::NoteId", + to = "super::note::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + Note, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Note.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/prelude.rs b/packages/backend/native-utils/crates/model/src/entity/prelude.rs new file mode 100644 index 000000000..7cab688bb --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/prelude.rs @@ -0,0 +1,72 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +pub use super::abuse_user_report::Entity as AbuseUserReport; +pub use super::access_token::Entity as AccessToken; +pub use super::ad::Entity as Ad; +pub use super::announcement::Entity as Announcement; +pub use super::announcement_read::Entity as AnnouncementRead; +pub use super::antenna::Entity as Antenna; +pub use super::antenna_note::Entity as AntennaNote; +pub use super::app::Entity as App; +pub use super::attestation_challenge::Entity as AttestationChallenge; +pub use super::auth_session::Entity as AuthSession; +pub use super::blocking::Entity as Blocking; +pub use super::channel::Entity as Channel; +pub use super::channel_following::Entity as ChannelFollowing; +pub use super::channel_note_pining::Entity as ChannelNotePining; +pub use super::clip::Entity as Clip; +pub use super::clip_note::Entity as ClipNote; +pub use super::drive_file::Entity as DriveFile; +pub use super::drive_folder::Entity as DriveFolder; +pub use super::emoji::Entity as Emoji; +pub use super::follow_request::Entity as FollowRequest; +pub use super::following::Entity as Following; +pub use super::gallery_like::Entity as GalleryLike; +pub use super::gallery_post::Entity as GalleryPost; +pub use super::hashtag::Entity as Hashtag; +pub use super::instance::Entity as Instance; +pub use super::messaging_message::Entity as MessagingMessage; +pub use super::meta::Entity as Meta; +pub use super::migrations::Entity as Migrations; +pub use super::moderation_log::Entity as ModerationLog; +pub use super::muted_note::Entity as MutedNote; +pub use super::muting::Entity as Muting; +pub use super::note::Entity as Note; +pub use super::note_edit::Entity as NoteEdit; +pub use super::note_favorite::Entity as NoteFavorite; +pub use super::note_reaction::Entity as NoteReaction; +pub use super::note_thread_muting::Entity as NoteThreadMuting; +pub use super::note_unread::Entity as NoteUnread; +pub use super::note_watching::Entity as NoteWatching; +pub use super::notification::Entity as Notification; +pub use super::page::Entity as Page; +pub use super::page_like::Entity as PageLike; +pub use super::password_reset_request::Entity as PasswordResetRequest; +pub use super::poll::Entity as Poll; +pub use super::poll_vote::Entity as PollVote; +pub use super::promo_note::Entity as PromoNote; +pub use super::promo_read::Entity as PromoRead; +pub use super::registration_ticket::Entity as RegistrationTicket; +pub use super::registry_item::Entity as RegistryItem; +pub use super::relay::Entity as Relay; +pub use super::renote_muting::Entity as RenoteMuting; +pub use super::reversi_game::Entity as ReversiGame; +pub use super::reversi_matching::Entity as ReversiMatching; +pub use super::signin::Entity as Signin; +pub use super::sw_subscription::Entity as SwSubscription; +pub use super::used_username::Entity as UsedUsername; +pub use super::user::Entity as User; +pub use super::user_group::Entity as UserGroup; +pub use super::user_group_invitation::Entity as UserGroupInvitation; +pub use super::user_group_invite::Entity as UserGroupInvite; +pub use super::user_group_joining::Entity as UserGroupJoining; +pub use super::user_ip::Entity as UserIp; +pub use super::user_keypair::Entity as UserKeypair; +pub use super::user_list::Entity as UserList; +pub use super::user_list_joining::Entity as UserListJoining; +pub use super::user_note_pining::Entity as UserNotePining; +pub use super::user_pending::Entity as UserPending; +pub use super::user_profile::Entity as UserProfile; +pub use super::user_publickey::Entity as UserPublickey; +pub use super::user_security_key::Entity as UserSecurityKey; +pub use super::webhook::Entity as Webhook; diff --git a/packages/backend/native-utils/crates/model/src/entity/promo_note.rs b/packages/backend/native-utils/crates/model/src/entity/promo_note.rs new file mode 100644 index 000000000..6e8de9866 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/promo_note.rs @@ -0,0 +1,35 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "promo_note")] +pub struct Model { + #[sea_orm(column_name = "noteId", primary_key, auto_increment = false, unique)] + pub note_id: String, + #[sea_orm(column_name = "expiresAt")] + pub expires_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "userId")] + pub user_id: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::note::Entity", + from = "Column::NoteId", + to = "super::note::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + Note, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Note.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/promo_read.rs b/packages/backend/native-utils/crates/model/src/entity/promo_read.rs new file mode 100644 index 000000000..807ad4a27 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/promo_read.rs @@ -0,0 +1,51 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "promo_read")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "userId")] + pub user_id: String, + #[sea_orm(column_name = "noteId")] + pub note_id: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::note::Entity", + from = "Column::NoteId", + to = "super::note::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + Note, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Note.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/registration_ticket.rs b/packages/backend/native-utils/crates/model/src/entity/registration_ticket.rs new file mode 100644 index 000000000..8d7e4ba8d --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/registration_ticket.rs @@ -0,0 +1,19 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "registration_ticket")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + pub code: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation {} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/registry_item.rs b/packages/backend/native-utils/crates/model/src/entity/registry_item.rs new file mode 100644 index 000000000..8aa188210 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/registry_item.rs @@ -0,0 +1,42 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "registry_item")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "updatedAt")] + pub updated_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "userId")] + pub user_id: String, + pub key: String, + pub scope: Vec, + pub domain: Option, + #[sea_orm(column_type = "JsonBinary", nullable)] + pub value: Option, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/relay.rs b/packages/backend/native-utils/crates/model/src/entity/relay.rs new file mode 100644 index 000000000..731d12e8c --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/relay.rs @@ -0,0 +1,19 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use super::sea_orm_active_enums::RelayStatusEnum; +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "relay")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + pub inbox: String, + pub status: RelayStatusEnum, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation {} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/renote_muting.rs b/packages/backend/native-utils/crates/model/src/entity/renote_muting.rs new file mode 100644 index 000000000..b63c989a6 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/renote_muting.rs @@ -0,0 +1,22 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "renote_muting")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "muteeId")] + pub mutee_id: String, + #[sea_orm(column_name = "muterId")] + pub muter_id: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation {} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/reversi_game.rs b/packages/backend/native-utils/crates/model/src/entity/reversi_game.rs new file mode 100644 index 000000000..56f83e543 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/reversi_game.rs @@ -0,0 +1,68 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "reversi_game")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "startedAt")] + pub started_at: Option, + #[sea_orm(column_name = "user1Id")] + pub user1_id: String, + #[sea_orm(column_name = "user2Id")] + pub user2_id: String, + #[sea_orm(column_name = "user1Accepted")] + pub user1_accepted: bool, + #[sea_orm(column_name = "user2Accepted")] + pub user2_accepted: bool, + pub black: Option, + #[sea_orm(column_name = "isStarted")] + pub is_started: bool, + #[sea_orm(column_name = "isEnded")] + pub is_ended: bool, + #[sea_orm(column_name = "winnerId")] + pub winner_id: Option, + pub surrendered: Option, + #[sea_orm(column_type = "JsonBinary")] + pub logs: Json, + pub map: Vec, + pub bw: String, + #[sea_orm(column_name = "isLlotheo")] + pub is_llotheo: bool, + #[sea_orm(column_name = "canPutEverywhere")] + pub can_put_everywhere: bool, + #[sea_orm(column_name = "loopedBoard")] + pub looped_board: bool, + #[sea_orm(column_type = "JsonBinary", nullable)] + pub form1: Option, + #[sea_orm(column_type = "JsonBinary", nullable)] + pub form2: Option, + pub crc32: Option, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::User2Id", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User2, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::User1Id", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User1, +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/reversi_matching.rs b/packages/backend/native-utils/crates/model/src/entity/reversi_matching.rs new file mode 100644 index 000000000..9261b6482 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/reversi_matching.rs @@ -0,0 +1,39 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "reversi_matching")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "parentId")] + pub parent_id: String, + #[sea_orm(column_name = "childId")] + pub child_id: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::ParentId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User2, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::ChildId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User1, +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/sea_orm_active_enums.rs b/packages/backend/native-utils/crates/model/src/entity/sea_orm_active_enums.rs new file mode 100644 index 000000000..747cd953a --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/sea_orm_active_enums.rs @@ -0,0 +1,175 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "antenna_src_enum")] +pub enum AntennaSrcEnum { + #[sea_orm(string_value = "all")] + All, + #[sea_orm(string_value = "group")] + Group, + #[sea_orm(string_value = "home")] + Home, + #[sea_orm(string_value = "instances")] + Instances, + #[sea_orm(string_value = "list")] + List, + #[sea_orm(string_value = "users")] + Users, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm( + rs_type = "String", + db_type = "Enum", + enum_name = "meta_sensitivemediadetection_enum" +)] +pub enum MetaSensitivemediadetectionEnum { + #[sea_orm(string_value = "all")] + All, + #[sea_orm(string_value = "local")] + Local, + #[sea_orm(string_value = "none")] + None, + #[sea_orm(string_value = "remote")] + Remote, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm( + rs_type = "String", + db_type = "Enum", + enum_name = "meta_sensitivemediadetectionsensitivity_enum" +)] +pub enum MetaSensitivemediadetectionsensitivityEnum { + #[sea_orm(string_value = "high")] + High, + #[sea_orm(string_value = "low")] + Low, + #[sea_orm(string_value = "medium")] + Medium, + #[sea_orm(string_value = "veryHigh")] + VeryHigh, + #[sea_orm(string_value = "veryLow")] + VeryLow, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm( + rs_type = "String", + db_type = "Enum", + enum_name = "muted_note_reason_enum" +)] +pub enum MutedNoteReasonEnum { + #[sea_orm(string_value = "manual")] + Manual, + #[sea_orm(string_value = "other")] + Other, + #[sea_orm(string_value = "spam")] + Spam, + #[sea_orm(string_value = "word")] + Word, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm( + rs_type = "String", + db_type = "Enum", + enum_name = "note_visibility_enum" +)] +pub enum NoteVisibilityEnum { + #[sea_orm(string_value = "followers")] + Followers, + #[sea_orm(string_value = "hidden")] + Hidden, + #[sea_orm(string_value = "home")] + Home, + #[sea_orm(string_value = "public")] + Public, + #[sea_orm(string_value = "specified")] + Specified, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm( + rs_type = "String", + db_type = "Enum", + enum_name = "notification_type_enum" +)] +pub enum NotificationTypeEnum { + #[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, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm( + rs_type = "String", + db_type = "Enum", + enum_name = "page_visibility_enum" +)] +pub enum PageVisibilityEnum { + #[sea_orm(string_value = "followers")] + Followers, + #[sea_orm(string_value = "public")] + Public, + #[sea_orm(string_value = "specified")] + Specified, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm( + rs_type = "String", + db_type = "Enum", + enum_name = "poll_notevisibility_enum" +)] +pub enum PollNotevisibilityEnum { + #[sea_orm(string_value = "followers")] + Followers, + #[sea_orm(string_value = "home")] + Home, + #[sea_orm(string_value = "public")] + Public, + #[sea_orm(string_value = "specified")] + Specified, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[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, + #[sea_orm(string_value = "requesting")] + Requesting, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm( + rs_type = "String", + db_type = "Enum", + enum_name = "user_profile_ffvisibility_enum" +)] +pub enum UserProfileFfvisibilityEnum { + #[sea_orm(string_value = "followers")] + Followers, + #[sea_orm(string_value = "private")] + Private, + #[sea_orm(string_value = "public")] + Public, +} diff --git a/packages/backend/native-utils/crates/model/src/entity/signin.rs b/packages/backend/native-utils/crates/model/src/entity/signin.rs new file mode 100644 index 000000000..d6f730892 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/signin.rs @@ -0,0 +1,39 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "signin")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "userId")] + pub user_id: String, + pub ip: String, + #[sea_orm(column_type = "JsonBinary")] + pub headers: Json, + pub success: bool, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/sw_subscription.rs b/packages/backend/native-utils/crates/model/src/entity/sw_subscription.rs new file mode 100644 index 000000000..0d2ac26d9 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/sw_subscription.rs @@ -0,0 +1,40 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "sw_subscription")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "userId")] + pub user_id: String, + pub endpoint: String, + pub auth: String, + pub publickey: String, + #[sea_orm(column_name = "sendReadMessage")] + pub send_read_message: bool, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/used_username.rs b/packages/backend/native-utils/crates/model/src/entity/used_username.rs new file mode 100644 index 000000000..cf325cfa5 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/used_username.rs @@ -0,0 +1,18 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "used_username")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub username: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation {} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/user.rs b/packages/backend/native-utils/crates/model/src/entity/user.rs new file mode 100644 index 000000000..cd1153994 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/user.rs @@ -0,0 +1,425 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "user")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "updatedAt")] + pub updated_at: Option, + #[sea_orm(column_name = "lastFetchedAt")] + pub last_fetched_at: Option, + pub username: String, + #[sea_orm(column_name = "usernameLower")] + pub username_lower: String, + pub name: Option, + #[sea_orm(column_name = "followersCount")] + pub followers_count: i32, + #[sea_orm(column_name = "followingCount")] + pub following_count: i32, + #[sea_orm(column_name = "notesCount")] + pub notes_count: i32, + #[sea_orm(column_name = "avatarId", unique)] + pub avatar_id: Option, + #[sea_orm(column_name = "bannerId", unique)] + pub banner_id: Option, + pub tags: Vec, + #[sea_orm(column_name = "isSuspended")] + pub is_suspended: bool, + #[sea_orm(column_name = "isSilenced")] + pub is_silenced: bool, + #[sea_orm(column_name = "isLocked")] + pub is_locked: bool, + #[sea_orm(column_name = "isBot")] + pub is_bot: bool, + #[sea_orm(column_name = "isCat")] + pub is_cat: bool, + #[sea_orm(column_name = "isAdmin")] + pub is_admin: bool, + #[sea_orm(column_name = "isModerator")] + pub is_moderator: bool, + pub emojis: Vec, + pub host: Option, + pub inbox: Option, + #[sea_orm(column_name = "sharedInbox")] + pub shared_inbox: Option, + pub featured: Option, + pub uri: Option, + #[sea_orm(unique)] + pub token: Option, + #[sea_orm(column_name = "isExplorable")] + pub is_explorable: bool, + #[sea_orm(column_name = "followersUri")] + pub followers_uri: Option, + #[sea_orm(column_name = "lastActiveDate")] + pub last_active_date: Option, + #[sea_orm(column_name = "hideOnlineStatus")] + pub hide_online_status: bool, + #[sea_orm(column_name = "isDeleted")] + pub is_deleted: bool, + #[sea_orm(column_name = "showTimelineReplies")] + pub show_timeline_replies: bool, + #[sea_orm(column_name = "driveCapacityOverrideMb")] + pub drive_capacity_override_mb: Option, + #[sea_orm(column_name = "movedToUri")] + pub moved_to_uri: Option, + #[sea_orm(column_name = "alsoKnownAs", column_type = "Text", nullable)] + pub also_known_as: Option, + #[sea_orm(column_name = "speakAsCat")] + pub speak_as_cat: bool, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm(has_many = "super::access_token::Entity")] + AccessToken, + #[sea_orm(has_many = "super::announcement_read::Entity")] + AnnouncementRead, + #[sea_orm(has_many = "super::antenna::Entity")] + Antenna, + #[sea_orm(has_many = "super::app::Entity")] + App, + #[sea_orm(has_many = "super::attestation_challenge::Entity")] + AttestationChallenge, + #[sea_orm(has_many = "super::auth_session::Entity")] + AuthSession, + #[sea_orm(has_many = "super::channel::Entity")] + Channel, + #[sea_orm(has_many = "super::channel_following::Entity")] + ChannelFollowing, + #[sea_orm(has_many = "super::clip::Entity")] + Clip, + #[sea_orm( + belongs_to = "super::drive_file::Entity", + from = "Column::AvatarId", + to = "super::drive_file::Column::Id", + on_update = "NoAction", + on_delete = "SetNull" + )] + DriveFile2, + #[sea_orm( + belongs_to = "super::drive_file::Entity", + from = "Column::BannerId", + to = "super::drive_file::Column::Id", + on_update = "NoAction", + on_delete = "SetNull" + )] + DriveFile1, + #[sea_orm(has_many = "super::drive_folder::Entity")] + DriveFolder, + #[sea_orm(has_many = "super::gallery_like::Entity")] + GalleryLike, + #[sea_orm(has_many = "super::gallery_post::Entity")] + GalleryPost, + #[sea_orm(has_many = "super::meta::Entity")] + Meta, + #[sea_orm(has_many = "super::moderation_log::Entity")] + ModerationLog, + #[sea_orm(has_many = "super::muted_note::Entity")] + MutedNote, + #[sea_orm(has_many = "super::note::Entity")] + Note, + #[sea_orm(has_many = "super::note_favorite::Entity")] + NoteFavorite, + #[sea_orm(has_many = "super::note_reaction::Entity")] + NoteReaction, + #[sea_orm(has_many = "super::note_thread_muting::Entity")] + NoteThreadMuting, + #[sea_orm(has_many = "super::note_unread::Entity")] + NoteUnread, + #[sea_orm(has_many = "super::note_watching::Entity")] + NoteWatching, + #[sea_orm(has_many = "super::page::Entity")] + Page, + #[sea_orm(has_many = "super::page_like::Entity")] + PageLike, + #[sea_orm(has_many = "super::password_reset_request::Entity")] + PasswordResetRequest, + #[sea_orm(has_many = "super::poll_vote::Entity")] + PollVote, + #[sea_orm(has_many = "super::promo_read::Entity")] + PromoRead, + #[sea_orm(has_many = "super::registry_item::Entity")] + RegistryItem, + #[sea_orm(has_many = "super::signin::Entity")] + Signin, + #[sea_orm(has_many = "super::sw_subscription::Entity")] + SwSubscription, + #[sea_orm(has_many = "super::user_group::Entity")] + UserGroup, + #[sea_orm(has_many = "super::user_group_invitation::Entity")] + UserGroupInvitation, + #[sea_orm(has_many = "super::user_group_invite::Entity")] + UserGroupInvite, + #[sea_orm(has_many = "super::user_group_joining::Entity")] + UserGroupJoining, + #[sea_orm(has_one = "super::user_keypair::Entity")] + UserKeypair, + #[sea_orm(has_many = "super::user_list::Entity")] + UserList, + #[sea_orm(has_many = "super::user_list_joining::Entity")] + UserListJoining, + #[sea_orm(has_many = "super::user_note_pining::Entity")] + UserNotePining, + #[sea_orm(has_one = "super::user_profile::Entity")] + UserProfile, + #[sea_orm(has_one = "super::user_publickey::Entity")] + UserPublickey, + #[sea_orm(has_many = "super::user_security_key::Entity")] + UserSecurityKey, + #[sea_orm(has_many = "super::webhook::Entity")] + Webhook, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::AccessToken.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::AnnouncementRead.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Antenna.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::App.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::AttestationChallenge.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::AuthSession.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Channel.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::ChannelFollowing.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Clip.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::DriveFolder.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::GalleryLike.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::GalleryPost.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Meta.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::ModerationLog.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::MutedNote.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Note.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::NoteFavorite.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::NoteReaction.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::NoteThreadMuting.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::NoteUnread.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::NoteWatching.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Page.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::PageLike.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::PasswordResetRequest.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::PollVote.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::PromoRead.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::RegistryItem.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Signin.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::SwSubscription.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::UserGroup.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::UserGroupInvitation.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::UserGroupInvite.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::UserGroupJoining.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::UserKeypair.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::UserList.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::UserListJoining.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::UserNotePining.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::UserProfile.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::UserPublickey.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::UserSecurityKey.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Webhook.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/user_group.rs b/packages/backend/native-utils/crates/model/src/entity/user_group.rs new file mode 100644 index 000000000..278e9997d --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/user_group.rs @@ -0,0 +1,70 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "user_group")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + pub name: String, + #[sea_orm(column_name = "userId")] + pub user_id: String, + #[sea_orm(column_name = "isPrivate")] + pub is_private: bool, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm(has_many = "super::messaging_message::Entity")] + MessagingMessage, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, + #[sea_orm(has_many = "super::user_group_invitation::Entity")] + UserGroupInvitation, + #[sea_orm(has_many = "super::user_group_invite::Entity")] + UserGroupInvite, + #[sea_orm(has_many = "super::user_group_joining::Entity")] + UserGroupJoining, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::MessagingMessage.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::UserGroupInvitation.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::UserGroupInvite.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::UserGroupJoining.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/user_group_invitation.rs b/packages/backend/native-utils/crates/model/src/entity/user_group_invitation.rs new file mode 100644 index 000000000..62538db37 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/user_group_invitation.rs @@ -0,0 +1,59 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "user_group_invitation")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "userId")] + pub user_id: String, + #[sea_orm(column_name = "userGroupId")] + pub user_group_id: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm(has_many = "super::notification::Entity")] + Notification, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, + #[sea_orm( + belongs_to = "super::user_group::Entity", + from = "Column::UserGroupId", + to = "super::user_group::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + UserGroup, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Notification.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::UserGroup.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/user_group_invite.rs b/packages/backend/native-utils/crates/model/src/entity/user_group_invite.rs new file mode 100644 index 000000000..7ddfa021f --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/user_group_invite.rs @@ -0,0 +1,51 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "user_group_invite")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "userId")] + pub user_id: String, + #[sea_orm(column_name = "userGroupId")] + pub user_group_id: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, + #[sea_orm( + belongs_to = "super::user_group::Entity", + from = "Column::UserGroupId", + to = "super::user_group::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + UserGroup, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::UserGroup.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/user_group_joining.rs b/packages/backend/native-utils/crates/model/src/entity/user_group_joining.rs new file mode 100644 index 000000000..65cb000df --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/user_group_joining.rs @@ -0,0 +1,59 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "user_group_joining")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "userId")] + pub user_id: String, + #[sea_orm(column_name = "userGroupId")] + pub user_group_id: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm(has_many = "super::antenna::Entity")] + Antenna, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, + #[sea_orm( + belongs_to = "super::user_group::Entity", + from = "Column::UserGroupId", + to = "super::user_group::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + UserGroup, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Antenna.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::UserGroup.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/user_ip.rs b/packages/backend/native-utils/crates/model/src/entity/user_ip.rs new file mode 100644 index 000000000..d108b29fe --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/user_ip.rs @@ -0,0 +1,21 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "user_ip")] +pub struct Model { + #[sea_orm(primary_key)] + pub id: i32, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "userId")] + pub user_id: String, + pub ip: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation {} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/user_keypair.rs b/packages/backend/native-utils/crates/model/src/entity/user_keypair.rs new file mode 100644 index 000000000..a9a07b1d9 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/user_keypair.rs @@ -0,0 +1,35 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "user_keypair")] +pub struct Model { + #[sea_orm(column_name = "userId", primary_key, auto_increment = false, unique)] + pub user_id: String, + #[sea_orm(column_name = "publicKey")] + pub public_key: String, + #[sea_orm(column_name = "privateKey")] + pub private_key: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/user_list.rs b/packages/backend/native-utils/crates/model/src/entity/user_list.rs new file mode 100644 index 000000000..6a2f93241 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/user_list.rs @@ -0,0 +1,52 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "user_list")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "userId")] + pub user_id: String, + pub name: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm(has_many = "super::antenna::Entity")] + Antenna, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, + #[sea_orm(has_many = "super::user_list_joining::Entity")] + UserListJoining, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Antenna.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::UserListJoining.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/user_list_joining.rs b/packages/backend/native-utils/crates/model/src/entity/user_list_joining.rs new file mode 100644 index 000000000..fddcfdb54 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/user_list_joining.rs @@ -0,0 +1,51 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "user_list_joining")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "userId")] + pub user_id: String, + #[sea_orm(column_name = "userListId")] + pub user_list_id: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, + #[sea_orm( + belongs_to = "super::user_list::Entity", + from = "Column::UserListId", + to = "super::user_list::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + UserList, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::UserList.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/user_note_pining.rs b/packages/backend/native-utils/crates/model/src/entity/user_note_pining.rs new file mode 100644 index 000000000..24e976e22 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/user_note_pining.rs @@ -0,0 +1,51 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "user_note_pining")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "userId")] + pub user_id: String, + #[sea_orm(column_name = "noteId")] + pub note_id: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::note::Entity", + from = "Column::NoteId", + to = "super::note::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + Note, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Note.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/user_pending.rs b/packages/backend/native-utils/crates/model/src/entity/user_pending.rs new file mode 100644 index 000000000..e9134d9ee --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/user_pending.rs @@ -0,0 +1,22 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "user_pending")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + pub code: String, + pub username: String, + pub email: String, + pub password: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation {} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/user_profile.rs b/packages/backend/native-utils/crates/model/src/entity/user_profile.rs new file mode 100644 index 000000000..d22dcbebf --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/user_profile.rs @@ -0,0 +1,111 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use super::sea_orm_active_enums::UserProfileFfvisibilityEnum; +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "user_profile")] +pub struct Model { + #[sea_orm(column_name = "userId", primary_key, auto_increment = false, unique)] + pub user_id: String, + pub location: Option, + pub birthday: Option, + pub description: Option, + #[sea_orm(column_type = "JsonBinary")] + pub fields: Json, + pub url: Option, + pub email: Option, + #[sea_orm(column_name = "emailVerifyCode")] + pub email_verify_code: Option, + #[sea_orm(column_name = "emailVerified")] + pub email_verified: bool, + #[sea_orm(column_name = "twoFactorTempSecret")] + pub two_factor_temp_secret: Option, + #[sea_orm(column_name = "twoFactorSecret")] + pub two_factor_secret: Option, + #[sea_orm(column_name = "twoFactorEnabled")] + pub two_factor_enabled: bool, + pub password: Option, + #[sea_orm(column_name = "clientData", column_type = "JsonBinary")] + pub client_data: Json, + #[sea_orm(column_name = "autoAcceptFollowed")] + pub auto_accept_followed: bool, + #[sea_orm(column_name = "alwaysMarkNsfw")] + pub always_mark_nsfw: bool, + #[sea_orm(column_name = "carefulBot")] + pub careful_bot: bool, + #[sea_orm(column_name = "userHost")] + pub user_host: Option, + #[sea_orm(column_name = "securityKeysAvailable")] + pub security_keys_available: bool, + #[sea_orm(column_name = "usePasswordLessLogin")] + pub use_password_less_login: bool, + #[sea_orm(column_name = "pinnedPageId", unique)] + pub pinned_page_id: Option, + #[sea_orm(column_type = "JsonBinary")] + pub room: Json, + #[sea_orm(column_type = "JsonBinary")] + pub integrations: Json, + #[sea_orm(column_name = "injectFeaturedNote")] + pub inject_featured_note: bool, + #[sea_orm(column_name = "enableWordMute")] + pub enable_word_mute: bool, + #[sea_orm(column_name = "mutedWords", column_type = "JsonBinary")] + pub muted_words: Json, + #[sea_orm(column_name = "mutingNotificationTypes")] + pub muting_notification_types: Vec, + #[sea_orm(column_name = "noCrawle")] + pub no_crawle: bool, + #[sea_orm(column_name = "receiveAnnouncementEmail")] + pub receive_announcement_email: bool, + #[sea_orm(column_name = "emailNotificationTypes", column_type = "JsonBinary")] + pub email_notification_types: Json, + pub lang: Option, + #[sea_orm(column_name = "mutedInstances", column_type = "JsonBinary")] + pub muted_instances: Json, + #[sea_orm(column_name = "publicReactions")] + pub public_reactions: bool, + #[sea_orm(column_name = "ffVisibility")] + pub ff_visibility: UserProfileFfvisibilityEnum, + #[sea_orm(column_name = "autoSensitive")] + pub auto_sensitive: bool, + #[sea_orm(column_name = "moderationNote")] + pub moderation_note: String, + #[sea_orm(column_name = "preventAiLearning")] + pub prevent_ai_learning: bool, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::page::Entity", + from = "Column::PinnedPageId", + to = "super::page::Column::Id", + on_update = "NoAction", + on_delete = "SetNull" + )] + Page, + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Page.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/user_publickey.rs b/packages/backend/native-utils/crates/model/src/entity/user_publickey.rs new file mode 100644 index 000000000..5cf6857e2 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/user_publickey.rs @@ -0,0 +1,35 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "user_publickey")] +pub struct Model { + #[sea_orm(column_name = "userId", primary_key, auto_increment = false, unique)] + pub user_id: String, + #[sea_orm(column_name = "keyId")] + pub key_id: String, + #[sea_orm(column_name = "keyPem")] + pub key_pem: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/user_security_key.rs b/packages/backend/native-utils/crates/model/src/entity/user_security_key.rs new file mode 100644 index 000000000..531b59ab8 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/user_security_key.rs @@ -0,0 +1,38 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "user_security_key")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "userId")] + pub user_id: String, + #[sea_orm(column_name = "publicKey")] + pub public_key: String, + #[sea_orm(column_name = "lastUsed")] + pub last_used: DateTimeWithTimeZone, + pub name: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/entity/webhook.rs b/packages/backend/native-utils/crates/model/src/entity/webhook.rs new file mode 100644 index 000000000..39508f7fa --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/entity/webhook.rs @@ -0,0 +1,44 @@ +//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 + +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[sea_orm(table_name = "webhook")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub id: String, + #[sea_orm(column_name = "createdAt")] + pub created_at: DateTimeWithTimeZone, + #[sea_orm(column_name = "userId")] + pub user_id: String, + pub name: String, + pub on: Vec, + pub url: String, + pub secret: String, + pub active: bool, + #[sea_orm(column_name = "latestSentAt")] + pub latest_sent_at: Option, + #[sea_orm(column_name = "latestStatus")] + pub latest_status: Option, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation { + #[sea_orm( + belongs_to = "super::user::Entity", + from = "Column::UserId", + to = "super::user::Column::Id", + on_update = "NoAction", + on_delete = "Cascade" + )] + User, +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::User.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/packages/backend/native-utils/crates/model/src/lib.rs b/packages/backend/native-utils/crates/model/src/lib.rs new file mode 100644 index 000000000..b14d29c34 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/lib.rs @@ -0,0 +1,3 @@ +pub mod entity; +pub mod repository; +pub mod schema; diff --git a/packages/backend/native-utils/crates/model/src/repository/abuse_user_report.rs b/packages/backend/native-utils/crates/model/src/repository/abuse_user_report.rs new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/repository/abuse_user_report.rs @@ -0,0 +1 @@ + diff --git a/packages/backend/native-utils/crates/model/src/repository/mod.rs b/packages/backend/native-utils/crates/model/src/repository/mod.rs new file mode 100644 index 000000000..f7a590081 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/repository/mod.rs @@ -0,0 +1 @@ +pub mod abuse_user_report; diff --git a/packages/backend/native-utils/crates/model/src/schema/antenna.rs b/packages/backend/native-utils/crates/model/src/schema/antenna.rs new file mode 100644 index 000000000..3bffe4f5f --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/schema/antenna.rs @@ -0,0 +1,128 @@ +use jsonschema::JSONSchema; +use once_cell::sync::Lazy; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use utoipa::ToSchema; + +use super::Schema; + +#[derive(Clone, Debug, Serialize, Deserialize, 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: AntennaSrcEnum, + 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, Serialize, Deserialize, JsonSchema, ToSchema)] +#[serde(rename_all = "lowercase")] +pub enum AntennaSrcEnum { + Home, + All, + Users, + List, + Group, + Instances, +} + +impl Schema for Antenna {} + +pub static VALIDATOR: Lazy = Lazy::new(|| Antenna::validator()); + +#[cfg(test)] +mod tests { + use serde_json::json; + + use super::VALIDATOR; + + #[test] + fn valid() { + let instance = json!({ + "id": "9f4x0bkx1u", + "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": ["9f4yjw6m13", "9f4yk2cp6d"], + "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 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" should 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, "9f4ykyuza6"], + "instances": ["9f4ykyuybo"], + // "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.schema_path.to_string()).collect(); + paths.sort(); + assert_eq!( + paths, + vec![ + "/properties/caseSensitive/type", + "/properties/createdAt/format", + "/properties/excludeKeywords/type", + "/properties/id/type", + "/properties/keywords/type", + "/properties/src/enum", + "/properties/userListId/type", + "/properties/users/items/type", + "/required" + ] + ); + } +} diff --git a/packages/backend/native-utils/crates/model/src/schema/app.rs b/packages/backend/native-utils/crates/model/src/schema/app.rs new file mode 100644 index 000000000..861bdc48a --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/schema/app.rs @@ -0,0 +1,108 @@ +use jsonschema::JSONSchema; +use once_cell::sync::Lazy; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use utoipa::ToSchema; + +use super::Schema; + +#[derive(Clone, Debug, Serialize, Deserialize, 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/calckey-js/src/consts.ts`. +#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, ToSchema)] +pub enum Permission { + #[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 tests { + #[test] + fn valid() { + todo!(); + } + + #[test] + fn invalid() { + todo!(); + } +} diff --git a/packages/backend/native-utils/crates/model/src/schema/mod.rs b/packages/backend/native-utils/crates/model/src/schema/mod.rs new file mode 100644 index 000000000..cc495aac1 --- /dev/null +++ b/packages/backend/native-utils/crates/model/src/schema/mod.rs @@ -0,0 +1,21 @@ +pub mod antenna; +pub mod app; + +use jsonschema::JSONSchema; +use schemars::{schema_for, JsonSchema}; + +/// Structs of schema defitions implement this trait in order to +/// provide the JSON Schema validator [`jsonschema::JSONSchema`]. +trait Schema { + /// Returns the validator of [JSON Schema Draft + /// 7](https://json-schema.org/specification-links.html#draft-7) with the + /// default settings of [`schemars::gen::SchemaSettings`]. + fn validator() -> JSONSchema { + let root = schema_for!(T); + let schema = serde_json::to_value(&root).expect("Schema definition invalid"); + JSONSchema::options() + .with_draft(jsonschema::Draft::Draft7) + .compile(&schema) + .expect("Unable to compile schema") + } +} diff --git a/packages/backend/native-utils/rustfmt.toml b/packages/backend/native-utils/rustfmt.toml deleted file mode 100644 index cab5731ed..000000000 --- a/packages/backend/native-utils/rustfmt.toml +++ /dev/null @@ -1,2 +0,0 @@ -tab_spaces = 2 -edition = "2021" diff --git a/packages/backend/native-utils/src/lib.rs b/packages/backend/native-utils/src/lib.rs index bc5b9fc7c..e13190140 100644 --- a/packages/backend/native-utils/src/lib.rs +++ b/packages/backend/native-utils/src/lib.rs @@ -1,2 +1 @@ - pub mod mastodon_api; diff --git a/packages/backend/native-utils/src/mastodon_api.rs b/packages/backend/native-utils/src/mastodon_api.rs index 36b4eb984..7a3ea455a 100644 --- a/packages/backend/native-utils/src/mastodon_api.rs +++ b/packages/backend/native-utils/src/mastodon_api.rs @@ -7,64 +7,64 @@ static CHAR_COLLECTION: &str = "0123456789abcdefghijklmnopqrstuvwxyz"; #[napi] pub enum IdConvertType { - MastodonId, - CalckeyId, + MastodonId, + CalckeyId, } #[napi] pub fn convert_id(in_id: String, id_convert_type: IdConvertType) -> napi::Result { - use IdConvertType::*; - match id_convert_type { - MastodonId => { - let mut out: i64 = 0; - for (i, c) in in_id.to_lowercase().chars().rev().enumerate() { - out += num_from_char(c)? as i64 * 36_i64.pow(i as u32); - } + use IdConvertType::*; + match id_convert_type { + MastodonId => { + let mut out: i64 = 0; + for (i, c) in in_id.to_lowercase().chars().rev().enumerate() { + out += num_from_char(c)? as i64 * 36_i64.pow(i as u32); + } - Ok(out.to_string()) - } - CalckeyId => { - let mut input: i64 = match in_id.parse() { - Ok(s) => s, - Err(_) => { - return Err(Error::new( - Status::InvalidArg, - "Unable to parse ID as MasstodonId", - )) + Ok(out.to_string()) } - }; - let mut out = String::new(); + CalckeyId => { + let mut input: i64 = match in_id.parse() { + Ok(s) => s, + Err(_) => { + return Err(Error::new( + Status::InvalidArg, + "Unable to parse ID as MasstodonId", + )) + } + }; + let mut out = String::new(); - while input != 0 { - out.insert(0, char_from_num((input % 36) as u8)?); - input /= 36; - } + while input != 0 { + out.insert(0, char_from_num((input % 36) as u8)?); + input /= 36; + } - Ok(out) + Ok(out) + } } - } } // -- end -- #[inline(always)] fn num_from_char(character: char) -> napi::Result { - for (i, c) in CHAR_COLLECTION.chars().enumerate() { - if c == character { - return Ok(i as u8); + for (i, c) in CHAR_COLLECTION.chars().enumerate() { + if c == character { + return Ok(i as u8); + } } - } - Err(Error::new( - Status::InvalidArg, - "Invalid character in parsed base36 id", - )) + Err(Error::new( + Status::InvalidArg, + "Invalid character in parsed base36 id", + )) } #[inline(always)] fn char_from_num(number: u8) -> napi::Result { - CHAR_COLLECTION - .chars() - .nth(number as usize) - .ok_or(Error::from_status(Status::Unknown)) + CHAR_COLLECTION + .chars() + .nth(number as usize) + .ok_or(Error::from_status(Status::Unknown)) }