Update
This commit is contained in:
parent
94fb270008
commit
584c07ff23
22 changed files with 539 additions and 187 deletions
|
@ -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>,
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue