blog/backend/feature/post/src/adapter/delivery/post_response_dto.rs
an920107 a68275e215
All checks were successful
Frontend CI / build (push) Successful in 1m46s
BLOG-43 feat: get full post
2025-05-22 15:43:24 +08:00

23 lines
479 B
Rust

use serde::Serialize;
use crate::domain::entity::post::Post;
use super::post_info_response_dto::PostInfoResponseDto;
#[derive(Serialize)]
pub struct PostResponseDto {
pub id: i32,
pub info: PostInfoResponseDto,
pub content: String,
}
impl From<Post> for PostResponseDto {
fn from(entity: Post) -> Self {
Self {
id: entity.id,
info: PostInfoResponseDto::from(entity.info),
content: entity.content,
}
}
}