mirror of
https://github.com/xqtc161/meowlog.git
synced 2024-12-04 15:43:55 +01:00
Server crate; Some refactoring; README
This commit is contained in:
parent
ab8ac79434
commit
315cf805bd
24
Cargo.toml
24
Cargo.toml
|
@ -1,21 +1,3 @@
|
||||||
[package]
|
[workspace]
|
||||||
name = "meowlog"
|
resolver = "2"
|
||||||
version = "0.1.0"
|
members = ["client", "server"]
|
||||||
edition = "2021"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
bincode = "1.3.3"
|
|
||||||
chrono = { version = "0.4.38", features = ["serde"] }
|
|
||||||
clap = { version = "4.5.20", features = ["derive"] }
|
|
||||||
color-eyre = "0.6.3"
|
|
||||||
inquire = "0.7.5"
|
|
||||||
lazy_static = "1.5.0"
|
|
||||||
serde = { version = "1.0.210", features = ["derive"] }
|
|
||||||
serde_json = "1.0.128"
|
|
||||||
strum = { version = "0.26.3", features = ["derive"] }
|
|
||||||
strum_macros = "0.26.4"
|
|
||||||
toml = "0.8.19"
|
|
||||||
uuid = { version = "1.10.0", features = ["serde", "v4"] }
|
|
||||||
|
|
||||||
[build-dependencies]
|
|
||||||
clap_complete = "4.5.33"
|
|
||||||
|
|
30
README.md
30
README.md
|
@ -1,7 +1,35 @@
|
||||||
|
![img.png](assets/img.png)
|
||||||
|
|
||||||
# meowlog
|
# meowlog
|
||||||
---
|
---
|
||||||
## WIP NOT WORKING AND SUBJECT TO CHANGE
|
|
||||||
|
## WIP SUBJECT TO CHANGE
|
||||||
|
|
||||||
|
### ⚠️ IMPORTANT
|
||||||
|
|
||||||
|
The client's core functionality (managing substances and ingestions) works. The codebase is a mess and will be heavily
|
||||||
|
refactired so use at your own risk. There will be no backwards compatibility until the first stable release.
|
||||||
|
|
||||||
|
Planned features:
|
||||||
|
|
||||||
|
- [x] Managing ingestions and substances
|
||||||
|
- [ ] Having a sensible set of default substances (taken from tripsit or psychonautwiki idk yet)
|
||||||
|
- [ ] Circular Concurrency Checking for binary files
|
||||||
|
- [ ] Server with syncing capabilities and maybe also a frontend with a similar featureset like the Psychonaut Wiki
|
||||||
|
Journal app
|
||||||
|
- [ ] Referring to harm reduction resources in the CLI
|
||||||
|
|
||||||
|
Current problems:
|
||||||
|
|
||||||
|
- [ ] Codebase is a mess
|
||||||
|
- [ ] No tests
|
||||||
|
- [ ] Poor error handling
|
||||||
|
- [ ] Unoptimized memory usage
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
### Client usage:
|
||||||
|
|
||||||
```
|
```
|
||||||
Commands:
|
Commands:
|
||||||
add-ingestion Adds ingestion
|
add-ingestion Adds ingestion
|
||||||
|
|
BIN
assets/img.png
Normal file
BIN
assets/img.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
85
Cargo.lock → client/Cargo.lock
generated
85
Cargo.lock → client/Cargo.lock
generated
|
@ -17,6 +17,37 @@ version = "1.0.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "aes"
|
||||||
|
version = "0.6.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561"
|
||||||
|
dependencies = [
|
||||||
|
"aes-soft",
|
||||||
|
"aesni",
|
||||||
|
"cipher",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "aes-soft"
|
||||||
|
version = "0.6.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072"
|
||||||
|
dependencies = [
|
||||||
|
"cipher",
|
||||||
|
"opaque-debug",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "aesni"
|
||||||
|
version = "0.10.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce"
|
||||||
|
dependencies = [
|
||||||
|
"cipher",
|
||||||
|
"opaque-debug",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "android-tzdata"
|
name = "android-tzdata"
|
||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
|
@ -165,6 +196,15 @@ dependencies = [
|
||||||
"windows-targets 0.52.6",
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cipher"
|
||||||
|
version = "0.2.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801"
|
||||||
|
dependencies = [
|
||||||
|
"generic-array",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "4.5.20"
|
version = "4.5.20"
|
||||||
|
@ -253,6 +293,21 @@ version = "0.8.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
|
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crc"
|
||||||
|
version = "3.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636"
|
||||||
|
dependencies = [
|
||||||
|
"crc-catalog",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crc-catalog"
|
||||||
|
version = "2.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossterm"
|
name = "crossterm"
|
||||||
version = "0.25.0"
|
version = "0.25.0"
|
||||||
|
@ -318,6 +373,16 @@ dependencies = [
|
||||||
"byteorder",
|
"byteorder",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "generic-array"
|
||||||
|
version = "0.14.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
|
||||||
|
dependencies = [
|
||||||
|
"typenum",
|
||||||
|
"version_check",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "getrandom"
|
name = "getrandom"
|
||||||
version = "0.2.15"
|
version = "0.2.15"
|
||||||
|
@ -462,11 +527,13 @@ checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
||||||
name = "meowlog"
|
name = "meowlog"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"aes",
|
||||||
"bincode",
|
"bincode",
|
||||||
"chrono",
|
"chrono",
|
||||||
"clap",
|
"clap",
|
||||||
"clap_complete",
|
"clap_complete",
|
||||||
"color-eyre",
|
"color-eyre",
|
||||||
|
"crc",
|
||||||
"inquire",
|
"inquire",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"serde",
|
"serde",
|
||||||
|
@ -531,6 +598,12 @@ version = "1.20.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
|
checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "opaque-debug"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "owo-colors"
|
name = "owo-colors"
|
||||||
version = "3.5.0"
|
version = "3.5.0"
|
||||||
|
@ -833,6 +906,12 @@ dependencies = [
|
||||||
"tracing-core",
|
"tracing-core",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "typenum"
|
||||||
|
version = "1.17.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-ident"
|
name = "unicode-ident"
|
||||||
version = "1.0.13"
|
version = "1.0.13"
|
||||||
|
@ -873,6 +952,12 @@ version = "0.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
|
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "version_check"
|
||||||
|
version = "0.9.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasi"
|
name = "wasi"
|
||||||
version = "0.11.0+wasi-snapshot-preview1"
|
version = "0.11.0+wasi-snapshot-preview1"
|
23
client/Cargo.toml
Normal file
23
client/Cargo.toml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
[package]
|
||||||
|
name = "meowlog"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
bincode = "1.3.3"
|
||||||
|
aes = "0.6.0"
|
||||||
|
crc = "3.2.1"
|
||||||
|
chrono = { version = "0.4.38", features = ["serde"] }
|
||||||
|
clap = { version = "4.5.20", features = ["derive"] }
|
||||||
|
color-eyre = "0.6.3"
|
||||||
|
inquire = "0.7.5"
|
||||||
|
lazy_static = "1.5.0"
|
||||||
|
serde = { version = "1.0.210", features = ["derive"] }
|
||||||
|
serde_json = "1.0.128"
|
||||||
|
strum = { version = "0.26.3", features = ["derive"] }
|
||||||
|
strum_macros = "0.26.4"
|
||||||
|
toml = "0.8.19"
|
||||||
|
uuid = { version = "1.10.0", features = ["serde", "v4"] }
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
clap_complete = "4.5.33"
|
|
@ -25,7 +25,15 @@ pub struct Ingestion {
|
||||||
|
|
||||||
impl std::fmt::Display for Ingestion {
|
impl std::fmt::Display for Ingestion {
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||||
write!(f, "{} {} {} {}{}", self.date, self.time.format("%H:%M"), self.substance.name, self.dose.value, self.dose.unit)
|
write!(
|
||||||
|
f,
|
||||||
|
"{} {} {} {}{}",
|
||||||
|
self.date,
|
||||||
|
self.time.format("%H:%M"),
|
||||||
|
self.substance.name,
|
||||||
|
self.dose.value,
|
||||||
|
self.dose.unit
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +121,6 @@ pub fn list_ingestions() -> Result<(), std::io::Error> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub fn edit_ingestion() -> Result<(), std::io::Error> {
|
pub fn edit_ingestion() -> Result<(), std::io::Error> {
|
||||||
let ing_des = ensure_ingestion_files();
|
let ing_des = ensure_ingestion_files();
|
||||||
if ing_des.is_empty() {
|
if ing_des.is_empty() {
|
||||||
|
@ -124,17 +131,36 @@ pub fn edit_ingestion() -> Result<(), std::io::Error> {
|
||||||
let mut ingest_sel_vec_id: Vec<Uuid> = Vec::new();
|
let mut ingest_sel_vec_id: Vec<Uuid> = Vec::new();
|
||||||
let mut ingest_sel_vec_ing: Vec<Ingestion> = Vec::new();
|
let mut ingest_sel_vec_ing: Vec<Ingestion> = Vec::new();
|
||||||
|
|
||||||
|
|
||||||
for ingestion in ing_des.clone().into_iter() {
|
for ingestion in ing_des.clone().into_iter() {
|
||||||
ingest_sel_vec_id.push(ingestion.0);
|
ingest_sel_vec_id.push(ingestion.0);
|
||||||
ingest_sel_vec_ing.push(ingestion.1);
|
ingest_sel_vec_ing.push(ingestion.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
let ingest_select = inquire::Select::new("Which ingestion do you want to edit?", ingest_sel_vec_ing).prompt().unwrap();
|
let ingest_select =
|
||||||
let ing_id = ing_des.iter()
|
inquire::Select::new("Which ingestion do you want to edit?", ingest_sel_vec_ing)
|
||||||
.map(|(key, &ref val)| if val.substance.name == ingest_select.substance.name && val.substance.substance_class == ingest_select.substance.substance_class && val.date == ingest_select.date && val.time == ingest_select.time { key.clone() } else { unreachable!() }).collect::<Vec<Uuid>>();
|
.prompt()
|
||||||
|
.unwrap();
|
||||||
|
let ing_id = ing_des
|
||||||
|
.iter()
|
||||||
|
.map(|(key, &ref val)| {
|
||||||
|
if val.substance.name == ingest_select.substance.name
|
||||||
|
&& val.substance.substance_class == ingest_select.substance.substance_class
|
||||||
|
&& val.date == ingest_select.date
|
||||||
|
&& val.time == ingest_select.time
|
||||||
|
{
|
||||||
|
key.clone()
|
||||||
|
} else {
|
||||||
|
unreachable!()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collect::<Vec<Uuid>>();
|
||||||
|
|
||||||
let edit_select = inquire::MultiSelect::new("What do you want to edit?", vec!["Substance", "Dose", "Ingestion Method", "Time", "Date"]).prompt().unwrap();
|
let edit_select = inquire::MultiSelect::new(
|
||||||
|
"What do you want to edit?",
|
||||||
|
vec!["Substance", "Dose", "Ingestion Method", "Time", "Date"],
|
||||||
|
)
|
||||||
|
.prompt()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
for edit in edit_select {
|
for edit in edit_select {
|
||||||
match edit {
|
match edit {
|
||||||
|
@ -249,3 +275,4 @@ pub fn create_ingestions_file() -> Result<(), std::io::Error> {
|
||||||
let hash_ser = bincode::serialize(&hash).unwrap();
|
let hash_ser = bincode::serialize(&hash).unwrap();
|
||||||
std::fs::write(INGESTIONS_FILE.to_string(), hash_ser)
|
std::fs::write(INGESTIONS_FILE.to_string(), hash_ser)
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,8 @@ use uuid::Uuid;
|
||||||
pub fn ensure_ingestion_files() -> HashMap<Uuid, Ingestion> {
|
pub fn ensure_ingestion_files() -> HashMap<Uuid, Ingestion> {
|
||||||
let ingesstions_bytes_loaded_des: HashMap<Uuid, Ingestion>;
|
let ingesstions_bytes_loaded_des: HashMap<Uuid, Ingestion>;
|
||||||
if path_exists(INGESTIONS_FILE.to_string()) {
|
if path_exists(INGESTIONS_FILE.to_string()) {
|
||||||
let substances_bytes_loaded = std::fs::read(INGESTIONS_FILE.to_string()).expect("Could not read ingestions file");
|
let substances_bytes_loaded =
|
||||||
|
std::fs::read(INGESTIONS_FILE.to_string()).expect("Could not read ingestions file");
|
||||||
ingesstions_bytes_loaded_des = bincode::deserialize(&substances_bytes_loaded).expect("Could not deserialize ingestions file. If you are tech-savvy try fixing it with a hex editor.");
|
ingesstions_bytes_loaded_des = bincode::deserialize(&substances_bytes_loaded).expect("Could not deserialize ingestions file. If you are tech-savvy try fixing it with a hex editor.");
|
||||||
} else {
|
} else {
|
||||||
std::fs::File::create(INGESTIONS_FILE.to_string()).unwrap();
|
std::fs::File::create(INGESTIONS_FILE.to_string()).unwrap();
|
||||||
|
@ -24,11 +25,9 @@ pub fn ensure_ingestion_files() -> HashMap<Uuid, Ingestion> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_user_date(current: NaiveDateTime) -> chrono::NaiveDate {
|
pub fn get_user_date(current: NaiveDateTime) -> chrono::NaiveDate {
|
||||||
let current_time = current.time();
|
|
||||||
let current_date = current.date();
|
let current_date = current.date();
|
||||||
let date: chrono::NaiveDate = inquire::CustomType::<chrono::NaiveDate>::new(
|
let date: chrono::NaiveDate =
|
||||||
"Enter the date (YYYY-MM-DD):",
|
inquire::CustomType::<chrono::NaiveDate>::new("Enter the date (YYYY-MM-DD):")
|
||||||
)
|
|
||||||
.with_placeholder("YYYY-MM-DD")
|
.with_placeholder("YYYY-MM-DD")
|
||||||
.with_default(current_date)
|
.with_default(current_date)
|
||||||
.with_parser(&|input| {
|
.with_parser(&|input| {
|
||||||
|
@ -43,14 +42,11 @@ pub fn get_user_date(current: NaiveDateTime) -> chrono::NaiveDate {
|
||||||
|
|
||||||
pub fn get_user_time(current: NaiveDateTime) -> chrono::NaiveTime {
|
pub fn get_user_time(current: NaiveDateTime) -> chrono::NaiveTime {
|
||||||
let current_time = current.time();
|
let current_time = current.time();
|
||||||
let time: chrono::NaiveTime = inquire::CustomType::<chrono::NaiveTime>::new(
|
let time: chrono::NaiveTime =
|
||||||
"Enter the time (HH:MM):",
|
inquire::CustomType::<chrono::NaiveTime>::new("Enter the time (HH:MM):")
|
||||||
)
|
|
||||||
.with_placeholder("HH:MM")
|
.with_placeholder("HH:MM")
|
||||||
.with_default(current_time)
|
.with_default(current_time)
|
||||||
.with_parser(&|input| {
|
.with_parser(&|input| chrono::NaiveTime::parse_from_str(input, "%H:%M").map_err(|_| ()))
|
||||||
chrono::NaiveTime::parse_from_str(input, "%H:%M").map_err(|_| ())
|
|
||||||
})
|
|
||||||
.with_error_message("Please enter a valid time in the format HH:MM.")
|
.with_error_message("Please enter a valid time in the format HH:MM.")
|
||||||
.with_help_message("Use the format HH:MM")
|
.with_help_message("Use the format HH:MM")
|
||||||
.prompt()
|
.prompt()
|
||||||
|
@ -81,7 +77,13 @@ pub fn get_substance() -> Substance {
|
||||||
let substance_file: HashMap<Uuid, Substance> = crate::substance_util::ensure_substance_file();
|
let substance_file: HashMap<Uuid, Substance> = crate::substance_util::ensure_substance_file();
|
||||||
let substances: Vec<Substance> = substance_file
|
let substances: Vec<Substance> = substance_file
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter_map(|(_, s)| if s.name == substance_select { Some(s) } else { None })
|
.filter_map(|(_, s)| {
|
||||||
|
if s.name == substance_select {
|
||||||
|
Some(s)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
if substances.len() != 1 {
|
if substances.len() != 1 {
|
|
@ -55,7 +55,7 @@ fn main() {
|
||||||
|
|
||||||
match &cli.command {
|
match &cli.command {
|
||||||
Some(Commands::AddIngestion) => ingestions::add_ingestion(),
|
Some(Commands::AddIngestion) => ingestions::add_ingestion(),
|
||||||
Some(Commands::EditIngestion) => {ingestions::edit_ingestion().unwrap()}
|
Some(Commands::EditIngestion) => ingestions::edit_ingestion().unwrap(),
|
||||||
Some(Commands::ListIngestions) => ingestions::list_ingestions().unwrap(),
|
Some(Commands::ListIngestions) => ingestions::list_ingestions().unwrap(),
|
||||||
Some(Commands::RemoveIngestion) => {}
|
Some(Commands::RemoveIngestion) => {}
|
||||||
Some(Commands::AddSubstance) => substances::add_substance().unwrap(),
|
Some(Commands::AddSubstance) => substances::add_substance().unwrap(),
|
30
meowlog.proto
Normal file
30
meowlog.proto
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
package meowlog;
|
||||||
|
|
||||||
|
service MeowlogSync {
|
||||||
|
rpc GetLogs(GetLogsRequest) returns (GetLogsResponse) {}
|
||||||
|
rpc AddLog(AddLogRequest) returns (AddLogResponse) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetLogsRequest {
|
||||||
|
string query = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetLogsResponse {
|
||||||
|
repeated Log logs = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AddLogRequest {
|
||||||
|
Log log = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AddLogResponse {
|
||||||
|
bool success = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Log {
|
||||||
|
string id = 1;
|
||||||
|
string message = 2;
|
||||||
|
string level = 3;
|
||||||
|
string timestamp = 4;
|
||||||
|
}
|
Loading…
Reference in a new issue