Start work on notifications from client, cargo fmt

This commit is contained in:
Paul Makles
2020-12-30 11:36:32 +00:00
parent af56f5e2d8
commit f39bc07bb9
34 changed files with 341 additions and 264 deletions

View File

@@ -2,9 +2,9 @@ use rand::{distributions::Alphanumeric, Rng};
use std::collections::HashSet;
use std::iter::FromIterator;
pub mod captcha;
pub mod email;
pub mod result;
pub mod captcha;
pub mod variables;
pub fn vec_to_set<T: Clone + Eq + std::hash::Hash>(data: &[T]) -> HashSet<T> {

View File

@@ -1,11 +1,11 @@
use rocket::response::{self, Responder, Response};
use rocket::http::{ContentType, Status};
use validator::ValidationErrors;
use rocket::request::Request;
use serde::Serialize;
use std::io::Cursor;
use snafu::Snafu;
use json;
use rocket::http::{ContentType, Status};
use rocket::request::Request;
use rocket::response::{self, Responder, Response};
use serde::Serialize;
use snafu::Snafu;
use std::io::Cursor;
use validator::ValidationErrors;
#[derive(Serialize, Debug, Snafu)]
#[serde(tag = "type")]
@@ -16,7 +16,7 @@ pub enum Error {
// ? Onboarding related errors.
#[snafu(display("Already finished onboarding."))]
AlreadyOnboarded,
// ? User related errors.
#[snafu(display("Username has already been taken."))]
UsernameTaken,
@@ -35,7 +35,10 @@ pub enum Error {
#[snafu(display("Failed to validate fields."))]
FailedValidation { error: ValidationErrors },
#[snafu(display("Encountered a database error."))]
DatabaseError { operation: &'static str, with: &'static str },
DatabaseError {
operation: &'static str,
with: &'static str,
},
#[snafu(display("Internal server error."))]
InternalError,
#[snafu(display("This request had no effect."))]