//! `Command::ServiceGet`: um serviço pelo id.
use crate::api::AppState;
use shared::Response as RpResponse;
pub async fn handle(state: AppState, id: String) -> RpResponse {
match crate::db::services::get(&state.db, &id).await {
Ok(Some(s)) => RpResponse::Service(s),
Ok(None) => RpResponse::err("NotFound", "service not found"),
Err(e) => RpResponse::err("DatabaseError", e.to_string()),
}
}