add real db

This commit is contained in:
Romulus21
2024-10-04 13:58:26 +02:00
parent 72b65063be
commit c931845899
10 changed files with 147 additions and 30 deletions

8
src/models/link.rs Normal file
View File

@@ -0,0 +1,8 @@
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct Link {
id: u16,
link: String,
name: String,
}

View File

@@ -1,3 +1,4 @@
mod link;
mod value;
pub use value::Value;
pub use value::OPTIONS;

View File

@@ -1,4 +1,3 @@
use chrono::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Debug)]
@@ -62,7 +61,7 @@ impl Value {
};
sqlx::query!(
"INSERT INTO data(service, device, type, data, date_data) VALUES (?, ?, ?, ?, NOW())",
"INSERT INTO donnees(service, capteur, type, donnee, date_donnee) VALUES (?, ?, ?, ?, NOW())",
option.service,
option.device,
option.r_type,