user database operations

This commit is contained in:
Ahmet Kaan GÜMÜŞ 2024-12-01 22:17:38 +03:00
parent 085f8baee0
commit 36c72cee4a
11 changed files with 110 additions and 5 deletions

View 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
View 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
View file

37
src/feature/user.rs Normal file
View 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,
}
}
}