Explorar o código

taud: Convert common structs to a library.

parazyd %!s(int64=3) %!d(string=hai) anos
pai
achega
717669bde7

+ 8 - 0
bin/tau/taud/Cargo.toml

@@ -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" }

+ 1 - 1
bin/tau/taud/src/jsonrpc.rs

@@ -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 - 0
bin/tau/taud/src/lib.rs

@@ -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;

+ 6 - 7
bin/tau/taud/src/main.rs

@@ -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();
 

+ 15 - 15
bin/tau/taud/src/task_info.rs

@@ -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 {