taud: Convert common structs to a library.

This commit is contained in:
parazyd
2023-08-21 13:40:00 +02:00
parent 2eea9daffd
commit 717669bde7
5 changed files with 52 additions and 23 deletions

View File

@@ -8,6 +8,14 @@ license = "AGPL-3.0-only"
homepage = "https://dark.fi"
repository = "https://github.com/darkrenaissance/darkfi"
[lib]
name = "taud"
path = "src/lib.rs"
[[bin]]
name = "taud"
path = "src/main.rs"
[dependencies]
darkfi = { path = "../../../", features = ["event-graph", "rpc", "bs58"]}
darkfi-serial = { path = "../../../src/serial" }

View File

@@ -34,7 +34,7 @@ use darkfi::{
Error,
};
use crate::{
use taud::{
error::{to_json_result, TaudError, TaudResult},
month_tasks::MonthTasks,
task_info::{Comment, TaskInfo},

22
bin/tau/taud/src/lib.rs Normal file
View File

@@ -0,0 +1,22 @@
/* This file is part of DarkFi (https://dark.fi)
*
* Copyright (C) 2020-2023 Dyne.org foundation
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
pub mod error;
pub mod month_tasks;
pub mod task_info;
pub mod util;

View File

@@ -56,21 +56,20 @@ use darkfi::{
Error, Result,
};
mod error;
mod jsonrpc;
mod month_tasks;
mod settings;
mod task_info;
mod util;
use crate::{
use taud::{
error::{TaudError, TaudResult},
jsonrpc::JsonRpcInterface,
settings::{Args, CONFIG_FILE, CONFIG_FILE_CONTENTS},
task_info::{TaskEvent, TaskInfo},
util::pipe_write,
};
use crate::{
jsonrpc::JsonRpcInterface,
settings::{Args, CONFIG_FILE, CONFIG_FILE_CONTENTS},
};
fn get_workspaces(settings: &Args) -> Result<HashMap<String, ChaChaBox>> {
let mut workspaces = HashMap::new();

View File

@@ -191,21 +191,21 @@ impl Comment {
#[derive(Clone, Debug, SerialEncodable, SerialDecodable, PartialEq)]
pub struct TaskInfo {
pub(crate) ref_id: String,
pub(crate) workspace: String,
pub(crate) id: u32,
pub(crate) title: String,
tags: Vec<String>,
desc: String,
pub(crate) owner: String,
assign: Vec<String>,
project: Vec<String>,
due: Option<Timestamp>,
rank: Option<f32>,
created_at: Timestamp,
state: String,
pub(crate) events: Vec<TaskEvent>,
comments: Vec<Comment>,
pub ref_id: String,
pub workspace: String,
pub id: u32,
pub title: String,
pub tags: Vec<String>,
pub desc: String,
pub owner: String,
pub assign: Vec<String>,
pub project: Vec<String>,
pub due: Option<Timestamp>,
pub rank: Option<f32>,
pub created_at: Timestamp,
pub state: String,
pub events: Vec<TaskEvent>,
pub comments: Vec<Comment>,
}
impl From<&TaskInfo> for JsonValue {