This commit is contained in:
@@ -40,6 +40,7 @@ impl Database {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
pub async fn init_from_pool(pool: Pool<Postgres>) -> Database {
|
pub async fn init_from_pool(pool: Pool<Postgres>) -> Database {
|
||||||
Database { conn_pool: pool }
|
Database { conn_pool: pool }
|
||||||
}
|
}
|
||||||
@@ -197,7 +198,6 @@ impl Database {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use dotenvy::dotenv;
|
|
||||||
use sqlx::PgPool;
|
use sqlx::PgPool;
|
||||||
|
|
||||||
#[sqlx::test]
|
#[sqlx::test]
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
use std::{env, fs, path::PathBuf, process, str::FromStr};
|
use std::{env, fs, path::PathBuf, process};
|
||||||
|
|
||||||
use crate::schemas::{TelemetryMessageFromDevice, ValueMessageFromDevice};
|
use crate::schemas::{TelemetryMessageFromDevice, ValueMessageFromDevice};
|
||||||
use actix_web::{get, post, put, web, App, HttpResponse, HttpServer, Responder};
|
use actix_web::{get, post, put, web, App, HttpResponse, HttpServer, Responder};
|
||||||
use database::Database;
|
use database::Database;
|
||||||
use dotenvy::dotenv;
|
use dotenvy::dotenv;
|
||||||
use log::{debug, error, info, warn};
|
use log::{debug, error, info, warn};
|
||||||
use schemas::{BoardConfig, BoardType, Device, OTAConfiguration, OTAConfigurationList};
|
use schemas::OTAConfigurationList;
|
||||||
use sqlx::types::mac_address::MacAddress;
|
use sqlx::types::mac_address::MacAddress;
|
||||||
use util::{get_files, parse_mac_address};
|
use util::{get_files, parse_mac_address};
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@ async fn serve_firmware(path: web::Path<(String, String, String)>, data: web::Da
|
|||||||
.content_type("application/octet-stream")
|
.content_type("application/octet-stream")
|
||||||
.insert_header((
|
.insert_header((
|
||||||
"Content-Disposition",
|
"Content-Disposition",
|
||||||
format!("attachment; filename=\"{}\"", format!("{product}_{config}_{version}.bin")),
|
format!("attachment; filename=\"{product}_{config}_{version}.bin\""),
|
||||||
))
|
))
|
||||||
.body(std::fs::read(file_path).unwrap_or_else(|_| Vec::new()))
|
.body(std::fs::read(file_path).unwrap_or_else(|_| Vec::new()))
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
use std::path::PathBuf;
|
|
||||||
|
|
||||||
use chrono::NaiveDateTime;
|
use chrono::NaiveDateTime;
|
||||||
use serde::{ser::SerializeStruct, Deserialize, Serialize};
|
use serde::{ser::SerializeStruct, Deserialize, Serialize};
|
||||||
use sqlx::types::mac_address::MacAddress;
|
use sqlx::types::mac_address::MacAddress;
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
use std::{fs, path::PathBuf};
|
use std::{fs, path::PathBuf};
|
||||||
|
|
||||||
use log::info;
|
use log::info;
|
||||||
use strum::EnumString;
|
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use serde;
|
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user