rustploy 0.1.2

Rustploy PaaS daemon — lightweight self-hosted deployment platform
1
2
3
4
5
6
7
8
9
10
11
12
//! `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()),
    }
}