wip: working on task manager

This commit is contained in:
Wyatt J. Miller 2024-09-21 23:57:37 -04:00
parent 13a40353e5
commit 0d0cf63c62
5 changed files with 1850 additions and 1 deletions

1782
backend/task/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -6,3 +6,8 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
tokio = { version = "1.19.2", features = ["full"] }
job_scheduler = "1.2.1"
sqlx = { version = "0.8.2", features = ["postgres", "chrono"] }
chrono = "0.4.38"
once_cell = "1.19.0"

View File

@ -1,3 +1,62 @@
fn main() { use chrono::prelude::*;
use once_cell::sync::{Lazy, OnceCell};
use sqlx::{database, PgPool};
use std::env;
mod tasks;
pub struct TaskServer {
jobs: Vec<Job>,
last_activated: Option<chrono::DateTime<Utc>>,
last_job: Option<Job>,
}
pub struct TaskLog {
task_log_id: u8,
task_id: u8,
created_at: chrono::DateTime<Utc>,
task_status: TaskStatus,
}
enum TaskStatus {
Pending,
Completed,
Failed,
}
pub struct Job {
pub task_id: u8,
pub task_name: u8,
pub schedule: String,
pub created_at: String,
pub deleted_at: Option<String>,
}
pub static G_DB: Lazy<DatabaseConfig> = Lazy::new(|| DatabaseConfig {
pool: None,
database_type: Some("postgres".to_string()),
});
pub struct DatabaseConfig {
pool: Option<PgPool>,
pub database_type: Option<String>,
}
#[tokio::main]
async fn main() {
println!("Hello, world!"); println!("Hello, world!");
} }
impl TaskServer {
fn new() -> Self {
TaskServer {
jobs: Vec::new(),
last_activated: None,
last_job: None,
}
}
fn register_jobs() -> Vec<Job> {
Vec::new()
}
}

View File

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

View File

@ -0,0 +1,2 @@
pub struct Register;
impl Register {}