Skip to main content

news_flash/models/
tag.rs

1use crate::models::{ArticleID, TagID};
2use crate::schema::{taggings, tags};
3
4#[derive(Clone, Identifiable, Insertable, Queryable, PartialEq, Eq, Hash, Debug)]
5#[diesel(primary_key(tag_id))]
6#[diesel(table_name = tags)]
7#[diesel(check_for_backend(SQLite))]
8pub struct Tag {
9    pub tag_id: TagID,
10    pub label: String,
11    pub color: Option<String>,
12    pub sort_index: Option<i32>,
13}
14
15#[derive(Clone, Identifiable, Insertable, Queryable, Hash, PartialEq, Eq, Debug)]
16#[diesel(primary_key(article_id, tag_id))]
17#[diesel(table_name = taggings)]
18#[diesel(check_for_backend(SQLite))]
19pub struct Tagging {
20    pub article_id: ArticleID,
21    pub tag_id: TagID,
22}