diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-07-09 22:00:59 +0200 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-07-09 22:00:59 +0200 |
| commit | 620cf8fa33835c1ce1e56b1028ff6e2a6fbe0f39 (patch) | |
| tree | e97e54ff112c8e3fa9f88335bfd1275420a4d69f /crates/server/src/handlers | |
| parent | chore: Separate daemon, client, server, and lib into crates (diff) | |
| download | atuin-620cf8fa33835c1ce1e56b1028ff6e2a6fbe0f39.zip | |
chore: Add more things
Diffstat (limited to '')
| -rw-r--r-- | crates/server/src/handlers/mod.rs | 14 | ||||
| -rw-r--r-- | crates/server/src/handlers/v0/mod.rs | 2 | ||||
| -rw-r--r-- | crates/server/src/handlers/v0/record.rs | 10 |
3 files changed, 13 insertions, 13 deletions
diff --git a/crates/server/src/handlers/mod.rs b/crates/server/src/handlers/mod.rs index c4332f80..e24bad14 100644 --- a/crates/server/src/handlers/mod.rs +++ b/crates/server/src/handlers/mod.rs @@ -1,13 +1,13 @@ -use crate::atuin_common::api::{ErrorResponse, IndexResponse}; +use turtle_common::api::{ErrorResponse, IndexResponse}; use axum::{Json, extract::State, http, response::IntoResponse}; use crate::router::AppState; -pub(crate) mod v0; +pub mod v0; const VERSION: &str = env!("CARGO_PKG_VERSION"); -pub(crate) async fn index(state: State<AppState>) -> Json<IndexResponse> { +pub async fn index(state: State<AppState>) -> Json<IndexResponse> { let homage = r#""Through the fathomless deeps of space swims the star turtle Great A'Tuin, bearing on its back the four giant elephants who carry on their shoulders the mass of the Discworld." -- Sir Terry Pratchett"#; let version = state @@ -28,12 +28,12 @@ impl IntoResponse for ErrorResponseStatus<'_> { } } -pub(crate) struct ErrorResponseStatus<'a> { - pub(crate) error: ErrorResponse<'a>, - pub(crate) status: http::StatusCode, +pub struct ErrorResponseStatus<'a> { + pub error: ErrorResponse<'a>, + pub status: http::StatusCode, } -pub(crate) trait RespExt<'a> { +pub trait RespExt<'a> { fn with_status(self, status: http::StatusCode) -> ErrorResponseStatus<'a>; fn reply(reason: &'a str) -> Self; } diff --git a/crates/server/src/handlers/v0/mod.rs b/crates/server/src/handlers/v0/mod.rs index 78fb47b8..2066636c 100644 --- a/crates/server/src/handlers/v0/mod.rs +++ b/crates/server/src/handlers/v0/mod.rs @@ -1 +1 @@ -pub(crate) mod record; +pub mod record; diff --git a/crates/server/src/handlers/v0/record.rs b/crates/server/src/handlers/v0/record.rs index 0381ded8..f7758c1a 100644 --- a/crates/server/src/handlers/v0/record.rs +++ b/crates/server/src/handlers/v0/record.rs @@ -8,10 +8,10 @@ use crate::{ router::{AppState, UserAuth}, }; -use crate::atuin_common::record::{EncryptedData, HostId, Record, RecordIdx, RecordStatus}; +use turtle_common::record::{EncryptedData, HostId, Record, RecordIdx, RecordStatus}; #[instrument(skip_all, fields(user.id = user.id.to_string()))] -pub(crate) async fn post( +pub async fn post( UserAuth(user): UserAuth, state: State<AppState>, Json(records): Json<Vec<Record<EncryptedData>>>, @@ -50,7 +50,7 @@ pub(crate) async fn post( } #[instrument(skip_all, fields(user.id = user.id.to_string()))] -pub(crate) async fn index( +pub async fn index( UserAuth(user): UserAuth, state: State<AppState>, ) -> Result<Json<RecordStatus>, ErrorResponseStatus<'static>> { @@ -75,7 +75,7 @@ pub(crate) async fn index( } #[derive(Deserialize)] -pub(crate) struct NextParams { +pub struct NextParams { host: HostId, tag: String, start: Option<RecordIdx>, @@ -83,7 +83,7 @@ pub(crate) struct NextParams { } #[instrument(skip_all, fields(user.id = user.id.to_string()))] -pub(crate) async fn next( +pub async fn next( params: Query<NextParams>, UserAuth(user): UserAuth, state: State<AppState>, |
