Init project

This commit is contained in:
2025-12-26 11:25:45 +02:00
commit 8f8fc50310
79 changed files with 9970 additions and 0 deletions

69
src-tauri/src/export.rs Normal file
View File

@@ -0,0 +1,69 @@
// here lies the logic for the export of the final schedule into docx/pdf formats
use crate::model::{MonthlySchedule, WeeklySchedule};
#[derive(Debug)]
pub enum FileType {
Json,
Csv,
Doc,
Pdf,
}
pub trait Export {
fn export(&self, file_type: FileType);
}
impl Export for MonthlySchedule {
fn export(&self, file_type: FileType) {
match file_type {
FileType::Csv => self.export_as_csv(),
FileType::Json => self.export_as_json(),
FileType::Doc => self.export_as_doc(),
FileType::Pdf => self.export_as_pdf(),
};
// TODO: make this env var from a config file? Option to change this in-app
let env_path = "rota/me/";
println!(
"exported type {:?}. Saved at folder path {}",
file_type, env_path
);
todo!()
}
}
impl MonthlySchedule {
// return error result as string or nothing, maybe use anyhow
// or just return a string.. for now
pub fn export_as_csv(&self) -> String {
todo!()
}
pub fn export_as_json(&self) -> String {
todo!()
}
pub fn export_as_doc(&self) -> String {
todo!()
}
pub fn export_as_pdf(&self) -> String {
todo!()
}
}
impl Export for WeeklySchedule {
fn export(&self, file_type: FileType) {
todo!()
}
}
#[cfg(test)]
mod tests {
use rstest::rstest;
#[rstest]
pub fn xxxy() {}
}