Update schema, add status endpoint

This commit is contained in:
2020-09-07 16:51:01 -04:00
parent 170a3a8b02
commit 8d5fe7f75d
13 changed files with 249 additions and 246 deletions

View File

@@ -17,15 +17,17 @@ use crate::problem::forbidden_permission;
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct InteriorRef {
pub mod_name: String,
pub local_form_id: i32,
pub position_x: f64,
pub position_y: f64,
pub position_z: f64,
pub angle_x: f64,
pub angle_y: f64,
pub angle_z: f64,
pub scale: f64,
pub base_mod_name: String,
pub base_local_form_id: i32,
pub ref_mod_name: Option<String>,
pub ref_local_form_id: i32,
pub position_x: f32,
pub position_y: f32,
pub position_z: f32,
pub angle_x: f32,
pub angle_y: f32,
pub angle_z: f32,
pub scale: u16,
}
#[derive(Debug, Serialize, Deserialize, Clone)]

View File

@@ -19,7 +19,7 @@ pub struct Owner {
pub api_key: Option<Uuid>,
#[serde(skip_serializing)]
pub ip_address: Option<IpNetwork>,
pub mod_version: String,
pub mod_version: i32,
pub created_at: Option<NaiveDateTime>,
pub updated_at: Option<NaiveDateTime>,
}

View File

@@ -15,10 +15,11 @@ pub struct Shop {
pub name: String,
pub owner_id: Option<i32>,
pub description: String,
pub is_not_sell_buy: bool,
pub sell_buy_list_id: i32,
pub vendor_id: i32,
pub vendor_gold: i32,
// removing these until I figure out the plan for buying and selling
// pub is_not_sell_buy: bool,
// pub sell_buy_list_id: i32,
// pub vendor_id: i32,
// pub vendor_gold: i32,
pub created_at: Option<NaiveDateTime>,
pub updated_at: Option<NaiveDateTime>,
}
@@ -46,17 +47,12 @@ impl Model for Shop {
Ok(sqlx::query_as!(
Self,
"INSERT INTO shops
(name, owner_id, description, is_not_sell_buy, sell_buy_list_id, vendor_id,
vendor_gold, created_at, updated_at)
VALUES ($1, $2, $3, $4, $5, $6, $7, now(), now())
(name, owner_id, description, created_at, updated_at)
VALUES ($1, $2, $3, now(), now())
RETURNING *",
self.name,
self.owner_id,
self.description,
self.is_not_sell_buy,
self.sell_buy_list_id,
self.vendor_id,
self.vendor_gold,
)
.fetch_one(db)
.await?)