eshop
Some checks failed
CI / Check Style (push) Has been cancelled
CI / Run Clippy (push) Has been cancelled
CI / Run Tests (push) Has been cancelled

This commit is contained in:
Priec
2026-06-16 16:35:50 +02:00
parent c4f60dd8d7
commit baf7522273
87 changed files with 3270 additions and 3483 deletions

View File

@@ -1,51 +0,0 @@
//! `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()
}
}

View File

@@ -1,37 +0,0 @@
//! `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())
}
}

View File

@@ -1,58 +0,0 @@
//! `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())
}
}

View File

@@ -1,42 +0,0 @@
//! `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()
}
}

View File

@@ -0,0 +1,33 @@
//! `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 = "categories")]
pub struct Model {
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
#[sea_orm(primary_key)]
pub id: i32,
pub name: String,
#[sea_orm(unique)]
pub slug: String,
#[sea_orm(column_type = "Text", nullable)]
pub description: Option<String>,
pub image_id: Option<String>,
pub position: i32,
pub published: bool,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::products::Entity")]
Products,
}
impl Related<super::products::Entity> for Entity {
fn to() -> RelationDef {
Relation::Products.def()
}
}

View File

@@ -2,11 +2,12 @@
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 categories;
pub mod order_items;
pub mod orders;
pub mod product_images;
pub mod product_product_tags;
pub mod product_tags;
pub mod products;
pub mod users;

View File

@@ -0,0 +1,50 @@
//! `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 = "order_items")]
pub struct Model {
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
#[sea_orm(primary_key)]
pub id: i32,
pub product_name: String,
pub unit_price_cents: i64,
pub quantity: i32,
pub order_id: i32,
pub product_id: Option<i32>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::orders::Entity",
from = "Column::OrderId",
to = "super::orders::Column::Id",
on_update = "Cascade",
on_delete = "Cascade"
)]
Orders,
#[sea_orm(
belongs_to = "super::products::Entity",
from = "Column::ProductId",
to = "super::products::Column::Id",
on_update = "NoAction",
on_delete = "SetNull"
)]
Products,
}
impl Related<super::orders::Entity> for Entity {
fn to() -> RelationDef {
Relation::Orders.def()
}
}
impl Related<super::products::Entity> for Entity {
fn to() -> RelationDef {
Relation::Products.def()
}
}

View File

@@ -0,0 +1,38 @@
//! `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 = "orders")]
pub struct Model {
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
#[sea_orm(primary_key)]
pub id: i32,
#[sea_orm(unique)]
pub order_number: String,
pub email: String,
pub customer_name: Option<String>,
pub status: String,
pub total_cents: i64,
pub currency: String,
pub address: Option<String>,
pub city: Option<String>,
pub zip: Option<String>,
pub country: Option<String>,
#[sea_orm(column_type = "Text", nullable)]
pub note: Option<String>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::order_items::Entity")]
OrderItems,
}
impl Related<super::order_items::Entity> for Entity {
fn to() -> RelationDef {
Relation::OrderItems.def()
}
}

View File

@@ -1,10 +1,11 @@
//! `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::categories::Entity as Categories;
pub use super::order_items::Entity as OrderItems;
pub use super::orders::Entity as Orders;
pub use super::product_images::Entity as ProductImages;
pub use super::product_product_tags::Entity as ProductProductTags;
pub use super::product_tags::Entity as ProductTags;
pub use super::products::Entity as Products;
pub use super::users::Entity as Users;

View File

@@ -0,0 +1,35 @@
//! `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 = "product_images")]
pub struct Model {
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
#[sea_orm(primary_key)]
pub id: i32,
pub image_id: String,
pub position: i32,
pub alt: Option<String>,
pub product_id: i32,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::products::Entity",
from = "Column::ProductId",
to = "super::products::Column::Id",
on_update = "Cascade",
on_delete = "Cascade"
)]
Products,
}
impl Related<super::products::Entity> for Entity {
fn to() -> RelationDef {
Relation::Products.def()
}
}

View File

@@ -4,43 +4,42 @@ use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
#[sea_orm(table_name = "audio_track_tags")]
#[sea_orm(table_name = "product_product_tags")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub track_id: Uuid,
pub product_id: i32,
#[sea_orm(primary_key, auto_increment = false)]
pub tag_id: Uuid,
pub created_at: DateTimeWithTimeZone,
pub product_tag_id: i32,
}
#[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",
belongs_to = "super::product_tags::Entity",
from = "Column::ProductTagId",
to = "super::product_tags::Column::Id",
on_update = "Cascade",
on_delete = "Cascade"
)]
AudioTags,
ProductTags,
#[sea_orm(
belongs_to = "super::audio_tracks::Entity",
from = "Column::TrackId",
to = "super::audio_tracks::Column::Id",
belongs_to = "super::products::Entity",
from = "Column::ProductId",
to = "super::products::Column::Id",
on_update = "Cascade",
on_delete = "Cascade"
)]
AudioTracks,
Products,
}
impl Related<super::audio_tags::Entity> for Entity {
impl Related<super::product_tags::Entity> for Entity {
fn to() -> RelationDef {
Relation::AudioTags.def()
Relation::ProductTags.def()
}
}
impl Related<super::audio_tracks::Entity> for Entity {
impl Related<super::products::Entity> for Entity {
fn to() -> RelationDef {
Relation::AudioTracks.def()
Relation::Products.def()
}
}

View File

@@ -0,0 +1,41 @@
//! `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 = "product_tags")]
pub struct Model {
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
#[sea_orm(primary_key)]
pub id: i32,
pub name: String,
#[sea_orm(unique)]
pub slug: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::product_product_tags::Entity")]
ProductProductTags,
}
impl Related<super::product_product_tags::Entity> for Entity {
fn to() -> RelationDef {
Relation::ProductProductTags.def()
}
}
impl Related<super::products::Entity> for Entity {
fn to() -> RelationDef {
super::product_product_tags::Relation::Products.def()
}
fn via() -> Option<RelationDef> {
Some(
super::product_product_tags::Relation::ProductTags
.def()
.rev(),
)
}
}

View File

@@ -0,0 +1,77 @@
//! `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 = "products")]
pub struct Model {
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
#[sea_orm(primary_key)]
pub id: i32,
pub name: String,
#[sea_orm(unique)]
pub slug: String,
#[sea_orm(column_type = "Text", nullable)]
pub description: Option<String>,
pub price_cents: i64,
pub currency: String,
pub sku: Option<String>,
pub stock: i32,
pub view_count: i32,
pub published: bool,
pub published_at: Option<DateTimeWithTimeZone>,
pub category_id: Option<i32>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::categories::Entity",
from = "Column::CategoryId",
to = "super::categories::Column::Id",
on_update = "NoAction",
on_delete = "SetNull"
)]
Categories,
#[sea_orm(has_many = "super::order_items::Entity")]
OrderItems,
#[sea_orm(has_many = "super::product_images::Entity")]
ProductImages,
#[sea_orm(has_many = "super::product_product_tags::Entity")]
ProductProductTags,
}
impl Related<super::categories::Entity> for Entity {
fn to() -> RelationDef {
Relation::Categories.def()
}
}
impl Related<super::order_items::Entity> for Entity {
fn to() -> RelationDef {
Relation::OrderItems.def()
}
}
impl Related<super::product_images::Entity> for Entity {
fn to() -> RelationDef {
Relation::ProductImages.def()
}
}
impl Related<super::product_product_tags::Entity> for Entity {
fn to() -> RelationDef {
Relation::ProductProductTags.def()
}
}
impl Related<super::product_tags::Entity> for Entity {
fn to() -> RelationDef {
super::product_product_tags::Relation::ProductTags.def()
}
fn via() -> Option<RelationDef> {
Some(super::product_product_tags::Relation::Products.def().rev())
}
}

View File

@@ -1,21 +0,0 @@
//! `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 {}

View File

@@ -29,18 +29,8 @@ pub struct Model {
#[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 {
@@ -48,9 +38,3 @@ impl Related<super::audit_logs::Entity> for Entity {
Relation::AuditLogs.def()
}
}
impl Related<super::blog_articles::Entity> for Entity {
fn to() -> RelationDef {
Relation::BlogArticles.def()
}
}

View File

@@ -1,22 +0,0 @@
pub use super::_entities::audio_track_tags::{ActiveModel, Entity, Model};
use sea_orm::entity::prelude::*;
pub type AudioTrackTags = Entity;
#[async_trait::async_trait]
impl ActiveModelBehavior for ActiveModel {
async fn before_save<C>(self, _db: &C, _insert: bool) -> std::result::Result<Self, DbErr>
where
C: ConnectionTrait,
{
Ok(self)
}
}
// implement your read-oriented logic here
impl Model {}
// implement your write-oriented logic here
impl ActiveModel {}
// implement your custom finders, selectors oriented logic here
impl Entity {}

View File

@@ -1,6 +1,6 @@
pub use super::_entities::audio_tracks::{ActiveModel, Entity, Model};
use sea_orm::entity::prelude::*;
pub type AudioTracks = Entity;
pub use super::_entities::categories::{ActiveModel, Model, Entity};
pub type Categories = Entity;
#[async_trait::async_trait]
impl ActiveModelBehavior for ActiveModel {

View File

@@ -1,9 +1,10 @@
pub mod _entities;
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;
pub mod categories;
pub mod products;
pub mod product_images;
pub mod product_tags;
pub mod product_product_tags;
pub mod orders;
pub mod order_items;

View File

@@ -1,6 +1,6 @@
pub use super::_entities::audio_albums::{ActiveModel, Entity, Model};
use sea_orm::entity::prelude::*;
pub type AudioAlbums = Entity;
pub use super::_entities::order_items::{ActiveModel, Model, Entity};
pub type OrderItems = Entity;
#[async_trait::async_trait]
impl ActiveModelBehavior for ActiveModel {

View File

@@ -1,6 +1,6 @@
pub use super::_entities::blog_articles::{ActiveModel, Entity, Model};
use sea_orm::entity::prelude::*;
pub type BlogArticles = Entity;
pub use super::_entities::orders::{ActiveModel, Model, Entity};
pub type Orders = Entity;
#[async_trait::async_trait]
impl ActiveModelBehavior for ActiveModel {

View File

@@ -0,0 +1,28 @@
use sea_orm::entity::prelude::*;
pub use super::_entities::product_images::{ActiveModel, Model, Entity};
pub type ProductImages = Entity;
#[async_trait::async_trait]
impl ActiveModelBehavior for ActiveModel {
async fn before_save<C>(self, _db: &C, insert: bool) -> std::result::Result<Self, DbErr>
where
C: ConnectionTrait,
{
if !insert && self.updated_at.is_unchanged() {
let mut this = self;
this.updated_at = sea_orm::ActiveValue::Set(chrono::Utc::now().into());
Ok(this)
} else {
Ok(self)
}
}
}
// implement your read-oriented logic here
impl Model {}
// implement your write-oriented logic here
impl ActiveModel {}
// implement your custom finders, selectors oriented logic here
impl Entity {}

View File

@@ -1,6 +1,6 @@
pub use super::_entities::audio_tags::{ActiveModel, Entity, Model};
use sea_orm::entity::prelude::*;
pub type AudioTags = Entity;
pub use super::_entities::product_product_tags::{ActiveModel, Model, Entity};
pub type ProductProductTags = Entity;
#[async_trait::async_trait]
impl ActiveModelBehavior for ActiveModel {

View File

@@ -0,0 +1,28 @@
use sea_orm::entity::prelude::*;
pub use super::_entities::product_tags::{ActiveModel, Model, Entity};
pub type ProductTags = Entity;
#[async_trait::async_trait]
impl ActiveModelBehavior for ActiveModel {
async fn before_save<C>(self, _db: &C, insert: bool) -> std::result::Result<Self, DbErr>
where
C: ConnectionTrait,
{
if !insert && self.updated_at.is_unchanged() {
let mut this = self;
this.updated_at = sea_orm::ActiveValue::Set(chrono::Utc::now().into());
Ok(this)
} else {
Ok(self)
}
}
}
// implement your read-oriented logic here
impl Model {}
// implement your write-oriented logic here
impl ActiveModel {}
// implement your custom finders, selectors oriented logic here
impl Entity {}

View File

@@ -1,6 +1,6 @@
pub use super::_entities::site_pages::{ActiveModel, Entity, Model};
use sea_orm::entity::prelude::*;
pub type SitePages = Entity;
pub use super::_entities::products::{ActiveModel, Model, Entity};
pub type Products = Entity;
#[async_trait::async_trait]
impl ActiveModelBehavior for ActiveModel {
@@ -18,6 +18,11 @@ impl ActiveModelBehavior for ActiveModel {
}
}
// implement your read-oriented logic here
impl Model {}
// implement your write-oriented logic here
impl ActiveModel {}
// implement your custom finders, selectors oriented logic here
impl Entity {}