use crate::{
    CmdResult, CmdState,
    service::table::{AreaWithTable, Table},
};

#[tauri::command]
pub async fn get_table_area(app_state: CmdState<'_>) -> CmdResult<Vec<AreaWithTable>> {
    let table_service = Table::new(app_state.conn.clone());
    let area_table = table_service.get_table_area().await;
    match area_table {
        Ok(areas) => Ok(areas),
        Err(e) => Err(format!("获取区域错误{:?}", e)),
    }
}
