refactor: single refusal shape with openapi contract test
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
use crate::extractors::Params;
|
||||
use crate::{errors::ApiError, extractors::AuthenticatedUser, state::AppState};
|
||||
use api_types::insights::{InsightDto, InsightsQueryParams, InsightsResponse};
|
||||
use application::insights::get as get_insights_uc;
|
||||
use axum::{
|
||||
Json,
|
||||
extract::{Query, State},
|
||||
};
|
||||
use axum::{Json, extract::State};
|
||||
use domain::{errors::DomainError, models::Insight};
|
||||
|
||||
fn to_dto(insight: Insight) -> InsightDto {
|
||||
@@ -68,15 +66,15 @@ fn to_dto(insight: Insight) -> InsightDto {
|
||||
params(InsightsQueryParams),
|
||||
responses(
|
||||
(status = 200, body = InsightsResponse),
|
||||
(status = 400, description = "Unknown time zone"),
|
||||
(status = 401, description = "Unauthorized"),
|
||||
(status = 400, description = "Unknown time zone", body = api_types::ErrorResponse),
|
||||
(status = 401, description = "Unauthorized", body = api_types::ErrorResponse),
|
||||
),
|
||||
security(("bearer_auth" = []))
|
||||
)]
|
||||
pub async fn get_insights(
|
||||
State(state): State<AppState>,
|
||||
user: AuthenticatedUser,
|
||||
Query(params): Query<InsightsQueryParams>,
|
||||
Params(params): Params<InsightsQueryParams>,
|
||||
) -> Result<Json<InsightsResponse>, ApiError> {
|
||||
let tz: chrono_tz::Tz = match params.tz.as_deref() {
|
||||
None => chrono_tz::UTC,
|
||||
|
||||
Reference in New Issue
Block a user