brett plis

This commit is contained in:
Valmo Trindade
2024-09-12 02:17:52 -03:00
parent cb9ca9cd20
commit d3af4e064b
4 changed files with 56 additions and 30 deletions

View File

@@ -1,15 +1,17 @@
pub(crate) mod markers {
use log::info;
use crate::structs::Marker;
pub fn get(placeholder: String) -> &'static str {
info!("{}", placeholder);
return "not implemented yet";
}
pub fn post(placeholder: Vec<String>) -> &'static str {
for item in placeholder {
info!("Item: {}", item)
pub fn post(data: Vec<Marker>) -> &'static str {
for item in data {
info!("{} - {}", item.uid, item.name)
}
return "not implemented yet";

View File

@@ -1,7 +1,6 @@
use arma_rs::{arma, Extension, Group};
use util::get_uuid;
mod commands;
mod services;
mod structs;
mod tests;
mod util;

View File

@@ -2,23 +2,56 @@ use serde::Serialize;
#[derive(Serialize)]
pub struct Marker {
pub longitude: f64,
pub latitude: f64,
pub name: String,
pub uid: String,
pub r#type: Option<String>,
pub course: Option<i32>,
pub azimuth: Option<i32>,
pub speed: Option<i32>,
pub battery: Option<i32>,
pub fov: Option<i32>,
pub ce: Option<i32>,
pub hae: Option<i32>,
pub le: Option<i32>,
pub longitude: f64,
pub latitude: f64,
pub name: String,
pub uid: String,
pub r#type: String,
pub course: i32,
pub speed: i32,
pub hae: i32,
pub api_address: String,
pub api_auth_token: String,
}
pub struct MarkerPayload {
pub api_address: String,
pub api_auth_token: String,
pub markers: [Marker],
}
use arma_rs::FromArma;
impl FromArma for Marker {
fn from_arma(data: String) -> Result<Self, String> {
let (
uid,
latitude,
longitude,
speed,
course,
r#type,
name,
hae,
api_address,
api_auth_token,
) = <(
String,
f64,
f64,
i32,
i32,
String,
String,
i32,
String,
String,
)>::from_arma(data)?;
Ok(Self {
uid,
latitude,
longitude,
speed,
course,
r#type,
name,
hae,
api_address,
api_auth_token,
})
}
}

View File

@@ -12,12 +12,4 @@ mod request {
pub fn post(data: String) -> &'static str {
return "not implemented yet";
}
pub fn get(data: String) -> &'static str {
return "not implemented yet";
}
pub fn delete(data: String) -> &'static str {
return "not implemented yet";
}
}