Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d6a995d
feat: todo 도메인 모듈 추가
zzaekkii Nov 22, 2025
8097ba7
fix: cargo 포맷 규칙 적용
zzaekkii Nov 22, 2025
c11caeb
feat: user 도메인 모듈 추가
zzaekkii Nov 22, 2025
52aef90
test: todo_item 단위 테스트 추가
zzaekkii Nov 22, 2025
b259829
test: todo 단위 테스트 추가
zzaekkii Nov 22, 2025
b32cc63
test: todo 비즈니스 규칙 추가 및 단위 테스트 추가
zzaekkii Nov 22, 2025
373b950
Merge branch 'develop' of https://github.com/zzaekkii/challenge-to-do…
zzaekkii Nov 22, 2025
103bc59
refactor: aggregate 단위로 묶어 하나의 todo repository 형태로 전환
zzaekkii Nov 23, 2025
fd80e9e
fix: cargo fmt 적용
zzaekkii Nov 23, 2025
3f9e9eb
chore: todoItemStatus 모듈 public으로 변경
zzaekkii Nov 23, 2025
5bb64f5
feat: status vo 상태 변환 (&str <-> status)
zzaekkii Nov 23, 2025
ae8d065
chore: postgres 에러를 database 에러로 통합
zzaekkii Nov 23, 2025
f2d2880
feat: todo 엔티티(seaORM 자동생성시 교체 예정) 추가 및 repository trait 구현, 엔티티-모델 매…
zzaekkii Nov 23, 2025
a2e770b
feat: user 및 소셜 계정 엔티티 생성 및 repository trait 구현, 모델-엔티티 매퍼 구현
zzaekkii Nov 23, 2025
71a2a8a
feat: seaORM 엔티티 관계 설정 추가
zzaekkii Nov 23, 2025
f1c0449
feat: 기존 에러 ErrorCode 구현 및 -Code로 이름 변경
zzaekkii Nov 23, 2025
1b9d312
fix: 린트 cargo fmt 적용
zzaekkii Nov 24, 2025
8cf8ae6
chore: api 크레이트 구조만 잡고, 남은 api 기능 추가는 다음 이슈에서 진행
zzaekkii Nov 24, 2025
3544569
chore: 레포지토리 위치 변경으로 sonar cloud 세팅 수정
zzaekkii Nov 24, 2025
9a384c3
fix: 프로젝트 키 수정
zzaekkii Nov 24, 2025
df9cab6
fix: sonar cloud 설정 파일 내 프로젝트 경로 수정
zzaekkii Nov 24, 2025
b77987f
fix: sonar cloud 설정 수정
zzaekkii Nov 24, 2025
a43be2a
fix: sonar cloud 설정 내 프로젝트 경로 최종 수정
zzaekkii Nov 24, 2025
5ed18ac
chore: sonar cloud 재설정
zzaekkii Nov 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 4 additions & 21 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,14 @@ jobs:
- name: Install grcov
run: cargo install grcov

- name: Run tests with coverage instrumentation
working-directory: backend
run: |
CARGO_INCREMENTAL=0 \
RUSTFLAGS="-Cinstrument-coverage" \
LLVM_PROFILE_FILE="coverage-%p-%m.profraw" \
cargo test --all --verbose

- name: Generate coverage report (lcov)
working-directory: backend
run: |
grcov . \
--binary-path ./target/debug/ \
-s . -t lcov \
--branch --ignore-not-existing \
-o coverage.lcov

- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@v2
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
with:
args: >
-Dsonar.projectBaseDir=backend
-Dsonar.projectKey=zzaekkii_challenge-to-do
-Dsonar.organization=zzaekkii
-Dsonar.projectBaseDir=backend
-Dsonar.projectKey=backend
-Dsonar.organization=morutine
-Dsonar.javascript.lcov.reportPaths=coverage.lcov
4 changes: 4 additions & 0 deletions backend/todo-api/src/common/error/database_error_wrapper.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
use infra::database::database_error_code::DatabaseErrorCode;

#[derive(Debug)]
pub struct DatabaseApiError(pub DatabaseErrorCode);
10 changes: 5 additions & 5 deletions backend/todo-api/src/common/error/error_into_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use axum::{
use serde_json::json;

use crate::common::error::app_error::AppError;
use crate::common::error::postgres_error_wrapper::PostgresApiError;
use crate::common::error::database_error_wrapper::DatabaseApiError;
use common::error::{CommonErrorCode, ErrorCode};
use infra::database::postgres::PostgresError;
use infra::database::database_error_code::DatabaseErrorCode;

// AppError<E> -> HTTP Response
impl<E: ErrorCode> IntoResponse for AppError<E> {
Expand All @@ -26,12 +26,12 @@ impl<E: ErrorCode> IntoResponse for AppError<E> {
}

// PostgresError -> HTTP Response
impl IntoResponse for PostgresApiError {
impl IntoResponse for DatabaseApiError {
fn into_response(self) -> Response {
let app_error: AppError<CommonErrorCode> = match self.0 {
PostgresError::UniqueViolation => AppError::new(CommonErrorCode::Conflict),
DatabaseErrorCode::UniqueViolation(_) => AppError::new(CommonErrorCode::Conflict),

PostgresError::NotFound => AppError::new(CommonErrorCode::NotFound),
DatabaseErrorCode::NotFound => AppError::new(CommonErrorCode::NotFound),

_ => AppError::new(CommonErrorCode::InternalServerError),
};
Expand Down
2 changes: 1 addition & 1 deletion backend/todo-api/src/common/error/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pub mod app_error;
pub mod database_error_wrapper;
pub mod error_into_response;
mod postgres_error_wrapper;
4 changes: 0 additions & 4 deletions backend/todo-api/src/common/error/postgres_error_wrapper.rs

This file was deleted.

2 changes: 2 additions & 0 deletions backend/todo-api/src/domain/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
pub mod system;
pub mod todo;
pub mod user;
20 changes: 20 additions & 0 deletions backend/todo-api/src/domain/todo/handlers.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// use axum::extract::{Query, State};
// use axum::response::IntoResponse;
// use serde::Deserialize;
// use domain::todo::todo_error_code::TodoErrorCode;
// use crate::bootstrap::AppState;
// use crate::common::error::app_error::AppError;
// use crate::common::response::api_response::ApiResponse;
//
// #[derive(Deserialize)]
// pub struct MonthlyQuery {
// pub year: i32,
// pub month: u32,
// }
//
// pub async fn get_monthly_todos(
// State(state): State(AppState),
// Query(q): Query<MonthlyQuery>,
// ) -> Result<ApiResponse<T>, AppError<E>> {
//
// }
2 changes: 2 additions & 0 deletions backend/todo-api/src/domain/todo/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod handlers;
pub mod routes;
9 changes: 9 additions & 0 deletions backend/todo-api/src/domain/todo/routes.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// use axum::Router;
// use axum::routing::{get, post, patch, delete};
//
// pub fn todo_routes() -> Router {
// Router::new()
// .route("/", get(get_monthly_todos).post(create_todo))
// .route("/:id", patch(update_todo).delete(delete_todo))
// .route("/:id/status", patch(update_todo_status))
// }
1 change: 1 addition & 0 deletions backend/todo-api/src/domain/user/handlers.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

2 changes: 2 additions & 0 deletions backend/todo-api/src/domain/user/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod handlers;
pub mod routes;
1 change: 1 addition & 0 deletions backend/todo-api/src/domain/user/routes.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

13 changes: 8 additions & 5 deletions backend/todo-api/src/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ use crate::domain::system::routes::system_routes;
use axum::Router;

pub fn create_app_router(config: &AppConfig) -> Router<AppState> {
Router::new()
.nest("/system", system_routes())
.layer(build_compression_layer())
.layer(build_concurrency_limit_layer())
.layer(build_cors(config))
Router::new().nest(
"/api/v1",
Router::new()
.nest("/system", system_routes())
.layer(build_compression_layer())
.layer(build_concurrency_limit_layer())
.layer(build_cors(config)),
)
}
6 changes: 6 additions & 0 deletions backend/todo-domain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@ version = "0.1.0"
edition = "2024"

[dependencies]
derive_builder = "0.20"
chrono = { version = "0.4", features = ["clock"] }

common = { path = "../todo-common" }
anyhow = "1.0.100"
async-trait = "0.1.89"
thiserror = "2.0.17"
16 changes: 2 additions & 14 deletions backend/todo-domain/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,2 @@
pub fn add(left: u64, right: u64) -> u64 {
left + right
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}
pub mod todo;
pub mod user;
5 changes: 5 additions & 0 deletions backend/todo-domain/src/todo/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pub mod models;
pub mod repository;
pub mod todo_error_code;

pub use todo_error_code::TodoErrorCode::*;
3 changes: 3 additions & 0 deletions backend/todo-domain/src/todo/models/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub mod todo;
pub mod todo_item;
pub mod todo_item_status;
Loading