Skip to content

Commit 7709c03

Browse files
committed
Fix directory structure:
- Move code to root directory - Fix module declarations - All tests passing
1 parent e95cf33 commit 7709c03

16 files changed

Lines changed: 40 additions & 12 deletions

File tree

jump/Cargo.toml renamed to Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ serde_json = "1.0"
2121

2222
# Validation
2323
validator = { version = "0.16", features = ["derive"] }
24+
regex = "1.10"
2425

2526
# Logging and tracing
2627
tracing = "0.1"
@@ -35,6 +36,7 @@ anyhow = "1.0"
3536
chrono = { version = "0.4", features = ["serde"] }
3637
uuid = { version = "1.4", features = ["v4", "serde"] }
3738
async-trait = "0.1"
39+
lazy_static = "1.4"
3840

3941
# Configuration
4042
config = "0.13"

jump/src/api/mod.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

jump/src/api/v1/mod.rs

Lines changed: 0 additions & 3 deletions
This file was deleted.

jump/src/infrastructure/mod.rs

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/api/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//! API layer implementation.
2+
//!
3+
//! This module contains the API implementation including:
4+
//! - API versioning
5+
//! - Route definitions
6+
//! - Request handlers
7+
//! - Middleware
8+
//! - Response types
9+
10+
pub mod v1;

src/api/v1/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//! API v1 implementation.
2+
//!
3+
//! This module contains the v1 API implementation including:
4+
//! - Route definitions
5+
//! - Request handlers
6+
//! - Middleware
7+
//! - Response types
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,16 @@
99
//! from the external interface.
1010
1111
use chrono::{DateTime, Utc};
12+
use lazy_static::lazy_static;
13+
use regex::Regex;
1214
use serde::{Deserialize, Serialize};
1315
use validator::Validate;
1416

17+
lazy_static! {
18+
/// Regular expression for validating MIME types
19+
static ref MIME_TYPE_REGEX: Regex = Regex::new(r"^[a-z]+/[a-z0-9.+-]+$").unwrap();
20+
}
21+
1522
/// Request DTO for creating a new payload.
1623
///
1724
/// This struct represents the expected JSON structure for POST /api/v1/payloads
@@ -111,9 +118,6 @@ pub struct ErrorResponse {
111118
pub retry_after: Option<i32>,
112119
}
113120

114-
/// Regular expression for validating MIME types
115-
static MIME_TYPE_REGEX: &str = r"^[a-z]+/[a-z0-9.+-]+$";
116-
117121
#[cfg(test)]
118122
mod tests {
119123
use super::*;
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
//! They encapsulate all business rules and coordinate between different parts of the system.
1010
1111
use async_trait::async_trait;
12-
use chrono::Utc;
1312
use std::sync::Arc;
1413
use thiserror::Error;
1514
use validator::Validate;
@@ -218,8 +217,14 @@ mod tests {
218217

219218
#[tokio::test]
220219
async fn test_create_payload_success() {
221-
let repository = Arc::new(MockRepository::new());
222-
let use_case = CreatePayloadUseCaseImpl::new(repository);
220+
let mut repository = MockRepository::new();
221+
222+
// Setup mock repository to expect save call
223+
repository
224+
.expect_save()
225+
.returning(|_| Ok(()));
226+
227+
let use_case = CreatePayloadUseCaseImpl::new(Arc::new(repository));
223228

224229
let request = CreatePayloadRequest {
225230
content: "Test content".to_string(),

0 commit comments

Comments
 (0)