Moved battery, os docking into a new "v1" module

Added all_info to a module in v1
This commit is contained in:
Jordon Brooks 2023-06-25 11:53:22 +01:00
parent 8169dfd022
commit 1e5bda520a
16 changed files with 18 additions and 16 deletions

View file

@ -1,9 +1,8 @@
use actix_web::web; use actix_web::web;
use actix_web::{HttpResponse, get}; use actix_web::{HttpResponse, get};
use crate::docking; use crate::v1::{docking, os, all_info, battery};
use crate::version; use crate::version;
use crate::battery;
#[get("/are_you_there")] #[get("/are_you_there")]
pub async fn index() -> HttpResponse { pub async fn index() -> HttpResponse {
@ -12,7 +11,7 @@ pub async fn index() -> HttpResponse {
#[get("/all_info")] #[get("/all_info")]
pub async fn get_all_info() -> HttpResponse { pub async fn get_all_info() -> HttpResponse {
match crate::api::all_info::get_all_info() { match all_info::stats::get_all_info() {
Ok(info) => { Ok(info) => {
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
@ -48,7 +47,7 @@ pub async fn get_dock_info() -> HttpResponse {
#[get("/os_info")] #[get("/os_info")]
pub async fn get_os_info() -> HttpResponse { pub async fn get_os_info() -> HttpResponse {
match crate::os::stats::get_os() { match os::stats::get_os() {
Ok(info) => { Ok(info) => {
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
{ {

View file

@ -1,4 +1,2 @@
pub mod server; pub mod server;
mod endpoints_v1; mod endpoints_v1;
mod structs;
mod all_info;

View file

@ -1,6 +1,4 @@
mod battery; mod v1;
mod docking;
mod os;
mod version; mod version;
use version::info::Version; use version::info::Version;

View file

@ -1,6 +1,6 @@
use crate::docking; use crate::v1::docking;
use crate::battery; use crate::v1::battery;
use crate::os; use crate::v1::os;
use crate::version; use crate::version;
use super::structs::Allinfo; use super::structs::Allinfo;

View file

@ -1,5 +1,6 @@
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::{os, battery, docking::{self, structs::DockInfo}, version}; use crate::{v1::{os, battery, docking::{self, structs::DockInfo}}, version};
#[derive(Deserialize, Serialize, Clone)] #[derive(Deserialize, Serialize, Clone)]
pub struct Allinfo { pub struct Allinfo {

View file

@ -1,4 +1,4 @@
use crate::battery::structs::ChargingStatus; use crate::v1::battery::structs::ChargingStatus;
use super::structs::BatteryInfo; use super::structs::BatteryInfo;

View file

@ -3,7 +3,7 @@ use std::{io::BufReader, fs::File};
#[allow(unused_imports)] #[allow(unused_imports)]
use std::collections::hash_set; use std::collections::hash_set;
use crate::{battery::{stats::get_battery_info, structs::ChargingStatus}, USE_FALLBACK_DOCK_DETECTION}; use crate::{v1::{battery::{stats::get_battery_info, structs::ChargingStatus}}, USE_FALLBACK_DOCK_DETECTION};
use super::structs::{Dock, DockInfo}; use super::structs::{Dock, DockInfo};

4
src/v1/mod.rs Normal file
View file

@ -0,0 +1,4 @@
pub mod battery;
pub mod docking;
pub mod os;
pub mod all_info;

2
src/v1/os/mod.rs Normal file
View file

@ -0,0 +1,2 @@
pub mod stats;
pub mod structs;