summaryrefslogtreecommitdiff
path: root/crates/vcs_data/src/data
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2025-10-30 09:26:33 +0800
committerGitHub <noreply@github.com>2025-10-30 09:26:33 +0800
commit67ddf17efe909128732473b28a100fe2f58fdf46 (patch)
tree97382930372225a0cd2735b957da4770170d477c /crates/vcs_data/src/data
parent4f35da85641549c3e08c4e1b73fccfc7ec9779a2 (diff)
parentd879d8864864d51f48201ea3fcf43baad2f969f6 (diff)
Merge pull request #31 from JustEnoughVCS/jvcs_dev_actions
Jvcs dev actions
Diffstat (limited to 'crates/vcs_data/src/data')
-rw-r--r--crates/vcs_data/src/data/local.rs1
-rw-r--r--crates/vcs_data/src/data/local/latest_info.rs28
-rw-r--r--crates/vcs_data/src/data/sheet.rs18
3 files changed, 45 insertions, 2 deletions
diff --git a/crates/vcs_data/src/data/local.rs b/crates/vcs_data/src/data/local.rs
index fb43042..407b171 100644
--- a/crates/vcs_data/src/data/local.rs
+++ b/crates/vcs_data/src/data/local.rs
@@ -10,6 +10,7 @@ use crate::{
};
pub mod config;
+pub mod latest_info;
pub struct LocalWorkspace {
config: Arc<Mutex<LocalConfig>>,
diff --git a/crates/vcs_data/src/data/local/latest_info.rs b/crates/vcs_data/src/data/local/latest_info.rs
new file mode 100644
index 0000000..5a76277
--- /dev/null
+++ b/crates/vcs_data/src/data/local/latest_info.rs
@@ -0,0 +1,28 @@
+use cfg_file::ConfigFile;
+use serde::{Deserialize, Serialize};
+
+use crate::{
+ constants::CLIENT_FILE_LATEST_INFO,
+ data::{
+ member::Member,
+ sheet::{SheetData, SheetName},
+ },
+};
+
+#[derive(Default, Serialize, Deserialize, ConfigFile)]
+#[cfg_file(path = CLIENT_FILE_LATEST_INFO)]
+pub struct LatestInfo {
+ // Sheets
+ /// My sheets, indicating which sheets I can edit
+ pub my_sheets: Vec<SheetName>,
+ /// Other sheets, indicating which sheets I can export files to (these sheets are not readable to me)
+ pub other_sheets: Vec<SheetName>,
+ /// Reference sheet data, indicating what files I can get from the reference sheet
+ pub ref_sheet_content: SheetData,
+
+ // Members
+ /// All member information of the vault, allowing me to contact them more conveniently
+ pub vault_members: Vec<Member>,
+}
+
+impl LatestInfo {}
diff --git a/crates/vcs_data/src/data/sheet.rs b/crates/vcs_data/src/data/sheet.rs
index f1cf67c..b558c0d 100644
--- a/crates/vcs_data/src/data/sheet.rs
+++ b/crates/vcs_data/src/data/sheet.rs
@@ -35,7 +35,7 @@ impl PartialEq for InputPackage {
}
}
-const SHEET_NAME: &str = "{sheet-name}";
+const SHEET_NAME: &str = "{sheet_name}";
pub struct Sheet<'a> {
/// The name of the current sheet
@@ -48,7 +48,7 @@ pub struct Sheet<'a> {
pub(crate) vault_reference: &'a Vault,
}
-#[derive(Default, Serialize, Deserialize, ConfigFile)]
+#[derive(Default, Serialize, Deserialize, ConfigFile, Clone)]
pub struct SheetData {
/// The holder of the current sheet, who has full operation rights to the sheet mapping
pub(crate) holder: MemberId,
@@ -61,6 +61,10 @@ pub struct SheetData {
}
impl<'a> Sheet<'a> {
+ pub fn name(&self) -> &SheetName {
+ &self.name
+ }
+
/// Get the holder of this sheet
pub fn holder(&self) -> &MemberId {
&self.data.holder
@@ -344,4 +348,14 @@ impl<'a> Sheet<'a> {
common_components.into_iter().collect()
}
+
+ /// Clone the data of the sheet
+ pub fn clone_data(&self) -> SheetData {
+ self.data.clone()
+ }
+
+ /// Convert the sheet into its data representation
+ pub fn to_data(self) -> SheetData {
+ self.data
+ }
}