1use std::hash::Hash;
2
3use chrono::{DateTime, Utc};
4use serde::{Deserialize, Serialize};
5
6#[cfg(feature = "typescript")]
7use ts_rs::TS;
8
9use crate::{AuthorId, FileMetaId, PostId};
10
11#[cfg_attr(feature = "typescript", derive(TS))]
13#[cfg_attr(feature = "typescript", ts(export))]
14#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq, Hash)]
15pub struct Author {
16 pub id: AuthorId,
17 pub name: String,
18 pub thumb: Option<FileMetaId>,
19 pub updated: DateTime<Utc>,
20}
21
22#[cfg_attr(feature = "typescript", derive(TS))]
24#[cfg_attr(feature = "typescript", ts(export))]
25#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq, Hash)]
26pub struct AuthorPost {
27 pub author: AuthorId,
28 pub post: PostId,
29}
30
31#[cfg(feature = "utils")]
32crate::utils::macros::as_table! {
33 Author {
34 id: "id",
35 name: "name",
36 thumb: "thumb",
37 updated: "updated",
38 }
39
40 AuthorPost {
41 author: "author",
42 post: "post",
43 }
44}