chore: cleanup code
This commit is contained in:
@@ -8,7 +8,7 @@ fn main() {
|
|||||||
.output()
|
.output()
|
||||||
{
|
{
|
||||||
if let Ok(git_origin) = String::from_utf8(output.stdout) {
|
if let Ok(git_origin) = String::from_utf8(output.stdout) {
|
||||||
println!("cargo:rustc-env=GIT_ORIGIN_URL={}", git_origin);
|
println!("cargo:rustc-env=GIT_ORIGIN_URL={git_origin}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,20 +11,15 @@ use ulid::Ulid;
|
|||||||
use validator::Validate;
|
use validator::Validate;
|
||||||
|
|
||||||
/// # Channel Type
|
/// # Channel Type
|
||||||
#[derive(Serialize, Deserialize, JsonSchema)]
|
#[derive(Serialize, Deserialize, JsonSchema, Default)]
|
||||||
enum ChannelType {
|
enum ChannelType {
|
||||||
/// Text Channel
|
/// Text Channel
|
||||||
|
#[default]
|
||||||
Text,
|
Text,
|
||||||
/// Voice Channel
|
/// Voice Channel
|
||||||
Voice,
|
Voice,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for ChannelType {
|
|
||||||
fn default() -> Self {
|
|
||||||
ChannelType::Text
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// # Channel Data
|
/// # Channel Data
|
||||||
#[derive(Validate, Serialize, Deserialize, JsonSchema)]
|
#[derive(Validate, Serialize, Deserialize, JsonSchema)]
|
||||||
pub struct DataCreateChannel {
|
pub struct DataCreateChannel {
|
||||||
|
|||||||
@@ -557,7 +557,7 @@ impl EventV1 {
|
|||||||
|
|
||||||
/// Publish private event
|
/// Publish private event
|
||||||
pub async fn private(self, id: String) {
|
pub async fn private(self, id: String) {
|
||||||
self.p(format!("{}!", id)).await;
|
self.p(format!("{id}!")).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Publish internal global event
|
/// Publish internal global event
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ impl AbstractAttachment for MongoDb {
|
|||||||
parent_type: &str,
|
parent_type: &str,
|
||||||
parent_id: &str,
|
parent_id: &str,
|
||||||
) -> Result<File> {
|
) -> Result<File> {
|
||||||
let key = format!("{}_id", parent_type);
|
let key = format!("{parent_type}_id");
|
||||||
match self
|
match self
|
||||||
.find_one::<File>(
|
.find_one::<File>(
|
||||||
COL,
|
COL,
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ impl AbstractUser for MongoDb {
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"_id": target_id,
|
"_id": target_id,
|
||||||
"status": format!("{:?}", relationship)
|
"status": format!("{relationship:?}")
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -157,10 +157,11 @@ pub struct Message {
|
|||||||
/// # Message Sort
|
/// # Message Sort
|
||||||
///
|
///
|
||||||
/// Sort used for retrieving messages
|
/// Sort used for retrieving messages
|
||||||
#[derive(Serialize, Deserialize, JsonSchema, Debug)]
|
#[derive(Serialize, Deserialize, JsonSchema, Debug, Default)]
|
||||||
#[cfg_attr(feature = "rocket_impl", derive(FromFormField))]
|
#[cfg_attr(feature = "rocket_impl", derive(FromFormField))]
|
||||||
pub enum MessageSort {
|
pub enum MessageSort {
|
||||||
/// Sort by the most relevant messages
|
/// Sort by the most relevant messages
|
||||||
|
#[default]
|
||||||
Relevance,
|
Relevance,
|
||||||
/// Sort by the newest messages first
|
/// Sort by the newest messages first
|
||||||
Latest,
|
Latest,
|
||||||
@@ -168,12 +169,6 @@ pub enum MessageSort {
|
|||||||
Oldest,
|
Oldest,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for MessageSort {
|
|
||||||
fn default() -> MessageSort {
|
|
||||||
MessageSort::Relevance
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// # Message Time Period
|
/// # Message Time Period
|
||||||
///
|
///
|
||||||
/// Filter and sort messages by time
|
/// Filter and sort messages by time
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Metadata associated with file
|
/// Metadata associated with file
|
||||||
#[derive(Serialize, Deserialize, JsonSchema, Debug, Clone)]
|
#[derive(Serialize, Deserialize, JsonSchema, Debug, Clone, Default)]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
pub enum Metadata {
|
pub enum Metadata {
|
||||||
/// File is just a generic uncategorised file
|
/// File is just a generic uncategorised file
|
||||||
|
#[default]
|
||||||
File,
|
File,
|
||||||
/// File contains textual data and should be displayed as such
|
/// File contains textual data and should be displayed as such
|
||||||
Text,
|
Text,
|
||||||
@@ -16,12 +17,6 @@ pub enum Metadata {
|
|||||||
Audio,
|
Audio,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Metadata {
|
|
||||||
fn default() -> Metadata {
|
|
||||||
Metadata::File
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Representation of a File on Revolt
|
/// Representation of a File on Revolt
|
||||||
/// Generated by Autumn
|
/// Generated by Autumn
|
||||||
#[derive(Serialize, Deserialize, JsonSchema, Debug, Clone, Default)]
|
#[derive(Serialize, Deserialize, JsonSchema, Debug, Clone, Default)]
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
use crate::Database;
|
use crate::Database;
|
||||||
|
|
||||||
use deadqueue::limited::Queue;
|
use deadqueue::limited::Queue;
|
||||||
use mongodb::bson::doc;
|
|
||||||
use std::{collections::HashMap, time::Duration};
|
use std::{collections::HashMap, time::Duration};
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
use crate::{models::channel::PartialChannel, Database};
|
use crate::{models::channel::PartialChannel, Database};
|
||||||
|
|
||||||
use deadqueue::limited::Queue;
|
use deadqueue::limited::Queue;
|
||||||
use mongodb::bson::doc;
|
|
||||||
use std::{collections::HashMap, time::Duration};
|
use std::{collections::HashMap, time::Duration};
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
use crate::bson::doc;
|
|
||||||
use crate::util::variables::delta::VAPID_PRIVATE_KEY;
|
use crate::util::variables::delta::VAPID_PRIVATE_KEY;
|
||||||
|
|
||||||
use authifier::Database;
|
use authifier::Database;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ struct Entry {
|
|||||||
reset: u128,
|
reset: u128,
|
||||||
}
|
}
|
||||||
|
|
||||||
static MAP: Lazy<DashMap<u64, Entry>> = Lazy::new(|| DashMap::new());
|
static MAP: Lazy<DashMap<u64, Entry>> = Lazy::new(DashMap::new);
|
||||||
|
|
||||||
/// Get the current time from Unix Epoch as a Duration
|
/// Get the current time from Unix Epoch as a Duration
|
||||||
fn now() -> Duration {
|
fn now() -> Duration {
|
||||||
|
|||||||
Reference in New Issue
Block a user