added listings
This commit is contained in:
52
src/listing/structs.rs
Normal file
52
src/listing/structs.rs
Normal file
@@ -0,0 +1,52 @@
|
||||
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 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,
|
||||
}
|
||||
|
||||
#[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>,
|
||||
}
|
||||
Reference in New Issue
Block a user