32 lines
633 B
Rust
32 lines
633 B
Rust
use crate::database::schema::{favorites, users};
|
|
use serde::Serialize;
|
|
|
|
#[derive(Insertable)]
|
|
#[table_name = "users"]
|
|
pub struct InsertUser<'a> {
|
|
pub username: &'a str,
|
|
pub password: &'a str,
|
|
}
|
|
|
|
#[derive(Serialize, Queryable, Clone, Debug)]
|
|
pub struct User {
|
|
pub id: i32,
|
|
pub username: String,
|
|
#[serde(skip_serializing)]
|
|
pub password: String,
|
|
}
|
|
|
|
#[derive(Insertable)]
|
|
#[table_name = "favorites"]
|
|
pub struct InsertFavorite<'a> {
|
|
pub userid: &'a i32,
|
|
pub path: &'a str,
|
|
}
|
|
|
|
#[derive(Serialize, Queryable, Clone, Debug)]
|
|
pub struct Favorite {
|
|
pub id: i32,
|
|
pub userid: i32,
|
|
pub path: String,
|
|
}
|