started implementation on post_secret

This commit is contained in:
someone 2024-05-30 15:26:12 +02:00
parent 40b7e74088
commit 363cd11aa5
3 changed files with 33 additions and 32 deletions

1
Cargo.lock generated
View file

@ -1304,6 +1304,7 @@ dependencies = [
"env_logger", "env_logger",
"log", "log",
"serde", "serde",
"serde_json",
"sqlx", "sqlx",
"tokio", "tokio",
"tower", "tower",

View file

@ -12,7 +12,7 @@ tokio = { version = "1.37.0", features = ["full"] }
tower = { version = "0.4.13", features = [] } tower = { version = "0.4.13", features = [] }
axum = "0.7.5" axum = "0.7.5"
serde = "1.0.201" serde = "1.0.201"
# serde_json = "1.0.117" serde_json = "1.0.117"
# json-patch = "2.0.0" # json-patch = "2.0.0"
# serde_with = "3.8.1" # serde_with = "3.8.1"

View file

@ -9,7 +9,7 @@ pub mod db_structs;
// mod tests; // mod tests;
use std::{collections::HashMap, convert::Infallible}; use std::{collections::HashMap, convert::Infallible};
use serde_json;
use crate::{ use crate::{
engines::kv::http_structs::*, engines::kv::http_structs::*,
storage::DatabaseDriver, storage::DatabaseDriver,
@ -100,38 +100,38 @@ async fn post_data(
// Insert Metadata first -> Else: Error because of foreign key constraint // Insert Metadata first -> Else: Error because of foreign key constraint
// log::debug!( log::debug!(
// "Secret: {}, Content: {:?}, Version: {:?}, path: {}", "Secret: {}, Content: {:?}, Version: {:?}, path: {}",
// path, path,
// payload.data, payload.data,
// payload.options, payload.options,
// path path
// ); );
// let data = payload.data.get("data"); let data = serde_json::to_string(&payload.data).unwrap();
// log::debug!("{:?}", data); log::debug!("Received data: {:?}", data);
// let created_time = Utc::now(); let created_time = Utc::now().to_string();
// let deletion_time = "05-03-2024 12:00:00"; // TODO: let deletion_time = "12-12-2024 12:00:00"; // TODO:
// let version = "0"; let version = "1";
// match sqlx::query!( match sqlx::query(
// "INSERT INTO secret_versions VALUES ($1, $2, $3, $4, $5)", "INSERT INTO secret_versions VALUES ($1, $2, $3, $4, $5)",
// data, )
// created_time, .bind(data)
// deletion_time, .bind(created_time)
// version, .bind (deletion_time)
// path .bind(version)
// ) .bind(path)
// .execute(&pool) .execute(&pool)
// .await .await
// { {
// Ok(v) => { Ok(v) => {
// info!("{:?}", v); info!("{:?}", v);
// } }
// Err(e) => { Err(e) => {
// error!("{:?}", e); error!("{:?}", e);
// } }
// } }
todo!("not implemented") todo!("not implemented")
} }