Add Favorite GET, and POST endpoints

This commit is contained in:
Cameron Cordes
2020-08-07 22:56:29 -04:00
parent 74043c5c6a
commit c774edd7dd
7 changed files with 86 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
use crate::database::schema::users;
use crate::database::schema::{favorites, users};
use serde::Serialize;
#[derive(Insertable)]
@@ -15,3 +15,17 @@ pub struct User {
#[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,
}