eshop
This commit is contained in:
38
src/models/_entities/orders.rs
Normal file
38
src/models/_entities/orders.rs
Normal 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()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user