]> Untitled Git - lemmy.git/blob - crates/db_schema/src/source/instance.rs
Adding instance software and version. Fixes #2222 (#2733)
[lemmy.git] / crates / db_schema / src / source / instance.rs
1 use crate::newtypes::InstanceId;
2 #[cfg(feature = "full")]
3 use crate::schema::instance;
4 use serde::{Deserialize, Serialize};
5 use std::fmt::Debug;
6 use typed_builder::TypedBuilder;
7
8 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
9 #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
10 #[cfg_attr(feature = "full", diesel(table_name = instance))]
11 pub struct Instance {
12   pub id: InstanceId,
13   pub domain: String,
14   pub software: Option<String>,
15   pub version: Option<String>,
16   pub published: chrono::NaiveDateTime,
17   pub updated: Option<chrono::NaiveDateTime>,
18 }
19
20 #[derive(Clone, TypedBuilder)]
21 #[builder(field_defaults(default))]
22 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
23 #[cfg_attr(feature = "full", diesel(table_name = instance))]
24 pub struct InstanceForm {
25   #[builder(!default)]
26   pub domain: String,
27   pub software: Option<String>,
28   pub version: Option<String>,
29   pub updated: Option<chrono::NaiveDateTime>,
30 }