Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion fuzzysearch-api/src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ pub async fn image_query(
hashes.searched_hash,
hashes.distance,
submission.file_sha256 sha256
null flags
FROM hashes
JOIN submission ON hashes.found_hash = submission.hash_int
JOIN artist ON submission.artist_id = artist.id
Expand All @@ -109,7 +110,8 @@ pub async fn image_query(
to_timestamp(data->>'created_at', 'YYYY-MM-DD"T"HH24:MI:SS"Z"') posted_at,
hashes.searched_hash,
hashes.distance,
e621.sha256
e621.sha256,
e621.data->>'flags' flags
FROM hashes
JOIN e621 ON hashes.found_hash = e621.hash
WHERE e621.hash IN (SELECT hashes.found_hash)
Expand All @@ -128,6 +130,7 @@ pub async fn image_query(
hashes.searched_hash,
hashes.distance,
weasyl.sha256
null flags
FROM hashes
JOIN weasyl ON hashes.found_hash = weasyl.hash
WHERE weasyl.hash IN (SELECT hashes.found_hash)
Expand All @@ -149,6 +152,7 @@ pub async fn image_query(
hashes.searched_hash,
hashes.distance,
null sha256
null flags
FROM hashes
JOIN tweet_media ON hashes.found_hash = tweet_media.hash
JOIN tweet ON tweet_media.tweet_id = tweet.id
Expand All @@ -164,6 +168,7 @@ pub async fn image_query(
},
Some("e621") => SiteInfo::E621 {
sources: row.sources,
flags: row.flags,
},
Some("Twitter") => SiteInfo::Twitter,
Some("Weasyl") => SiteInfo::Weasyl,
Expand Down
11 changes: 11 additions & 0 deletions fuzzysearch-common/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ pub struct SearchResult {
pub searched_hash: Option<i64>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct E621Flags {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that the some of the declarations in this file have serde serializer descriptions applied to them. Does this struct need one as well?

pending: bool,
flagged: bool,
note_locked: bool,
status_locked: bool,
rating_locked: bool,
deleted: bool,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(tag = "site", content = "site_info")]
pub enum SiteInfo {
Expand All @@ -63,6 +73,7 @@ pub enum SiteInfo {
#[serde(rename = "e621")]
E621 {
sources: Option<Vec<String>>,
flags: Option<E621Flags>,
},
Twitter,
Weasyl,
Expand Down