Matching model, table and schema

This commit is contained in:
2023-07-21 20:15:06 +02:00
parent fff33c1e21
commit 9fd99acf2e
3 changed files with 21 additions and 20 deletions

View File

@@ -1,28 +1,29 @@
use std::f64::consts::PI;
use diesel::prelude::*;
use std::f64::consts::PI;
use crate::{unit_conversion::UnitsConversion, Point};
#[derive(Debug, Clone, Default,Queryable, Selectable)]
#[derive(Debug, Clone, Default, Queryable, Selectable, serde::Serialize, serde::Deserialize)]
#[diesel(check_for_backend(diesel::pg::Pg))]
#[diesel(table_name = crate::schema::antennas)]
pub struct Antenna {
pub id: String,
pub tssi: f64,
pub pos_x: f64,
pub pos_y: f64,
pub pos_z: f64,
pub comment: Option<String>,
pos_x: f64,
pos_y: f64,
pos_z: f64,
}
#[derive(Insertable)]
#[derive(Debug, Clone, Copy, Insertable, AsChangeset, serde::Deserialize)]
#[diesel(table_name = crate::schema::antennas)]
pub struct NewAntenna<'a> {
id: &'a str,
comment: Option<&'a str>,
tssi: f64,
pos_x: f64,
pos_y: f64,
pos_z: f64,
pub id: &'a str,
pub tssi: f64,
pub pos_x: f64,
pub pos_y: f64,
pub pos_z: f64,
pub comment: Option<&'a str>,
}
impl Antenna {