init
This commit is contained in:
@@ -57,15 +57,16 @@ Currently, each feature module in `src/routes/<module>/` contains a `dto.rs` fil
|
||||
|
||||
# Delivery Steps
|
||||
|
||||
### Step 1: Create domain DTO directory and module structure
|
||||
### ✓ Step 1: Create domain DTO directory and module structure
|
||||
- Create `src/domain/dto/` directory along with `src/domain/dto/mod.rs`.
|
||||
- Set up module declarations for each DTO file (auth, user, channel, message, category, role, attachment, core, etc.) under `src/domain/dto/`.
|
||||
- Expose `pub mod dto;` in `src/domain/mod.rs`.
|
||||
|
||||
### Step 2: Migrate DTO files to `src/domain/dto/` and update imports
|
||||
### ✓ Step 2: Migrate DTO files to `src/domain/dto/` and update imports
|
||||
- Move each `dto.rs` file from `src/routes/<module>/dto.rs` into `src/domain/dto/<module>.rs`.
|
||||
- Update all import statements across handlers, mappers, services, and route files in `src/routes/` and elsewhere to reference `crate::domain::dto::<module>::*`.
|
||||
- Remove the old `dto.rs` files from `src/routes/<module>/` and remove `pub mod dto;` from `src/routes/<module>/mod.rs`.
|
||||
|
||||
### Step 3: Verify compilation and test suite
|
||||
- Run `cargo check` and `cargo test` to ensure all DTO types resolve correctly and there are no broken imports or compilation errors.\n- Verify OpenAPI schema generation (`utoipa`) correctly picks up the migrated DTO schemas.
|
||||
### ✓ Step 3: Verify compilation and test suite
|
||||
- Run `cargo check` and `cargo test` to ensure all DTO types resolve correctly and there are no broken imports or compilation errors.
|
||||
- Verify OpenAPI schema generation (`utoipa`) correctly picks up the migrated DTO schemas.
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::routes::user::dto::UserResponse;
|
||||
use crate::domain::dto::user::UserResponse;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use utoipa::ToSchema;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
pub mod auth;
|
||||
pub mod attachment;
|
||||
pub mod message;
|
||||
pub mod role;
|
||||
pub mod server;
|
||||
pub mod core;
|
||||
pub mod user;
|
||||
pub mod channel;
|
||||
pub mod category;
|
||||
@@ -1 +1,2 @@
|
||||
pub mod events;
|
||||
pub mod dto;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use super::{domain::Attachment, dto::AttachmentResponse};
|
||||
use super::domain::Attachment;
|
||||
use crate::domain::dto::attachment::AttachmentResponse;
|
||||
|
||||
pub fn to_response(_item: Attachment) -> AttachmentResponse {
|
||||
todo!()
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
pub mod domain;
|
||||
pub mod dto;
|
||||
pub mod handlers;
|
||||
pub mod mapper;
|
||||
pub mod routes;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use super::dto::{LoginRequest, LoginResponse, MeResponse};
|
||||
use crate::domain::dto::auth::{LoginRequest, LoginResponse, MeResponse};
|
||||
use crate::auth::token::create_jwt;
|
||||
use crate::core::AppState;
|
||||
use crate::http::context::CurrentUser;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
pub mod domain;
|
||||
pub mod dto;
|
||||
pub mod handlers;
|
||||
pub mod mapper;
|
||||
pub mod routes;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::core::state::AppState;
|
||||
use crate::http::context::Superuser;
|
||||
use crate::http::error::HTTPError;
|
||||
use crate::routes::category::dto::{
|
||||
use crate::domain::dto::category::{
|
||||
CategoryQueryParams, CategoryResponse, CreateCategoryRequest, UpdateCategoryRequest,
|
||||
};
|
||||
use crate::routes::category::mapper;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::models::category;
|
||||
use crate::routes::category::dto::{
|
||||
use crate::domain::dto::category::{
|
||||
CategoryResponse, CreateCategoryRequest, UpdateCategoryRequest,
|
||||
};
|
||||
use sea_orm::Set;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
pub mod domain;
|
||||
pub mod dto;
|
||||
pub mod handlers;
|
||||
pub mod mapper;
|
||||
pub mod routes;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::core::state::AppState;
|
||||
use crate::http::context::Superuser;
|
||||
use crate::http::error::HTTPError;
|
||||
use crate::routes::channel::dto::{
|
||||
use crate::domain::dto::channel::{
|
||||
ChannelQueryParams, ChannelResponse, ChannelRolePermissionResponse,
|
||||
ChannelUserPermissionResponse, CreateChannelRequest, SetChannelPermissionRequest,
|
||||
UpdateChannelRequest,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::models::{channel, channel_role_permission, channel_user_permission};
|
||||
use crate::repositories::types::ChannelFilter;
|
||||
use crate::routes::channel::dto::{
|
||||
use crate::domain::dto::channel::{
|
||||
ChannelQueryParams, ChannelResponse, ChannelRolePermissionResponse,
|
||||
ChannelUserPermissionResponse, CreateChannelRequest, UpdateChannelRequest,
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
pub mod domain;
|
||||
pub mod dto;
|
||||
pub mod handlers;
|
||||
pub mod mapper;
|
||||
pub mod routes;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::core::AppState;
|
||||
use crate::http::error::HTTPError;
|
||||
use crate::http::validation::ValidatedJson;
|
||||
use crate::routes::core::dto::JoinRequest;
|
||||
use crate::domain::dto::core::JoinRequest;
|
||||
use crate::routes::core::mapper::join_request_to_user_am;
|
||||
use axum::extract::State;
|
||||
use axum::http::StatusCode;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::auth::password::hash_password;
|
||||
use crate::models::user;
|
||||
use crate::routes::core::dto::JoinRequest;
|
||||
use crate::domain::dto::core::JoinRequest;
|
||||
use anyhow::Result as AnyResult;
|
||||
use sea_orm::Set;
|
||||
use uuid::Uuid;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
pub mod domain;
|
||||
pub mod dto;
|
||||
pub mod handlers;
|
||||
pub mod mapper;
|
||||
pub mod routes;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use super::dto::{CreateMessageRequest, MessageQueryParams, MessageResponse, UpdateMessageRequest};
|
||||
use crate::domain::dto::message::{CreateMessageRequest, MessageQueryParams, MessageResponse, UpdateMessageRequest};
|
||||
use crate::core::state::AppState;
|
||||
use crate::http::context::CurrentUser;
|
||||
use crate::http::error::HTTPError;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::models::message;
|
||||
use crate::repositories::types::MessageFilter;
|
||||
use crate::routes::message::dto::{
|
||||
use crate::domain::dto::message::{
|
||||
CreateMessageRequest, MessageQueryParams, MessageResponse, UpdateMessageRequest,
|
||||
};
|
||||
use chrono::Utc;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
pub mod domain;
|
||||
pub mod dto;
|
||||
pub mod handlers;
|
||||
pub mod mapper;
|
||||
pub mod routes;
|
||||
|
||||
+22
-22
@@ -44,28 +44,28 @@ use utoipa::{Modify, OpenApi};
|
||||
),
|
||||
components(
|
||||
schemas(
|
||||
auth::dto::LoginRequest,
|
||||
auth::dto::LoginResponse,
|
||||
auth::dto::MeResponse,
|
||||
user::dto::UserResponse,
|
||||
user::dto::CreateUserRequest,
|
||||
user::dto::UpdateUserRequest,
|
||||
server::dto::ServerResponse,
|
||||
server::dto::CreateServerRequest,
|
||||
server::dto::UpdateServerRequest,
|
||||
category::dto::CategoryResponse,
|
||||
category::dto::CreateCategoryRequest,
|
||||
category::dto::UpdateCategoryRequest,
|
||||
channel::dto::ChannelResponse,
|
||||
channel::dto::CreateChannelRequest,
|
||||
channel::dto::UpdateChannelRequest,
|
||||
role::dto::RoleResponse,
|
||||
role::dto::CreateRoleRequest,
|
||||
role::dto::UpdateRoleRequest,
|
||||
message::dto::MessageResponse,
|
||||
message::dto::CreateMessageRequest,
|
||||
message::dto::UpdateMessageRequest,
|
||||
core::dto::JoinRequest,
|
||||
crate::domain::dto::auth::LoginRequest,
|
||||
crate::domain::dto::auth::LoginResponse,
|
||||
crate::domain::dto::auth::MeResponse,
|
||||
crate::domain::dto::user::UserResponse,
|
||||
crate::domain::dto::user::CreateUserRequest,
|
||||
crate::domain::dto::user::UpdateUserRequest,
|
||||
crate::domain::dto::server::ServerResponse,
|
||||
crate::domain::dto::server::CreateServerRequest,
|
||||
crate::domain::dto::server::UpdateServerRequest,
|
||||
crate::domain::dto::category::CategoryResponse,
|
||||
crate::domain::dto::category::CreateCategoryRequest,
|
||||
crate::domain::dto::category::UpdateCategoryRequest,
|
||||
crate::domain::dto::channel::ChannelResponse,
|
||||
crate::domain::dto::channel::CreateChannelRequest,
|
||||
crate::domain::dto::channel::UpdateChannelRequest,
|
||||
crate::domain::dto::role::RoleResponse,
|
||||
crate::domain::dto::role::CreateRoleRequest,
|
||||
crate::domain::dto::role::UpdateRoleRequest,
|
||||
crate::domain::dto::message::MessageResponse,
|
||||
crate::domain::dto::message::CreateMessageRequest,
|
||||
crate::domain::dto::message::UpdateMessageRequest,
|
||||
crate::domain::dto::core::JoinRequest,
|
||||
ChannelType,
|
||||
)
|
||||
),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::core::state::AppState;
|
||||
use crate::http::context::Superuser;
|
||||
use crate::http::error::HTTPError;
|
||||
use crate::routes::role::dto::{CreateRoleRequest, RoleResponse, UpdateRoleRequest};
|
||||
use crate::domain::dto::role::{CreateRoleRequest, RoleResponse, UpdateRoleRequest};
|
||||
use crate::routes::role::mapper;
|
||||
use axum::{
|
||||
Json,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::models::role;
|
||||
use crate::routes::role::dto::{CreateRoleRequest, RoleResponse, UpdateRoleRequest};
|
||||
use crate::domain::dto::role::{CreateRoleRequest, RoleResponse, UpdateRoleRequest};
|
||||
use sea_orm::Set;
|
||||
use uuid::Uuid;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
pub mod domain;
|
||||
pub mod dto;
|
||||
pub mod handlers;
|
||||
pub mod mapper;
|
||||
pub mod routes;
|
||||
|
||||
@@ -2,7 +2,7 @@ use crate::core::state::AppState;
|
||||
use crate::http::context::Superuser;
|
||||
use crate::http::error::HTTPError;
|
||||
use crate::repositories::types::{ChannelFilter, ServerTree};
|
||||
use crate::routes::server::dto::{
|
||||
use crate::domain::dto::server::{
|
||||
CreateServerRequest, ServerResponse, ServerRolePermissionResponse,
|
||||
ServerUserPermissionResponse, SetServerPermissionRequest, UpdateServerRequest,
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@ use crate::models::{
|
||||
category, channel, server, server_item_order, server_role_permission, server_user_permission,
|
||||
};
|
||||
use crate::repositories::types::{ServerExplorerItem, ServerTree};
|
||||
use crate::routes::server::dto::{
|
||||
use crate::domain::dto::server::{
|
||||
CreateServerRequest, ServerResponse, ServerRolePermissionResponse,
|
||||
ServerUserPermissionResponse, UpdateServerRequest,
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
pub mod domain;
|
||||
pub mod dto;
|
||||
pub mod handlers;
|
||||
pub mod mapper;
|
||||
pub mod routes;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::core::state::AppState;
|
||||
use crate::http::context::Superuser;
|
||||
use crate::http::error::HTTPError;
|
||||
use crate::routes::user::dto::{CreateUserRequest, UpdateUserRequest, UserResponse};
|
||||
use crate::domain::dto::user::{CreateUserRequest, UpdateUserRequest, UserResponse};
|
||||
use crate::routes::user::mapper;
|
||||
use axum::{
|
||||
Json,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::auth::password::hash_password;
|
||||
use crate::models::user;
|
||||
use crate::routes::user::dto::{CreateUserRequest, UpdateUserRequest, UserResponse};
|
||||
use crate::domain::dto::user::{CreateUserRequest, UpdateUserRequest, UserResponse};
|
||||
use anyhow::Result as AnyResult;
|
||||
use sea_orm::{NotSet, Set};
|
||||
use uuid::Uuid;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
pub mod domain;
|
||||
pub mod dto;
|
||||
pub mod handlers;
|
||||
pub mod mapper;
|
||||
pub mod routes;
|
||||
|
||||
Reference in New Issue
Block a user