wip: working on task manager
This commit is contained in:
@ -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!");
|
||||
}
|
||||
|
||||
impl TaskServer {
|
||||
fn new() -> Self {
|
||||
TaskServer {
|
||||
jobs: Vec::new(),
|
||||
last_activated: None,
|
||||
last_job: None,
|
||||
}
|
||||
}
|
||||
|
||||
fn register_jobs() -> Vec<Job> {
|
||||
Vec::new()
|
||||
}
|
||||
}
|
||||
|
1
backend/task/src/tasks/mod.rs
Normal file
1
backend/task/src/tasks/mod.rs
Normal file
@ -0,0 +1 @@
|
||||
pub mod register;
|
2
backend/task/src/tasks/register.rs
Normal file
2
backend/task/src/tasks/register.rs
Normal file
@ -0,0 +1,2 @@
|
||||
pub struct Register;
|
||||
impl Register {}
|
Reference in New Issue
Block a user