user database operations
This commit is contained in:
parent
085f8baee0
commit
36c72cee4a
11 changed files with 110 additions and 5 deletions
16
src/feature/interaction.rs
Normal file
16
src/feature/interaction.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
enum InteractionType {
|
||||
Like,
|
||||
Dislike,
|
||||
Heart,
|
||||
Confetti,
|
||||
Plus,
|
||||
Minus,
|
||||
Rocket,
|
||||
Smile,
|
||||
Laugh,
|
||||
}
|
||||
struct Interaction {
|
||||
post_id:String,
|
||||
user_id:String,
|
||||
interaction_type: InteractionType,
|
||||
}
|
15
src/feature/message.rs
Normal file
15
src/feature/message.rs
Normal file
|
@ -0,0 +1,15 @@
|
|||
pub struct Message {
|
||||
pub sender_email: String,
|
||||
pub receiver_email: String,
|
||||
pub message: String,
|
||||
}
|
||||
|
||||
impl Message {
|
||||
pub async fn new(sender_email: String, receiver_email: String, message: String) -> Self{
|
||||
Message {
|
||||
sender_email,
|
||||
receiver_email,
|
||||
message,
|
||||
}
|
||||
}
|
||||
}
|
0
src/feature/post.rs
Normal file
0
src/feature/post.rs
Normal file
37
src/feature/user.rs
Normal file
37
src/feature/user.rs
Normal file
|
@ -0,0 +1,37 @@
|
|||
use chrono::NaiveDate;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Contact {
|
||||
pub email: String,
|
||||
pub phone: String,
|
||||
pub website: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum Role {
|
||||
User,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct User {
|
||||
pub name: Vec<String>,
|
||||
pub surname: Vec<String>,
|
||||
pub gender: bool,
|
||||
pub birth_date: NaiveDate,
|
||||
pub email: String,
|
||||
pub role: Role,
|
||||
}
|
||||
|
||||
impl User {
|
||||
pub async fn new(name: Vec<String>, surname: Vec<String>, gender: bool, birth_date: NaiveDate, email: String) -> Self {
|
||||
Self {
|
||||
name,
|
||||
surname,
|
||||
gender,
|
||||
birth_date,
|
||||
email,
|
||||
role: Role::User,
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue