Create a plan for implementing projects and also create the backend API. (#19)
Some checks failed
Check / Backend (push) Successful in 6m55s
Check / Frontend (push) Successful in 2m2s
Docker Build / Build and Push Backend Image (push) Failing after 11m21s
Docker Build / Build and Push Frontend Image (push) Successful in 5m44s

Creates projects to organize tasks under. (Note the migration also contains the tables for creating folders for projects as well because adding foreign keys is a PITA in sqlite apparently).

Reviewed-on: #19
Co-authored-by: Drew Galbraith <drew@tiramisu.one>
Co-committed-by: Drew Galbraith <drew@tiramisu.one>
This commit is contained in:
Drew 2025-10-28 04:13:12 +00:00 committed by Drew
parent 69f4a6f1ca
commit 4552c347c6
17 changed files with 957 additions and 12 deletions

View file

@ -1,9 +1,15 @@
use std::path::Path;
use axum::{Router, routing::get};
use axum_test::{TestServer, TestServerConfig, Transport};
use hurl::report::html::{Testcase, write_report};
use hurl::runner::{self, RunnerOptions, Value, VariableSet};
use hurl::util::logger::LoggerOptionsBuilder;
use hurl_core::input::Input;
use tower_http::trace::TraceLayer;
async fn create_app() -> Router {
tracing_subscriber::fmt::try_init();
use backend::database::{DatabaseConfig, create_pool};
use backend::services;
@ -24,6 +30,8 @@ async fn create_app() -> Router {
Router::new()
.route("/health", get(health))
.nest("/api/tasks", services::create_task_router())
.nest("/api/projects", services::create_project_router())
.layer(TraceLayer::new_for_http())
.with_state(pool)
}
@ -49,11 +57,14 @@ async fn run_hurl_test(hurl_file_path: &str) {
let logger_opts = LoggerOptionsBuilder::new().build();
let result = runner::run(&content, None, &runner_opts, &variables, &logger_opts).unwrap();
assert!(
result.success,
"Hurl test failed for {}: {:?}",
hurl_file_path, result
);
let input = Input::new(hurl_file_path);
let test_case = Testcase::from(&result, &input);
test_case
.write_html(&content, &result.entries, Path::new("reports/store"), &[])
.expect("Failed to write html files");
write_report(Path::new("reports/"), &vec![test_case]).expect("Failed to write report");
assert!(result.success, "Hurl test failed for {}", hurl_file_path);
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
@ -75,3 +86,8 @@ async fn test_update_tasks_api() {
async fn test_delete_tasks_api() {
run_hurl_test("./tests/api/delete_tasks.hurl").await;
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_projects_api() {
run_hurl_test("./tests/api/projects.hurl").await;
}