fix: switch to hashset

Signed-off-by: Zomatree <me@zomatree.live>
This commit is contained in:
Zomatree
2026-03-21 02:57:59 +00:00
parent 083f071c30
commit 3b5491a438
2 changed files with 19 additions and 16 deletions

View File

@@ -1,4 +1,5 @@
use iso8601_timestamp::Timestamp;
use std::collections::HashSet;
auto_derived!(
pub struct DataChannelMessagesSearch {
@@ -13,24 +14,24 @@ auto_derived!(
pub struct DataChannelMessagesSearchFilters {
pub content: Option<String>,
pub author: Option<Vec<String>>,
pub mentions: Option<Vec<String>>,
pub role_mentions: Option<Vec<String>>,
pub author: Option<HashSet<String>>,
pub mentions: Option<HashSet<String>>,
pub role_mentions: Option<HashSet<String>>,
pub before_date: Option<Timestamp>,
pub after_date: Option<Timestamp>,
pub author_type: Option<Vec<AuthorType>>,
pub author_type: Option<HashSet<AuthorType>>,
pub pinned: Option<bool>,
pub components: Option<Vec<MessageComponent>>,
pub components: Option<HashSet<MessageComponent>>,
}
#[derive(Copy)]
#[derive(Copy, Hash)]
pub enum AuthorType {
User,
// Bot,
Webhook,
}
#[derive(Copy)]
#[derive(Copy, Hash)]
pub enum MessageComponent {
Image,
Video,

View File

@@ -1,16 +1,18 @@
use std::collections::HashSet;
use iso8601_timestamp::Timestamp;
use revolt_database::{File, Metadata};
use revolt_models::v0;
use serde::{Deserialize, Serialize};
use revolt_database::{File, Metadata};
#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Hash)]
pub enum AuthorType {
User,
// Bot,
Webhook,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum MessageComponent {
Image,
Video,
@@ -22,14 +24,14 @@ pub enum MessageComponent {
#[derive(Debug, Clone, Default, PartialEq)]
pub struct SearchFilters {
pub content: Option<String>,
pub author: Option<Vec<String>>,
pub mentions: Option<Vec<String>>,
pub role_mentions: Option<Vec<String>>,
pub author: Option<HashSet<String>>,
pub mentions: Option<HashSet<String>>,
pub role_mentions: Option<HashSet<String>>,
pub before_date: Option<Timestamp>,
pub after_date: Option<Timestamp>,
pub author_type: Option<Vec<AuthorType>>,
pub author_type: Option<HashSet<AuthorType>>,
pub pinned: Option<bool>,
pub components: Option<Vec<MessageComponent>>,
pub components: Option<HashSet<MessageComponent>>,
}
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
@@ -51,7 +53,7 @@ pub struct SearchTerms {
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct MetadataFile {
pub file: File,
pub metadata: Metadata
pub metadata: Metadata,
}
impl From<v0::AuthorType> for AuthorType {