Create Tag tables and Add Tag endpoint

This commit is contained in:
Cameron Cordes committed 2021-10-11 21:52:06 -04:00
1 parent 2d6db6d059
commit 8939ffbaf5
7 files changed
+155 -5

No files matched your search

+27 -1
View File
@@ -1,4 +1,4 @@
use crate::database::schema::{favorites, users};
use crate::database::schema::{favorites, tagged_photo, tags, users};
use serde::Serialize;
#[derive(Insertable)]
@@ -29,3 +29,29 @@ pub struct Favorite {
pub userid: i32,
pub path: String,
}
#[derive(Serialize, Queryable, Clone, Debug)]
pub struct Tag {
pub id: i32,
pub name: String,
}
#[derive(Insertable, Clone, Debug)]
#[table_name = "tags"]
pub struct InsertTag {
pub name: String,
}
#[derive(Insertable, Clone, Debug)]
#[table_name = "tagged_photo"]
pub struct InsertTaggedPhoto {
pub tag_id: i32,
pub photo_name: String,
}
#[derive(Queryable, Clone, Debug)]
pub struct TaggedPhoto {
pub id: i32,
pub photo_name: String,
pub tag_id: i32,
}