Skip to content

Commit

Permalink
remove fo file and folder reference filed
Browse files Browse the repository at this point in the history
  • Loading branch information
jiahao6635 committed Jan 21, 2024
1 parent 4e37bf8 commit 566d7fc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 45 deletions.
5 changes: 1 addition & 4 deletions src/handlers/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ use crate::services::FileService;
),
tag = "Files"
)]
pub async fn get(
State(ctx): State<Arc<Context>>,
Path((id, path)): Path<(Uuid, String)>,
) -> Result<impl IntoResponse> {
pub async fn get(State(ctx): State<Arc<Context>>, Path((id, path)): Path<(Uuid, String)>) -> Result<impl IntoResponse> {
Ok(Json(FileService::get(ctx, id, path).await?))
}

Expand Down
28 changes: 4 additions & 24 deletions src/services/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,7 @@ impl FileService {
}

/// Create a file to the workspace.
pub async fn create(
ctx: Arc<Context>,
id: Uuid,
path: String,
content: String,
) -> Result<Content> {
pub async fn create(ctx: Arc<Context>, id: Uuid, path: String, content: String) -> Result<Content> {
let data = content.into_bytes();
let req = Synchronization {
kind: EventKinds::Create,
Expand All @@ -60,12 +55,7 @@ impl FileService {
}

/// Update a file to the workspace.
pub async fn update(
_ctx: Arc<Context>,
_id: Uuid,
_path: String,
_content: String,
) -> Result<Content> {
pub async fn update(_ctx: Arc<Context>, _id: Uuid, _path: String, _content: String) -> Result<Content> {
// refer to create() method.
todo!()
}
Expand All @@ -77,23 +67,13 @@ impl FileService {
}

/// Copy a file to the destination path on the workspace.
pub async fn copy(
_ctx: Arc<Context>,
_id: Uuid,
_path: String,
_destination: String,
) -> Result<Content> {
pub async fn copy(_ctx: Arc<Context>, _id: Uuid, _path: String, _destination: String) -> Result<Content> {
// refer to create() method.
todo!()
}

/// Move a file to the destination path on the workspace.
pub async fn rename(
_ctx: Arc<Context>,
_id: Uuid,
_path: String,
_destination: String,
) -> Result<Content> {
pub async fn rename(_ctx: Arc<Context>, _id: Uuid, _path: String, _destination: String) -> Result<Content> {
// refer to create() method.
todo!()
}
Expand Down
20 changes: 3 additions & 17 deletions src/services/folder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ use crate::utils;
pub struct FolderService;

impl FolderService {
pub async fn get(
ctx: Arc<Context>,
id: Uuid,
path: Option<String>,
) -> Result<Vec<File>, ApiError> {
pub async fn get(ctx: Arc<Context>, id: Uuid, path: Option<String>) -> Result<Vec<File>, ApiError> {
let playbook = ctx.client.playbooks().get(&id.to_string()).map_err(ApiError::NotFoundPlaybook)?;
let source = playbook.preface.repository.unwrap();

Expand Down Expand Up @@ -62,21 +58,11 @@ impl FolderService {
todo!()
}

pub async fn copy(
_ctx: Arc<Context>,
_id: Uuid,
_path: String,
_destination: String,
) -> Result<Content> {
pub async fn copy(_ctx: Arc<Context>, _id: Uuid, _path: String, _destination: String) -> Result<Content> {
todo!()
}

pub async fn rename(
_ctx: Arc<Context>,
_id: Uuid,
_path: String,
_destination: String,
) -> Result<Content> {
pub async fn rename(_ctx: Arc<Context>, _id: Uuid, _path: String, _destination: String) -> Result<Content> {
todo!()
}
}

0 comments on commit 566d7fc

Please sign in to comment.