mirror of
https://github.com/spacedriveapp/spacedrive
synced 2024-07-04 13:23:28 +00:00
Crud for locations.
This commit is contained in:
parent
56fa6def8f
commit
9ce9a0e0aa
|
@ -1,5 +1,5 @@
|
|||
use crate::{
|
||||
file::cas::FileIdentifierJob, library::get_library_path, node::NodeState,
|
||||
file::cas::FileIdentifierJob, library::get_library_path, node::NodeState, prisma::location,
|
||||
util::db::create_connection,
|
||||
};
|
||||
use job::{Job, JobReport, Jobs};
|
||||
|
@ -252,8 +252,26 @@ impl Node {
|
|||
// ctx.queue_job(Box::new(FileIdentifierJob));
|
||||
CoreResponse::LocCreate(loc)
|
||||
}
|
||||
ClientCommand::LocUpdate { id: _, name: _ } => todo!(),
|
||||
ClientCommand::LocDelete { id: _ } => todo!(),
|
||||
ClientCommand::LocUpdate { id, name } => {
|
||||
ctx.database
|
||||
.location()
|
||||
.find_unique(location::id::equals(id))
|
||||
.update(vec![location::name::set(name)])
|
||||
.exec()
|
||||
.await?;
|
||||
|
||||
CoreResponse::Success(())
|
||||
}
|
||||
ClientCommand::LocDelete { id } => {
|
||||
ctx.database
|
||||
.location()
|
||||
.find_unique(location::id::equals(id))
|
||||
.delete()
|
||||
.exec()
|
||||
.await?;
|
||||
|
||||
CoreResponse::Success(())
|
||||
}
|
||||
// CRUD for files
|
||||
ClientCommand::FileRead { id: _ } => todo!(),
|
||||
// ClientCommand::FileEncrypt { id: _, algorithm: _ } => todo!(),
|
||||
|
|
Loading…
Reference in a new issue