This commit is contained in:
Dominic Grimm 2023-02-08 22:13:11 +01:00
parent 94fb270008
commit 584c07ff23
No known key found for this signature in database
GPG key ID: 6F294212DEAAC530
22 changed files with 539 additions and 187 deletions

View file

@ -3,31 +3,6 @@ use diesel::prelude::*;
use crate::db::schema;
#[derive(Identifiable, Queryable, Debug)]
#[diesel(table_name = schema::configs)]
pub struct Config {
pub id: i32,
pub active: bool,
pub name: String,
pub description: String,
pub copyright: String,
pub owner_name: String,
pub owner_email: String,
pub owner_website: Option<String>,
}
#[derive(Insertable, Debug)]
#[diesel(table_name = schema::configs)]
pub struct NewConfig<'a> {
pub active: bool,
pub name: &'a str,
pub description: &'a str,
pub copyright: &'a str,
pub owner_name: &'a str,
pub owner_email: &'a str,
pub owner_website: Option<&'a str>,
}
#[derive(Identifiable, Queryable, Debug)]
#[diesel(table_name = schema::tags)]
pub struct Tag {
@ -65,3 +40,15 @@ pub struct NewPost<'a> {
pub edited_at: Option<NaiveDate>,
pub active: bool,
}
#[derive(AsChangeset, Debug)]
#[diesel(table_name = schema::posts)]
pub struct UpdatePost<'a> {
pub name: Option<&'a str>,
pub slug: Option<&'a str>,
pub description: Option<&'a str>,
pub content: Option<&'a str>,
pub published_at: Option<NaiveDate>,
pub edited_at: Option<Option<NaiveDate>>,
pub active: Option<bool>,
}

View file

@ -1,16 +1,3 @@
diesel::table! {
configs {
id -> Integer,
active -> Bool,
name -> Text,
description -> Text,
copyright -> Text,
owner_name -> Text,
owner_email -> Text,
owner_website -> Nullable<Text>,
}
}
diesel::table! {
tags {
id -> Integer,