global discount price
This commit is contained in:
36
src/models/_entities/audience_discount_profiles.rs
Normal file
36
src/models/_entities/audience_discount_profiles.rs
Normal file
@@ -0,0 +1,36 @@
|
||||
//! `SeaORM` Entity assigning a discount profile to a whole audience (all
|
||||
//! personal viewers or all company accounts). Hand-written to match the
|
||||
//! `audience_discount_profiles` migration.
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "audience_discount_profiles")]
|
||||
pub struct Model {
|
||||
pub created_at: DateTimeWithTimeZone,
|
||||
pub updated_at: DateTimeWithTimeZone,
|
||||
#[sea_orm(primary_key)]
|
||||
pub id: i32,
|
||||
/// "personal" or "business".
|
||||
pub audience: String,
|
||||
pub discount_profile_id: i32,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(
|
||||
belongs_to = "super::discount_profiles::Entity",
|
||||
from = "Column::DiscountProfileId",
|
||||
to = "super::discount_profiles::Column::Id",
|
||||
on_update = "Cascade",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
DiscountProfiles,
|
||||
}
|
||||
|
||||
impl Related<super::discount_profiles::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::DiscountProfiles.def()
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ pub mod prelude;
|
||||
|
||||
pub mod account_discount_profiles;
|
||||
pub mod account_product_prices;
|
||||
pub mod audience_discount_profiles;
|
||||
pub mod account_product_resolutions;
|
||||
pub mod audit_logs;
|
||||
pub mod categories;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
pub use super::account_discount_profiles::Entity as AccountDiscountProfiles;
|
||||
pub use super::account_product_prices::Entity as AccountProductPrices;
|
||||
pub use super::account_product_resolutions::Entity as AccountProductResolutions;
|
||||
pub use super::audience_discount_profiles::Entity as AudienceDiscountProfiles;
|
||||
pub use super::audit_logs::Entity as AuditLogs;
|
||||
pub use super::categories::Entity as Categories;
|
||||
pub use super::customer_profiles::Entity as CustomerProfiles;
|
||||
|
||||
Reference in New Issue
Block a user