-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add delete handler * fix: clippy * fix: prettier * ci: ubuntu * ci: add cache
- Loading branch information
Showing
10 changed files
with
141 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use axum::extract::State; | ||
use uuid::Uuid; | ||
|
||
use crate::domain::models::indexer::{IndexerError, IndexerStatus}; | ||
use crate::infra::repositories::indexer_repository::{IndexerRepository, Repository}; | ||
use crate::utils::PathExtractor; | ||
use crate::AppState; | ||
|
||
pub async fn delete_indexer( | ||
State(state): State<AppState>, | ||
PathExtractor(id): PathExtractor<Uuid>, | ||
) -> Result<(), IndexerError> { | ||
let mut repository = IndexerRepository::new(&state.pool); | ||
let indexer_model = repository.get(id).await.map_err(IndexerError::InfraError)?; | ||
match indexer_model.status { | ||
IndexerStatus::Stopped => (), | ||
_ => return Err(IndexerError::InvalidIndexerStatus(indexer_model.status)), | ||
} | ||
|
||
repository.delete(id).await.map_err(IndexerError::InfraError)?; | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pub mod create_indexer; | ||
pub mod delete_indexer; | ||
pub mod fail_indexer; | ||
pub mod get_indexer; | ||
mod indexer_types; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters