init serv file

This commit is contained in:
2025-08-13 22:07:41 +08:00
parent 3747a2c65e
commit e0492e1d74
33 changed files with 4108 additions and 168 deletions

View File

@@ -0,0 +1,11 @@
pub struct Location {
latitude: f64,
longitude: f64,
altitude: f64,
accuracy: f64,
vertical_accuracy: f64,
bearing: f64,
speed: f64,
elapsedMs: i64,
provider: String,
}

View File

@@ -0,0 +1 @@
pub mod location;

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1 @@
pub mod location;

View File

@@ -0,0 +1,4 @@
mod test;
#[tokio::main]
async fn main() {}

View File

@@ -0,0 +1,9 @@
use gotify_ws::utils::logger;
use log::info;
use std::env;
#[test]
fn test_base_api_env() {
logger::init_logger();
info!(r"current dir is {:?}", env::vars())
}

View File

@@ -0,0 +1,2 @@
#[cfg(test)]
mod base_api;

View File

@@ -0,0 +1,14 @@
use actix_web::web;
use actix_web::web::Data;
use r2d2::{Pool, State};
use r2d2_sqlite::SqliteConnectionManager;
pub struct SqliteState {
pool: Pool<SqliteConnectionManager>,
}
pub fn init_database() -> Data<SqliteState> {
let db = SqliteConnectionManager::file("./database.mod");
let pool = Pool::new(db).unwrap();
Data::new(SqliteState { pool: pool.clone() })
}

View File

@@ -0,0 +1,2 @@
pub mod database;
pub mod router;

View File

@@ -0,0 +1,7 @@
use actix_web::web;
use crate::handler::location;
pub fn location(cfg: &mut web::ServiceConfig) {
cfg.service(web::scope("/location").service(location::location));
}