Skip to content

Commit

Permalink
Migrate stubbed file methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
emmiegit committed Oct 15, 2023
1 parent e72c379 commit 7762f2f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
14 changes: 5 additions & 9 deletions deepwell/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,12 @@ async fn build_module(app_state: ServerState) -> anyhow::Result<RpcModule<Server
register!("parent_relationships_get", parent_relationships_get);

// Files
register!("file_create", not_implemented);
register!("file_upload", file_upload);
register!("file_get", not_implemented);
register!("file_edit", not_implemented);
register!("file_delete", not_implemented);
register!("file_move", not_implemented);
register!("file_restore", not_implemented);
register!("file_edit", file_edit);
register!("file_delete", file_delete);
register!("file_move", file_move);
register!("file_restore", file_restore);

// File revisions
register!("file_revision_create", not_implemented);
Expand Down Expand Up @@ -321,11 +321,7 @@ pub fn tide_build_server(state: ServerState) -> tide::Server<ServerState> {

fn tide_build_routes(mut app: tide::Server<ServerState>) -> tide::Server<ServerState> {
// Files
app.at("/file").post(file_edit).delete(file_delete);
app.at("/file/get").put(file_retrieve);
app.at("/file/upload").post(file_create);
app.at("/file/move").post(file_move);
app.at("/file/restore").post(file_restore);

// File revisions
app.at("/file/revision").put(file_revision_put);
Expand Down
25 changes: 20 additions & 5 deletions deepwell/src/endpoints/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,38 @@ pub async fn file_retrieve(mut req: ApiRequest) -> ApiResponse {
Ok(response)
}

pub async fn file_create(_req: ApiRequest) -> ApiResponse {
pub async fn file_upload(
_ctx: &ServiceContext<'_>,
_params: Params<'static>,
) -> Result<()> {
todo!()
}

pub async fn file_edit(_req: ApiRequest) -> ApiResponse {
pub async fn file_edit(
_ctx: &ServiceContext<'_>,
_params: Params<'static>,
) -> Result<()> {
todo!()
}

pub async fn file_delete(_req: ApiRequest) -> ApiResponse {
pub async fn file_delete(
_ctx: &ServiceContext<'_>,
_params: Params<'static>,
) -> Result<()> {
todo!()
}

pub async fn file_move(_req: ApiRequest) -> ApiResponse {
pub async fn file_move(
_ctx: &ServiceContext<'_>,
_params: Params<'static>,
) -> Result<()> {
todo!()
}

pub async fn file_restore(_req: ApiRequest) -> ApiResponse {
pub async fn file_restore(
_ctx: &ServiceContext<'_>,
_params: Params<'static>,
) -> Result<()> {
todo!()
}

Expand Down

0 comments on commit 7762f2f

Please sign in to comment.