feat: add repo importing

This commit is contained in:
2026-01-17 19:32:37 -08:00
parent 831259a6a6
commit fb62081ca8
28 changed files with 1823 additions and 116 deletions

View File

@@ -1,4 +1,5 @@
use actix_web::{HttpResponse, ResponseError, http::StatusCode};
use aws_sdk_dynamodb::error::SdkError;
use serde::Serialize;
use thiserror::Error;
@@ -18,6 +19,16 @@ pub enum Error {
Jwx(#[from] jsonwebtoken::errors::Error),
#[error("token expired")]
TokenExpired,
#[error("dynamodb error: {0}")]
DynamoDB(String),
#[error("item already exists")]
AlreadyExists,
}
impl<E: std::fmt::Debug> From<SdkError<E>> for Error {
fn from(err: SdkError<E>) -> Self {
Error::DynamoDB(format!("{:?}", err))
}
}
#[derive(Serialize)]
@@ -33,6 +44,9 @@ impl ResponseError for Error {
Error::TokenExpired => HttpResponse::Unauthorized().json(ErrorResponse {
error: "token expired".to_string(),
}),
Error::AlreadyExists => HttpResponse::BadRequest().json(ErrorResponse {
error: "item already exists".to_string(),
}),
_ => HttpResponse::InternalServerError().finish(),
}
}