Авторизация через токен вк

Слияние schedule_parser с проектом

Перенос схемы запросов/ответов в файлы эндпоинтов

Переход с библиотеки jwt на jsonwebtokens
This commit is contained in:
2025-03-25 02:05:27 +04:00
parent 0316f58592
commit ab1cbd795e
22 changed files with 794 additions and 369 deletions

View File

@@ -1,9 +1,10 @@
#[cfg(test)]
pub(crate) mod tests {
use crate::app_state::{AppState, app_state};
use crate::app_state::{app_state, AppState, Schedule};
use actix_web::dev::{HttpServiceFactory, Service, ServiceResponse};
use actix_web::{App, test, web};
use actix_web::{test, web, App};
use std::sync::LazyLock;
use crate::parser::tests::test_result;
pub fn test_env() {
dotenvy::from_path(".env.test").expect("Failed to load test environment file");
@@ -19,8 +20,22 @@ pub(crate) mod tests {
test::init_service(App::new().app_data(app_state).service(factory)).await
}
pub fn test_app_state() -> web::Data<AppState> {
let state = app_state();
let mut schedule_lock = state.schedule.lock().unwrap();
*schedule_lock = Some(Schedule {
etag: "".to_string(),
updated_at: Default::default(),
parsed_at: Default::default(),
data: test_result(),
});
state.clone()
}
pub fn static_app_state() -> web::Data<AppState> {
static STATE: LazyLock<web::Data<AppState>> = LazyLock::new(|| app_state());
static STATE: LazyLock<web::Data<AppState>> = LazyLock::new(|| test_app_state());
STATE.clone()
}