Location CRUD

This commit is contained in:
xPolar
2022-06-13 22:20:19 -07:00
parent d5abb4a654
commit 2c6f38f33e

View File

@@ -1,6 +1,6 @@
use crate::{
file::cas::FileIdentifierJob, library::get_library_path, node::NodeState,
util::db::create_connection,
prisma::file as prisma_file, util::db::create_connection,
};
use job::{Job, JobReport, Jobs};
use prisma::PrismaClient;
@@ -255,9 +255,18 @@ impl Node {
ClientCommand::LocUpdate { id: _, name: _ } => todo!(),
ClientCommand::LocDelete { id: _ } => todo!(),
// CRUD for files
ClientCommand::FileRead { id: _ } => todo!(),
ClientCommand::FileReadMetaData { id: _ } => todo!(),
// ClientCommand::FileEncrypt { id: _, algorithm: _ } => todo!(),
ClientCommand::FileDelete { id: _ } => todo!(),
ClientCommand::FileDelete { id } => {
ctx.database
.file()
.find_unique(prisma_file::id::equals(id))
.delete()
.exec()
.await?;
CoreResponse::Success(())
}
// CRUD for tags
ClientCommand::TagCreate { name: _, color: _ } => todo!(),
ClientCommand::TagAssign {
@@ -336,7 +345,7 @@ impl Node {
#[ts(export)]
pub enum ClientCommand {
// Files
FileRead { id: i32 },
FileReadMetaData { id: i32 },
// FileEncrypt { id: i32, algorithm: EncryptionAlgorithm },
FileDelete { id: i32 },
// Library