mirror of
https://github.com/flibusta-apps/book_library_server.git
synced 2025-12-08 09:30:43 +01:00
Rewrite to rust init
This commit is contained in:
25
src/serializers/source.rs
Normal file
25
src/serializers/source.rs
Normal file
@@ -0,0 +1,25 @@
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::prisma::source;
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct Source {
|
||||
pub id: i32,
|
||||
pub name: String
|
||||
}
|
||||
|
||||
impl From<source::Data> for Source
|
||||
{
|
||||
fn from(val: source::Data) -> Self {
|
||||
let source::Data {
|
||||
id,
|
||||
name,
|
||||
..
|
||||
} = val;
|
||||
|
||||
Source {
|
||||
id,
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user