Add Favorite GET, and POST endpoints

This commit is contained in:
Cameron Cordes committed 2020-08-07 23:11:15 -04:00
1 parent 74043c5c6a
commit c774edd7dd
7 files changed
+86 -5

No files matched your search

+15 -1
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,
}