Merge branch 'master' of gitlab.com:shockrah/freechat

This commit is contained in:
shockrahwow
2019-12-05 11:15:53 -08:00
6 changed files with 58 additions and 59 deletions

View File

@@ -1,58 +0,0 @@
/* Here we maintain all the different structures that we use to
* interface with our database at any given time
*/
use diesel::prelude::SqliteConnection;
enum UserType {
Native,
Remote,
Invalid,
}
#[table_name="users"]
#[derive(Serialize, Queryable, Insertable, Debug, Clone)]
struct User {
userid: String,
/* Sometimes this isn't a password persey
* Basically: native users and remote users will share this here but
* remote users are given a passkey which they don't control.
*/
passkey: String,
native: bool,
display: String,
}
#[derive(FromForm)]
struct UserRegister{
userid: String,
display: String,
passkey: String, // basically just a hash for now
}
struct Ticket {
hashValue: String // probably just some huge text hash
}
impl User {
/* only ever add a user to our database if they have a ticket whose id matches with
* a currently valid id
* This means that instances can be set to invite only if owners wish
*/
pub fn insert(user: UserLogin, entry: Ticket, conn: &SqliteConnection) -> bool {
}
pub fn remove(userid: String) -> Result<User> {
}
pub fn get_user(userid: String) -> Result<User> {
}
pub fn update_display(userid: String) -> bool {
}
pub fn update_passkey(userid: String, newpass_hash: String) -> bool {
}
pub fn update_native(userid: String, newdisplay: String) -> bool {
}
}