Compare commits
No commits in common. "9ae4b9552f8f1ae3e93af51f0db11d982691f1f3" and "0be0c1ecbc21e79356e8ebfab96c011c22e9f4d2" have entirely different histories.
9ae4b9552f
...
0be0c1ecbc
|
|
@ -1 +0,0 @@
|
||||||
//TODO: Api Structure
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
//TODO: New User Auth loop
|
|
||||||
//TODO: Existing User Auth loop
|
|
||||||
//TODO: Hash Function
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
//TODO: Logic for backing up an account
|
|
||||||
66
src/db.rs
66
src/db.rs
|
|
@ -1,66 +0,0 @@
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use mongodb::{
|
|
||||||
bson::{DateTime, oid::ObjectId},
|
|
||||||
Client,
|
|
||||||
Database,
|
|
||||||
error::Error,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub async fn get_database_client() -> Result<Database, Error> {
|
|
||||||
Ok(Client::with_uri_str("mongodb:://localhost:27017").await?.database("dermy"))
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
|
||||||
pub struct Mole {
|
|
||||||
#[serde(rename = "_id", skip_serializing_if = "Option::is_none")]
|
|
||||||
id: Option<ObjectId>,
|
|
||||||
#[serde(rename="_user_id")]
|
|
||||||
user_id: ObjectId,
|
|
||||||
#[serde(rename="_image_path")]
|
|
||||||
image_path: Option<String>,
|
|
||||||
location: Location,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
|
||||||
pub enum Location {
|
|
||||||
FrontLocation(FrontLocation),
|
|
||||||
LeftSideLocation(LeftSideLocation),
|
|
||||||
RightSideLocation(RightSideLocation),
|
|
||||||
BackLocation(BackLocation),
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
|
||||||
pub enum FrontLocation {} //TODO: Add front locations
|
|
||||||
#[derive(Serialize, Deserialize)]
|
|
||||||
pub enum LeftSideLocation {} //TODO: Add left side locations
|
|
||||||
#[derive(Serialize, Deserialize)]
|
|
||||||
pub enum RightSideLocation {} //TODO: Add right side locations
|
|
||||||
#[derive(Serialize, Deserialize)]
|
|
||||||
pub enum BackLocation {} //TODO: Add back locations
|
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
|
||||||
pub struct LogEntry {
|
|
||||||
#[serde(rename = "_id", skip_serializing_if = "Option::is_none")]
|
|
||||||
id: Option<ObjectId>,
|
|
||||||
#[serde(rename = "_date_created")]
|
|
||||||
date_created: DateTime,
|
|
||||||
contents: String,
|
|
||||||
#[serde(rename = "_mole_id")]
|
|
||||||
mole_id: ObjectId
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
|
||||||
pub struct User {
|
|
||||||
#[serde(rename = "_id", skip_serializing_if = "Option::is_none")]
|
|
||||||
id: Option<ObjectId>,
|
|
||||||
#[serde(rename="_auth")]
|
|
||||||
auth: Auth,
|
|
||||||
username: String,
|
|
||||||
}
|
|
||||||
#[derive(Serialize, Deserialize)]
|
|
||||||
pub struct Auth {
|
|
||||||
#[serde(rename = "_hash", skip_serializing_if = "String::is_empty")]
|
|
||||||
hash: String,
|
|
||||||
#[serde(rename = "_salt", skip_serializing_if = "String::is_empty")]
|
|
||||||
salt: String,
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
mod api;
|
|
||||||
mod backup;
|
|
||||||
mod db;
|
|
||||||
Loading…
Reference in New Issue