ordabok/src/db/models/users.rs

28 lines
575 B
Rust
Raw Normal View History

2023-01-03 15:11:43 +00:00
use diesel::prelude::*;
use super::super::schema::{userfollows, users};
#[derive(Queryable, Insertable, Debug, Clone, PartialEq, Eq)]
pub struct User {
pub id: String,
pub username: String,
}
2023-01-04 18:31:52 +00:00
#[juniper::graphql_object]
impl User {
pub fn id(&self) -> &str {
self.id.as_str()
}
pub fn username(&self) -> &str {
self.username.as_str()
}
}
2023-01-03 15:11:43 +00:00
#[derive(Queryable, Insertable, Debug, Clone, PartialEq, Eq)]
#[diesel(table_name = userfollows)]
pub struct UserFollow {
pub id: i32,
pub follower: String,
pub following: String,
}