initial commit of gitara site
This commit is contained in:
51
src/models/_entities/audio_albums.rs
Normal file
51
src/models/_entities/audio_albums.rs
Normal file
@@ -0,0 +1,51 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.20
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "audio_albums")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub id: Uuid,
|
||||
pub title: String,
|
||||
#[sea_orm(unique)]
|
||||
pub slug: String,
|
||||
#[sea_orm(column_type = "Text", nullable)]
|
||||
pub description: Option<String>,
|
||||
pub cover_image_id: Option<String>,
|
||||
pub artist: Option<String>,
|
||||
pub release_date: Option<Date>,
|
||||
pub published: bool,
|
||||
pub uploader_id: i32,
|
||||
pub view_count: i32,
|
||||
pub created_at: DateTimeWithTimeZone,
|
||||
pub updated_at: DateTimeWithTimeZone,
|
||||
pub published_at: Option<DateTimeWithTimeZone>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(has_many = "super::audio_tracks::Entity")]
|
||||
AudioTracks,
|
||||
#[sea_orm(
|
||||
belongs_to = "super::users::Entity",
|
||||
from = "Column::UploaderId",
|
||||
to = "super::users::Column::Id",
|
||||
on_update = "Cascade",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
Users,
|
||||
}
|
||||
|
||||
impl Related<super::audio_tracks::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::AudioTracks.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::users::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::Users.def()
|
||||
}
|
||||
}
|
||||
37
src/models/_entities/audio_tags.rs
Normal file
37
src/models/_entities/audio_tags.rs
Normal file
@@ -0,0 +1,37 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.20
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "audio_tags")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub id: Uuid,
|
||||
#[sea_orm(unique)]
|
||||
pub name: String,
|
||||
#[sea_orm(unique)]
|
||||
pub slug: String,
|
||||
pub created_at: DateTimeWithTimeZone,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(has_many = "super::audio_track_tags::Entity")]
|
||||
AudioTrackTags,
|
||||
}
|
||||
|
||||
impl Related<super::audio_track_tags::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::AudioTrackTags.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::audio_tracks::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
super::audio_track_tags::Relation::AudioTracks.def()
|
||||
}
|
||||
fn via() -> Option<RelationDef> {
|
||||
Some(super::audio_track_tags::Relation::AudioTags.def().rev())
|
||||
}
|
||||
}
|
||||
46
src/models/_entities/audio_track_tags.rs
Normal file
46
src/models/_entities/audio_track_tags.rs
Normal file
@@ -0,0 +1,46 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.20
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "audio_track_tags")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub track_id: Uuid,
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub tag_id: Uuid,
|
||||
pub created_at: DateTimeWithTimeZone,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(
|
||||
belongs_to = "super::audio_tags::Entity",
|
||||
from = "Column::TagId",
|
||||
to = "super::audio_tags::Column::Id",
|
||||
on_update = "Cascade",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
AudioTags,
|
||||
#[sea_orm(
|
||||
belongs_to = "super::audio_tracks::Entity",
|
||||
from = "Column::TrackId",
|
||||
to = "super::audio_tracks::Column::Id",
|
||||
on_update = "Cascade",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
AudioTracks,
|
||||
}
|
||||
|
||||
impl Related<super::audio_tags::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::AudioTags.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::audio_tracks::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::AudioTracks.def()
|
||||
}
|
||||
}
|
||||
58
src/models/_entities/audio_tracks.rs
Normal file
58
src/models/_entities/audio_tracks.rs
Normal file
@@ -0,0 +1,58 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.20
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "audio_tracks")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub id: Uuid,
|
||||
pub album_id: Option<Uuid>,
|
||||
pub title: String,
|
||||
pub slug: String,
|
||||
pub audio_file_id: String,
|
||||
pub track_number: Option<i32>,
|
||||
pub duration: Option<i32>,
|
||||
pub featured: bool,
|
||||
pub published: bool,
|
||||
pub play_count: i32,
|
||||
pub created_at: DateTimeWithTimeZone,
|
||||
pub updated_at: DateTimeWithTimeZone,
|
||||
pub published_at: Option<DateTimeWithTimeZone>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(
|
||||
belongs_to = "super::audio_albums::Entity",
|
||||
from = "Column::AlbumId",
|
||||
to = "super::audio_albums::Column::Id",
|
||||
on_update = "Cascade",
|
||||
on_delete = "SetNull"
|
||||
)]
|
||||
AudioAlbums,
|
||||
#[sea_orm(has_many = "super::audio_track_tags::Entity")]
|
||||
AudioTrackTags,
|
||||
}
|
||||
|
||||
impl Related<super::audio_albums::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::AudioAlbums.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::audio_track_tags::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::AudioTrackTags.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::audio_tags::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
super::audio_track_tags::Relation::AudioTags.def()
|
||||
}
|
||||
fn via() -> Option<RelationDef> {
|
||||
Some(super::audio_track_tags::Relation::AudioTracks.def().rev())
|
||||
}
|
||||
}
|
||||
40
src/models/_entities/audit_logs.rs
Normal file
40
src/models/_entities/audit_logs.rs
Normal file
@@ -0,0 +1,40 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.20
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "audit_logs")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub id: Uuid,
|
||||
pub admin_user_id: i32,
|
||||
pub action: String,
|
||||
pub target_type: Option<String>,
|
||||
pub target_id: Option<Uuid>,
|
||||
#[sea_orm(column_type = "JsonBinary", nullable)]
|
||||
pub details: Option<Json>,
|
||||
#[sea_orm(column_type = "custom(\"inet\")", nullable)]
|
||||
pub ip_address: Option<String>,
|
||||
#[sea_orm(column_type = "Text", nullable)]
|
||||
pub user_agent: Option<String>,
|
||||
pub created_at: DateTimeWithTimeZone,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(
|
||||
belongs_to = "super::users::Entity",
|
||||
from = "Column::AdminUserId",
|
||||
to = "super::users::Column::Id",
|
||||
on_update = "Cascade",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
Users,
|
||||
}
|
||||
|
||||
impl Related<super::users::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::Users.def()
|
||||
}
|
||||
}
|
||||
42
src/models/_entities/blog_articles.rs
Normal file
42
src/models/_entities/blog_articles.rs
Normal file
@@ -0,0 +1,42 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.20
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "blog_articles")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub id: Uuid,
|
||||
pub title: String,
|
||||
#[sea_orm(unique)]
|
||||
pub slug: String,
|
||||
#[sea_orm(column_type = "Text")]
|
||||
pub content: String,
|
||||
pub excerpt: Option<String>,
|
||||
pub published: bool,
|
||||
pub author_id: i32,
|
||||
pub featured_image_id: Option<String>,
|
||||
pub view_count: i32,
|
||||
pub created_at: DateTimeWithTimeZone,
|
||||
pub updated_at: DateTimeWithTimeZone,
|
||||
pub published_at: Option<DateTimeWithTimeZone>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(
|
||||
belongs_to = "super::users::Entity",
|
||||
from = "Column::AuthorId",
|
||||
to = "super::users::Column::Id",
|
||||
on_update = "Cascade",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
Users,
|
||||
}
|
||||
|
||||
impl Related<super::users::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::Users.def()
|
||||
}
|
||||
}
|
||||
12
src/models/_entities/mod.rs
Normal file
12
src/models/_entities/mod.rs
Normal file
@@ -0,0 +1,12 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.20
|
||||
|
||||
pub mod prelude;
|
||||
|
||||
pub mod audio_albums;
|
||||
pub mod audio_tags;
|
||||
pub mod audio_track_tags;
|
||||
pub mod audio_tracks;
|
||||
pub mod audit_logs;
|
||||
pub mod blog_articles;
|
||||
pub mod site_pages;
|
||||
pub mod users;
|
||||
10
src/models/_entities/prelude.rs
Normal file
10
src/models/_entities/prelude.rs
Normal file
@@ -0,0 +1,10 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.20
|
||||
|
||||
pub use super::audio_albums::Entity as AudioAlbums;
|
||||
pub use super::audio_tags::Entity as AudioTags;
|
||||
pub use super::audio_track_tags::Entity as AudioTrackTags;
|
||||
pub use super::audio_tracks::Entity as AudioTracks;
|
||||
pub use super::audit_logs::Entity as AuditLogs;
|
||||
pub use super::blog_articles::Entity as BlogArticles;
|
||||
pub use super::site_pages::Entity as SitePages;
|
||||
pub use super::users::Entity as Users;
|
||||
21
src/models/_entities/site_pages.rs
Normal file
21
src/models/_entities/site_pages.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.20
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "site_pages")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub id: Uuid,
|
||||
#[sea_orm(unique)]
|
||||
pub slug: String,
|
||||
pub title: String,
|
||||
#[sea_orm(column_type = "Text")]
|
||||
pub content: String,
|
||||
pub created_at: DateTimeWithTimeZone,
|
||||
pub updated_at: DateTimeWithTimeZone,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {}
|
||||
56
src/models/_entities/users.rs
Normal file
56
src/models/_entities/users.rs
Normal file
@@ -0,0 +1,56 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.20
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "users")]
|
||||
pub struct Model {
|
||||
pub created_at: DateTimeWithTimeZone,
|
||||
pub updated_at: DateTimeWithTimeZone,
|
||||
#[sea_orm(primary_key)]
|
||||
pub id: i32,
|
||||
pub pid: Uuid,
|
||||
#[sea_orm(unique)]
|
||||
pub email: String,
|
||||
pub password: String,
|
||||
#[sea_orm(unique)]
|
||||
pub api_key: String,
|
||||
pub name: String,
|
||||
pub reset_token: Option<String>,
|
||||
pub reset_sent_at: Option<DateTimeWithTimeZone>,
|
||||
pub email_verification_token: Option<String>,
|
||||
pub email_verification_sent_at: Option<DateTimeWithTimeZone>,
|
||||
pub email_verified_at: Option<DateTimeWithTimeZone>,
|
||||
pub magic_link_token: Option<String>,
|
||||
pub magic_link_expiration: Option<DateTimeWithTimeZone>,
|
||||
pub theme: String,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(has_many = "super::audio_albums::Entity")]
|
||||
AudioAlbums,
|
||||
#[sea_orm(has_many = "super::audit_logs::Entity")]
|
||||
AuditLogs,
|
||||
#[sea_orm(has_many = "super::blog_articles::Entity")]
|
||||
BlogArticles,
|
||||
}
|
||||
|
||||
impl Related<super::audio_albums::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::AudioAlbums.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::audit_logs::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::AuditLogs.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::blog_articles::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::BlogArticles.def()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user