Initial commit

This commit is contained in:
Bad Manners 2025-04-06 19:14:10 -03:00
commit 2722c7d40a
36 changed files with 6266 additions and 0 deletions

8
src/entities/mod.rs Normal file
View file

@ -0,0 +1,8 @@
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.8
pub mod prelude;
pub mod samey_post;
pub mod samey_post_source;
pub mod samey_tag;
pub mod samey_tag_post;

6
src/entities/prelude.rs Normal file
View file

@ -0,0 +1,6 @@
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.8
pub use super::samey_post::Entity as SameyPost;
pub use super::samey_post_source::Entity as SameyPostSource;
pub use super::samey_tag::Entity as SameyTag;
pub use super::samey_tag_post::Entity as SameyTagPost;

View file

@ -0,0 +1,52 @@
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.8
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "samey_post")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: i32,
pub media: String,
pub width: i32,
pub height: i32,
pub thumbnail: String,
pub title: Option<String>,
#[sea_orm(column_type = "Text", nullable)]
pub description: Option<String>,
pub is_public: bool,
#[sea_orm(column_type = "custom(\"enum_text\")")]
pub rating: String,
pub uploaded_at: DateTime,
pub parent_id: Option<i32>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "Entity",
from = "Column::ParentId",
to = "Column::Id",
on_update = "NoAction",
on_delete = "SetNull"
)]
SelfRef,
#[sea_orm(has_many = "super::samey_post_source::Entity")]
SameyPostSource,
#[sea_orm(has_many = "super::samey_tag_post::Entity")]
SameyTagPost,
}
impl Related<super::samey_post_source::Entity> for Entity {
fn to() -> RelationDef {
Relation::SameyPostSource.def()
}
}
impl Related<super::samey_tag_post::Entity> for Entity {
fn to() -> RelationDef {
Relation::SameyTagPost.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View file

@ -0,0 +1,32 @@
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.8
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "samey_post_source")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: i32,
pub url: String,
pub post_id: i32,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::samey_post::Entity",
from = "Column::PostId",
to = "super::samey_post::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
SameyPost,
}
impl Related<super::samey_post::Entity> for Entity {
fn to() -> RelationDef {
Relation::SameyPost.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

27
src/entities/samey_tag.rs Normal file
View file

@ -0,0 +1,27 @@
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.8
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "samey_tag")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: i32,
pub name: String,
#[sea_orm(unique)]
pub normalized_name: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::samey_tag_post::Entity")]
SameyTagPost,
}
impl Related<super::samey_tag_post::Entity> for Entity {
fn to() -> RelationDef {
Relation::SameyTagPost.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View file

@ -0,0 +1,46 @@
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.8
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "samey_tag_post")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: i32,
pub tag_id: i32,
pub post_id: i32,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::samey_post::Entity",
from = "Column::PostId",
to = "super::samey_post::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
SameyPost,
#[sea_orm(
belongs_to = "super::samey_tag::Entity",
from = "Column::TagId",
to = "super::samey_tag::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
SameyTag,
}
impl Related<super::samey_post::Entity> for Entity {
fn to() -> RelationDef {
Relation::SameyPost.def()
}
}
impl Related<super::samey_tag::Entity> for Entity {
fn to() -> RelationDef {
Relation::SameyTag.def()
}
}
impl ActiveModelBehavior for ActiveModel {}