49 lines
1.4 KiB
Rust
49 lines
1.4 KiB
Rust
/*
|
|
* advotracker - Hotline tackingtool for Advocats
|
|
*
|
|
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
|
|
* SPDX-License-Identifier: (0BSD or MIT)
|
|
*/
|
|
|
|
use chrono::NaiveDateTime;
|
|
use serde_derive::*;
|
|
//use serde;
|
|
|
|
use crate::schema::roles;
|
|
|
|
/// Structure of a role record
|
|
#[derive(AsChangeset, Debug, Deserialize, Identifiable, PartialEq, Queryable)]
|
|
#[table_name = "roles"]
|
|
pub struct Role {
|
|
/// The auto incremented primary index
|
|
pub id: i32,
|
|
/// The role name
|
|
pub name: String,
|
|
/// Creation date of the role
|
|
pub date_created: NaiveDateTime,
|
|
/// The user id, that has changed the record
|
|
pub id_user_changed: i32,
|
|
/// The timestamp, when the record was changed
|
|
pub date_changed: NaiveDateTime,
|
|
}
|
|
|
|
/// Structure of a new claim record
|
|
#[derive(Debug, Deserialize, Insertable, Serialize)]
|
|
#[table_name = "roles"]
|
|
pub struct NewRole<'a> {
|
|
/// Lifetime of the role name
|
|
pub name: &'a str,
|
|
/// Creation date of the role
|
|
pub date_created: Option<NaiveDateTime>,
|
|
/// The user id, that has changed the record
|
|
pub id_user_changed: i32,
|
|
/// The timestamp, when the record was changed
|
|
pub date_changed: Option<NaiveDateTime>,
|
|
}
|
|
|
|
// we couldn't do a RoleList implementation for a Vector
|
|
// because we don't own it, RoleList is using the newtype pattern
|
|
|
|
//#[derive(Debug, Deserialize, Serialize)]
|
|
//pub struct RoleList(pub Vec<Role>);
|