56 lines
1.5 KiB
Rust
56 lines
1.5 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
use sqlx::FromRow;
|
|
use chrono::{DateTime, Utc};
|
|
|
|
#[derive(Debug, Serialize, Deserialize, FromRow)]
|
|
#[allow(dead_code)]
|
|
pub struct Listing {
|
|
pub id: i32,
|
|
pub company_name: String,
|
|
pub is_active: bool,
|
|
pub price_per_gallon: f64,
|
|
pub price_per_gallon_cash: Option<f64>,
|
|
pub note: Option<String>,
|
|
pub minimum_order: Option<i32>,
|
|
pub service: bool,
|
|
pub bio_percent: i32,
|
|
pub phone: Option<String>,
|
|
pub online_ordering: String,
|
|
pub county_id: i32,
|
|
pub town: Option<String>,
|
|
pub user_id: i32,
|
|
pub last_edited: DateTime<Utc>,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
pub struct CreateListingRequest {
|
|
pub company_name: String,
|
|
pub is_active: bool,
|
|
pub price_per_gallon: f64,
|
|
pub price_per_gallon_cash: Option<f64>,
|
|
pub note: Option<String>,
|
|
pub minimum_order: Option<i32>,
|
|
pub service: bool,
|
|
pub bio_percent: i32,
|
|
pub phone: Option<String>,
|
|
pub online_ordering: String,
|
|
pub county_id: i32,
|
|
pub town: Option<String>,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
pub struct UpdateListingRequest {
|
|
pub company_name: Option<String>,
|
|
pub is_active: Option<bool>,
|
|
pub price_per_gallon: Option<f64>,
|
|
pub price_per_gallon_cash: Option<f64>,
|
|
pub note: Option<String>,
|
|
pub minimum_order: Option<i32>,
|
|
pub service: Option<bool>,
|
|
pub bio_percent: Option<i32>,
|
|
pub phone: Option<String>,
|
|
pub online_ordering: Option<String>,
|
|
pub county_id: Option<i32>,
|
|
pub town: Option<String>,
|
|
}
|