summaryrefslogtreecommitdiffstats
path: root/server/src/db
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/db')
-rw-r--r--server/src/db/category.rs4
-rw-r--r--server/src/db/comment.rs22
-rw-r--r--server/src/db/community.rs32
-rw-r--r--server/src/db/mod.rs2
-rw-r--r--server/src/db/moderator.rs66
-rw-r--r--server/src/db/post.rs24
-rw-r--r--server/src/db/user.rs8
7 files changed, 79 insertions, 79 deletions
diff --git a/server/src/db/category.rs b/server/src/db/category.rs
index 99f906d4..eb822580 100644
--- a/server/src/db/category.rs
+++ b/server/src/db/category.rs
@@ -1,5 +1,5 @@
-use schema::{category};
-use schema::category::dsl::*;
+use crate::schema::{category};
+use crate::schema::category::dsl::*;
use super::*;
#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
diff --git a/server/src/db/comment.rs b/server/src/db/comment.rs
index a924bd4c..d125124c 100644
--- a/server/src/db/comment.rs
+++ b/server/src/db/comment.rs
@@ -1,4 +1,4 @@
-use schema::{comment, comment_like, comment_saved};
+use crate::schema::{comment, comment_like, comment_saved};
use super::*;
use super::post::Post;
@@ -40,26 +40,26 @@ pub struct CommentForm {
impl Crud<CommentForm> for Comment {
fn read(conn: &PgConnection, comment_id: i32) -> Result<Self, Error> {
- use schema::comment::dsl::*;
+ use crate::schema::comment::dsl::*;
comment.find(comment_id)
.first::<Self>(conn)
}
fn delete(conn: &PgConnection, comment_id: i32) -> Result<usize, Error> {
- use schema::comment::dsl::*;
+ use crate::schema::comment::dsl::*;
diesel::delete(comment.find(comment_id))
.execute(conn)
}
fn create(conn: &PgConnection, comment_form: &CommentForm) -> Result<Self, Error> {
- use schema::comment::dsl::*;
+ use crate::schema::comment::dsl::*;
insert_into(comment)
.values(comment_form)
.get_result::<Self>(conn)
}
fn update(conn: &PgConnection, comment_id: i32, comment_form: &CommentForm) -> Result<Self, Error> {
- use schema::comment::dsl::*;
+ use crate::schema::comment::dsl::*;
diesel::update(comment.find(comment_id))
.set(comment_form)
.get_result::<Self>(conn)
@@ -89,20 +89,20 @@ pub struct CommentLikeForm {
impl Likeable <CommentLikeForm> for CommentLike {
fn read(conn: &PgConnection, comment_id_from: i32) -> Result<Vec<Self>, Error> {
- use schema::comment_like::dsl::*;
+ use crate::schema::comment_like::dsl::*;
comment_like
.filter(comment_id.eq(comment_id_from))
.load::<Self>(conn)
}
fn like(conn: &PgConnection, comment_like_form: &CommentLikeForm) -> Result<Self, Error> {
- use schema::comment_like::dsl::*;
+ use crate::schema::comment_like::dsl::*;
insert_into(comment_like)
.values(comment_like_form)
.get_result::<Self>(conn)
}
fn remove(conn: &PgConnection, comment_like_form: &CommentLikeForm) -> Result<usize, Error> {
- use schema::comment_like::dsl::*;
+ use crate::schema::comment_like::dsl::*;
diesel::delete(comment_like
.filter(comment_id.eq(comment_like_form.comment_id))
.filter(user_id.eq(comment_like_form.user_id)))
@@ -112,7 +112,7 @@ impl Likeable <CommentLikeForm> for CommentLike {
impl CommentLike {
pub fn from_post(conn: &PgConnection, post_id_from: i32) -> Result<Vec<Self>, Error> {
- use schema::comment_like::dsl::*;
+ use crate::schema::comment_like::dsl::*;
comment_like
.filter(post_id.eq(post_id_from))
.load::<Self>(conn)
@@ -138,13 +138,13 @@ pub struct CommentSavedForm {
impl Saveable <CommentSavedForm> for CommentSaved {
fn save(conn: &PgConnection, comment_saved_form: &CommentSavedForm) -> Result<Self, Error> {
- use schema::comment_saved::dsl::*;
+ use crate::schema::comment_saved::dsl::*;
insert_into(comment_saved)
.values(comment_saved_form)
.get_result::<Self>(conn)
}
fn unsave(conn: &PgConnection, comment_saved_form: &CommentSavedForm) -> Result<usize, Error> {
- use schema::comment_saved::dsl::*;
+ use crate::schema::comment_saved::dsl::*;
diesel::delete(comment_saved
.filter(comment_id.eq(comment_saved_form.comment_id))
.filter(user_id.eq(comment_saved_form.user_id)))
diff --git a/server/src/db/community.rs b/server/src/db/community.rs
index 4540f731..b32230b9 100644
--- a/server/src/db/community.rs
+++ b/server/src/db/community.rs
@@ -1,4 +1,4 @@
-use schema::{community, community_moderator, community_follower, community_user_ban, site};
+use crate::schema::{community, community_moderator, community_follower, community_user_ban, site};
use super::*;
#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
@@ -31,26 +31,26 @@ pub struct CommunityForm {
impl Crud<CommunityForm> for Community {
fn read(conn: &PgConnection, community_id: i32) -> Result<Self, Error> {
- use schema::community::dsl::*;
+ use crate::schema::community::dsl::*;
community.find(community_id)
.first::<Self>(conn)
}
fn delete(conn: &PgConnection, community_id: i32) -> Result<usize, Error> {
- use schema::community::dsl::*;
+ use crate::schema::community::dsl::*;
diesel::delete(community.find(community_id))
.execute(conn)
}
fn create(conn: &PgConnection, new_community: &CommunityForm) -> Result<Self, Error> {
- use schema::community::dsl::*;
+ use crate::schema::community::dsl::*;
insert_into(community)
.values(new_community)
.get_result::<Self>(conn)
}
fn update(conn: &PgConnection, community_id: i32, new_community: &CommunityForm) -> Result<Self, Error> {
- use schema::community::dsl::*;
+ use crate::schema::community::dsl::*;
diesel::update(community.find(community_id))
.set(new_community)
.get_result::<Self>(conn)
@@ -59,7 +59,7 @@ impl Crud<CommunityForm> for Community {
impl Community {
pub fn read_from_name(conn: &PgConnection, community_name: String) -> Result<Self, Error> {
- use schema::community::dsl::*;
+ use crate::schema::community::dsl::*;
community.filter(name.eq(community_name))
.first::<Self>(conn)
}
@@ -84,14 +84,14 @@ pub struct CommunityModeratorForm {
impl Joinable<CommunityModeratorForm> for CommunityModerator {
fn join(conn: &PgConnection, community_user_form: &CommunityModeratorForm) -> Result<Self, Error> {
- use schema::community_moderator::dsl::*;
+ use crate::schema::community_moderator::dsl::*;
insert_into(community_moderator)
.values(community_user_form)
.get_result::<Self>(conn)
}
fn leave(conn: &PgConnection, community_user_form: &CommunityModeratorForm) -> Result<usize, Error> {
- use schema::community_moderator::dsl::*;
+ use crate::schema::community_moderator::dsl::*;
diesel::delete(community_moderator
.filter(community_id.eq(community_user_form.community_id))
.filter(user_id.eq(community_user_form.user_id)))
@@ -118,14 +118,14 @@ pub struct CommunityUserBanForm {
impl Bannable<CommunityUserBanForm> for CommunityUserBan {
fn ban(conn: &PgConnection, community_user_ban_form: &CommunityUserBanForm) -> Result<Self, Error> {
- use schema::community_user_ban::dsl::*;
+ use crate::schema::community_user_ban::dsl::*;
insert_into(community_user_ban)
.values(community_user_ban_form)
.get_result::<Self>(conn)
}
fn unban(conn: &PgConnection, community_user_ban_form: &CommunityUserBanForm) -> Result<usize, Error> {
- use schema::community_user_ban::dsl::*;
+ use crate::schema::community_user_ban::dsl::*;
diesel::delete(community_user_ban
.filter(community_id.eq(community_user_ban_form.community_id))
.filter(user_id.eq(community_user_ban_form.user_id)))
@@ -152,13 +152,13 @@ pub struct CommunityFollowerForm {
impl Followable<CommunityFollowerForm> for CommunityFollower {
fn follow(conn: &PgConnection, community_follower_form: &CommunityFollowerForm) -> Result<Self, Error> {
- use schema::community_follower::dsl::*;
+ use crate::schema::community_follower::dsl::*;
insert_into(community_follower)
.values(community_follower_form)
.get_result::<Self>(conn)
}
fn ignore(conn: &PgConnection, community_follower_form: &CommunityFollowerForm) -> Result<usize, Error> {
- use schema::community_follower::dsl::*;
+ use crate::schema::community_follower::dsl::*;
diesel::delete(community_follower
.filter(community_id.eq(&community_follower_form.community_id))
.filter(user_id.eq(&community_follower_form.user_id)))
@@ -188,25 +188,25 @@ pub struct SiteForm {
impl Crud<SiteForm> for Site {
fn read(conn: &PgConnection, _site_id: i32) -> Result<Self, Error> {
- use schema::site::dsl::*;
+ use crate::schema::site::dsl::*;
site.first::<Self>(conn)
}
fn delete(conn: &PgConnection, site_id: i32) -> Result<usize, Error> {
- use schema::site::dsl::*;
+ use crate::schema::site::dsl::*;
diesel::delete(site.find(site_id))
.execute(conn)
}
fn create(conn: &PgConnection, new_site: &SiteForm) -> Result<Self, Error> {
- use schema::site::dsl::*;
+ use crate::schema::site::dsl::*;
insert_into(site)
.values(new_site)
.get_result::<Self>(conn)
}
fn update(conn: &PgConnection, site_id: i32, new_site: &SiteForm) -> Result<Self, Error> {
- use schema::site::dsl::*;
+ use crate::schema::site::dsl::*;
diesel::update(site.find(site_id))
.set(new_site)
.get_result::<Self>(conn)
diff --git a/server/src/db/mod.rs b/server/src/db/mod.rs
index c3587c47..e0b7c856 100644
--- a/server/src/db/mod.rs
+++ b/server/src/db/mod.rs
@@ -1,7 +1,7 @@
use diesel::*;
use diesel::dsl::*;
use diesel::result::Error;
-use {Settings};
+use crate::{Settings};
use serde::{Deserialize, Serialize};
pub mod user;
diff --git a/server/src/db/moderator.rs b/server/src/db/moderator.rs
index 8b85e663..56cf2f47 100644
--- a/server/src/db/moderator.rs
+++ b/server/src/db/moderator.rs
@@ -1,4 +1,4 @@
-use schema::{mod_remove_post, mod_lock_post, mod_remove_comment, mod_remove_community, mod_ban_from_community, mod_ban, mod_add_community, mod_add};
+use crate::schema::{mod_remove_post, mod_lock_post, mod_remove_comment, mod_remove_community, mod_ban_from_community, mod_ban, mod_add_community, mod_add};
use super::*;
#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
@@ -23,26 +23,26 @@ pub struct ModRemovePostForm {
impl Crud<ModRemovePostForm> for ModRemovePost {
fn read(conn: &PgConnection, from_id: i32) -> Result<Self, Error> {
- use schema::mod_remove_post::dsl::*;
+ use crate::schema::mod_remove_post::dsl::*;
mod_remove_post.find(from_id)
.first::<Self>(conn)
}
fn delete(conn: &PgConnection, from_id: i32) -> Result<usize, Error> {
- use schema::mod_remove_post::dsl::*;
+ use crate::schema::mod_remove_post::dsl::*;
diesel::delete(mod_remove_post.find(from_id))
.execute(conn)
}
fn create(conn: &PgConnection, form: &ModRemovePostForm) -> Result<Self, Error> {
- use schema::mod_remove_post::dsl::*;
+ use crate::schema::mod_remove_post::dsl::*;
insert_into(mod_remove_post)
.values(form)
.get_result::<Self>(conn)
}
fn update(conn: &PgConnection, from_id: i32, form: &ModRemovePostForm) -> Result<Self, Error> {
- use schema::mod_remove_post::dsl::*;
+ use crate::schema::mod_remove_post::dsl::*;
diesel::update(mod_remove_post.find(from_id))
.set(form)
.get_result::<Self>(conn)
@@ -71,26 +71,26 @@ pub struct ModLockPostForm {
impl Crud<ModLockPostForm> for ModLockPost {
fn read(conn: &PgConnection, from_id: i32) -> Result<Self, Error> {
- use schema::mod_lock_post::dsl::*;
+ use crate::schema::mod_lock_post::dsl::*;
mod_lock_post.find(from_id)
.first::<Self>(conn)
}
fn delete(conn: &PgConnection, from_id: i32) -> Result<usize, Error> {
- use schema::mod_lock_post::dsl::*;
+ use crate::schema::mod_lock_post::dsl::*;
diesel::delete(mod_lock_post.find(from_id))
.execute(conn)
}
fn create(conn: &PgConnection, form: &ModLockPostForm) -> Result<Self, Error> {
- use schema::mod_lock_post::dsl::*;
+ use crate::schema::mod_lock_post::dsl::*;
insert_into(mod_lock_post)
.values(form)
.get_result::<Self>(conn)
}
fn update(conn: &PgConnection, from_id: i32, form: &ModLockPostForm) -> Result<Self, Error> {
- use schema::mod_lock_post::dsl::*;
+ use crate::schema::mod_lock_post::dsl::*;
diesel::update(mod_lock_post.find(from_id))
.set(form)
.get_result::<Self>(conn)
@@ -119,26 +119,26 @@ pub struct ModRemoveCommentForm {
impl Crud<ModRemoveCommentForm> for ModRemoveComment {
fn read(conn: &PgConnection, from_id: i32) -> Result<Self, Error> {
- use schema::mod_remove_comment::dsl::*;
+ use crate::schema::mod_remove_comment::dsl::*;
mod_remove_comment.find(from_id)
.first::<Self>(conn)
}
fn delete(conn: &PgConnection, from_id: i32) -> Result<usize, Error> {
- use schema::mod_remove_comment::dsl::*;
+ use crate::schema::mod_remove_comment::dsl::*;
diesel::delete(mod_remove_comment.find(from_id))
.execute(conn)
}
fn create(conn: &PgConnection, form: &ModRemoveCommentForm) -> Result<Self, Error> {
- use schema::mod_remove_comment::dsl::*;
+ use crate::schema::mod_remove_comment::dsl::*;
insert_into(mod_remove_comment)
.values(form)
.get_result::<Self>(conn)
}
fn update(conn: &PgConnection, from_id: i32, form: &ModRemoveCommentForm) -> Result<Self, Error> {
- use schema::mod_remove_comment::dsl::*;
+ use crate::schema::mod_remove_comment::dsl::*;
diesel::update(mod_remove_comment.find(from_id))
.set(form)
.get_result::<Self>(conn)
@@ -169,26 +169,26 @@ pub struct ModRemoveCommunityForm {
impl Crud<ModRemoveCommunityForm> for ModRemoveCommunity {
fn read(conn: &PgConnection, from_id: i32) -> Result<Self, Error> {
- use schema::mod_remove_community::dsl::*;
+ use crate::schema::mod_remove_community::dsl::*;
mod_remove_community.find(from_id)
.first::<Self>(conn)
}
fn delete(conn: &PgConnection, from_id: i32) -> Result<usize, Error> {
- use schema::mod_remove_community::dsl::*;
+ use crate::schema::mod_remove_community::dsl::*;
diesel::delete(mod_remove_community.find(from_id))
.execute(conn)
}
fn create(conn: &PgConnection, form: &ModRemoveCommunityForm) -> Result<Self, Error> {
- use schema::mod_remove_community::dsl::*;
+ use crate::schema::mod_remove_community::dsl::*;
insert_into(mod_remove_community)
.values(form)
.get_result::<Self>(conn)
}
fn update(conn: &PgConnection, from_id: i32, form: &ModRemoveCommunityForm) -> Result<Self, Error> {
- use schema::mod_remove_community::dsl::*;
+ use crate::schema::mod_remove_community::dsl::*;
diesel::update(mod_remove_community.find(from_id))
.set(form)
.get_result::<Self>(conn)
@@ -221,26 +221,26 @@ pub struct ModBanFromCommunityForm {
impl Crud<ModBanFromCommunityForm> for ModBanFromCommunity {
fn read(conn: &PgConnection, from_id: i32) -> Result<Self, Error> {
- use schema::mod_ban_from_community::dsl::*;
+ use crate::schema::mod_ban_from_community::dsl::*;
mod_ban_from_community.find(from_id)
.first::<Self>(conn)
}
fn delete(conn: &PgConnection, from_id: i32) -> Result<usize, Error> {
- use schema::mod_ban_from_community::dsl::*;
+ use crate::schema::mod_ban_from_community::dsl::*;
diesel::delete(mod_ban_from_community.find(from_id))
.execute(conn)
}
fn create(conn: &PgConnection, form: &ModBanFromCommunityForm) -> Result<Self, Error> {
- use schema::mod_ban_from_community::dsl::*;
+ use crate::schema::mod_ban_from_community::dsl::*;
insert_into(mod_ban_from_community)
.values(form)
.get_result::<Self>(conn)
}
fn update(conn: &PgConnection, from_id: i32, form: &ModBanFromCommunityForm) -> Result<Self, Error> {
- use schema::mod_ban_from_community::dsl::*;
+ use crate::schema::mod_ban_from_community::dsl::*;
diesel::update(mod_ban_from_community.find(from_id))
.set(form)
.get_result::<Self>(conn)
@@ -272,26 +272,26 @@ pub struct ModBanForm {
impl Crud<ModBanForm> for ModBan {
fn read(conn: &PgConnection, from_id: i32) -> Result<Self, Error> {
- use schema::mod_ban::dsl::*;
+ use crate::schema::mod_ban::dsl::*;
mod_ban.find(from_id)
.first::<Self>(conn)
}
fn delete(conn: &PgConnection, from_id: i32) -> Result<usize, Error> {
- use schema::mod_ban::dsl::*;
+ use crate::schema::mod_ban::dsl::*;
diesel::delete(mod_ban.find(from_id))
.execute(conn)
}
fn create(conn: &PgConnection, form: &ModBanForm) -> Result<Self, Error> {
- use schema::mod_ban::dsl::*;
+ use crate::schema::mod_ban::dsl::*;
insert_into(mod_ban)
.values(form)
.get_result::<Self>(conn)
}
fn update(conn: &PgConnection, from_id: i32, form: &ModBanForm) -> Result<Self, Error> {
- use schema::mod_ban::dsl::*;
+ use crate::schema::mod_ban::dsl::*;
diesel::update(mod_ban.find(from_id))
.set(form)
.get_result::<Self>(conn)
@@ -320,26 +320,26 @@ pub struct ModAddCommunityForm {
impl Crud<ModAddCommunityForm> for ModAddCommunity {
fn read(conn: &PgConnection, from_id: i32) -> Result<Self, Error> {
- use schema::mod_add_community::dsl::*;
+ use crate::schema::mod_add_community::dsl::*;
mod_add_community.find(from_id)
.first::<Self>(conn)
}
fn delete(conn: &PgConnection, from_id: i32) -> Result<usize, Error> {
- use schema::mod_add_community::dsl::*;
+ use crate::schema::mod_add_community::dsl::*;
diesel::delete(mod_add_community.find(from_id))
.execute(conn)
}
fn create(conn: &PgConnection, form: &ModAddCommunityForm) -> Result<Self, Error> {
- use schema::mod_add_community::dsl::*;
+ use crate::schema::mod_add_community::dsl::*;
insert_into(mod_add_community)
.values(form)
.get_result::<Self>(conn)
}
fn update(conn: &PgConnection, from_id: i32, form: &ModAddCommunityForm) -> Result<Self, Error> {
- use schema::mod_add_community::dsl::*;
+ use crate::schema::mod_add_community::dsl::*;
diesel::update(mod_add_community.find(from_id))
.set(form)
.get_result::<Self>(conn)
@@ -366,26 +366,26 @@ pub struct ModAddForm {
impl Crud<ModAddForm> for ModAdd {
fn read(conn: &PgConnection, from_id: i32) -> Result<Self, Error> {
- use schema::mod_add::dsl::*;
+ use crate::schema::mod_add::dsl::*;
mod_add.find(from_id)
.first::<Self>(conn)
}
fn delete(conn: &PgConnection, from_id: i32) -> Result<usize, Error> {
- use schema::mod_add::dsl::*;
+ use crate::schema::mod_add::dsl::*;
diesel::delete(mod_add.find(from_id))
.execute(conn)
}
fn create(conn: &PgConnection, form: &ModAddForm) -> Result<Self, Error> {
- use schema::mod_add::dsl::*;
+ use crate::schema::mod_add::dsl::*;
insert_into(mod_add)
.values(form)
.get_result::<Self>(conn)
}
fn update(conn: &PgConnection, from_id: i32, form: &ModAddForm) -> Result<Self, Error> {
- use schema::mod_add::dsl::*;
+ use crate::schema::mod_add::dsl::*;
diesel::update(mod_add.find(from_id))
.set(form)
.get_result::<Self>(conn)
diff --git a/server/src/db/post.rs b/server/src/db/post.rs
index f0302271..d8fd27b0 100644
--- a/server/src/db/post.rs
+++ b/server/src/db/post.rs
@@ -1,4 +1,4 @@
-use schema::{post, post_like, post_saved, post_read};
+use crate::schema::{post, post_like, post_saved, post_read};
use super::*;
#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
@@ -33,26 +33,26 @@ pub struct PostForm {
impl Crud<PostForm> for Post {
fn read(conn: &PgConnection, post_id: i32) -> Result<Self, Error> {
- use schema::post::dsl::*;
+ use crate::schema::post::dsl::*;
post.find(post_id)
.first::<Self>(conn)
}
fn delete(conn: &PgConnection, post_id: i32) -> Result<usize, Error> {
- use schema::post::dsl::*;
+ use crate::schema::post::dsl::*;
diesel::delete(post.find(post_id))
.execute(conn)
}
fn create(conn: &PgConnection, new_post: &PostForm) -> Result<Self, Error> {
- use schema::post::dsl::*;
+ use crate::schema::post::dsl::*;
insert_into(post)
.values(new_post)
.get_result::<Self>(conn)
}
fn update(conn: &PgConnection, post_id: i32, new_post: &PostForm) -> Result<Self, Error> {
- use schema::post::dsl::*;
+ use crate::schema::post::dsl::*;
diesel::update(post.find(post_id))
.set(new_post)
.get_result::<Self>(conn)
@@ -80,19 +80,19 @@ pub struct PostLikeForm {
impl Likeable <PostLikeForm> for PostLike {
fn read(conn: &PgConnection, post_id_from: i32) -> Result<Vec<Self>, Error> {
- use schema::post_like::dsl::*;
+ use crate::schema::post_like::dsl::*;
post_like
.filter(post_id.eq(post_id_from))
.load::<Self>(conn)
}
fn like(conn: &PgConnection, post_like_form: &PostLikeForm) -> Result<Self, Error> {
- use schema::post_like::dsl::*;
+ use crate::schema::post_like::dsl::*;
insert_into(post_like)
.values(post_like_form)
.get_result::<Self>(conn)
}
fn remove(conn: &PgConnection, post_like_form: &PostLikeForm) -> Result<usize, Error> {
- use schema::post_like::dsl::*;
+ use crate::schema::post_like::dsl::*;
diesel::delete(post_like
.filter(post_id.eq(post_like_form.post_id))
.filter(user_id.eq(post_like_form.user_id)))
@@ -119,13 +119,13 @@ pub struct PostSavedForm {
impl Saveable <PostSavedForm> for PostSaved {
fn save(conn: &PgConnection, post_saved_form: &PostSavedForm) -> Result<Self, Error> {
- use schema::post_saved::dsl::*;
+ use crate::schema::post_saved::dsl::*;
insert_into(post_saved)
.values(post_saved_form)
.get_result::<Self>(conn)
}
fn unsave(conn: &PgConnection, post_saved_form: &PostSavedForm) -> Result<usize, Error> {
- use schema::post_saved::dsl::*;
+ use crate::schema::post_saved::dsl::*;
diesel::delete(post_saved
.filter(post_id.eq(post_saved_form.post_id))
.filter(user_id.eq(post_saved_form.user_id)))
@@ -152,13 +152,13 @@ pub struct PostReadForm {
impl Readable <PostReadForm> for PostRead {
fn mark_as_read(conn: &PgConnection, post_read_form: &PostReadForm) -> Result<Self, Error> {
- use schema::post_read::dsl::*;
+ use crate::schema::post_read::dsl::*;
insert_into(post_read)
.values(post_read_form)
.get_result::<Self>(conn)
}
fn mark_as_unread(conn: &PgConnection, post_read_form: &PostReadForm) -> Result<usize, Error> {
- use schema::post_read::dsl::*;
+ use crate::schema::post_read::dsl::*;
diesel::delete(post_read
.filter(post_id.eq(post_read_form.post_id))
.filter(user_id.eq(post_read_form.user_id)))
diff --git a/server/src/db/user.rs b/server/src/db/user.rs
index a4a7be43..aed5e890 100644
--- a/server/src/db/user.rs
+++ b/server/src/db/user.rs
@@ -1,7 +1,7 @@
-use schema::user_;
-use schema::user_::dsl::*;
+use crate::schema::user_;
+use crate::schema::user_::dsl::*;
use super::*;
-use {Settings, is_email_regex};
+use crate::{Settings, is_email_regex};
use jsonwebtoken::{encode, decode, Header, Validation, TokenData};
use bcrypt::{DEFAULT_COST, hash};
@@ -36,7 +36,7 @@ pub struct UserForm {
impl Crud<UserForm> for User_ {
fn read(conn: &PgConnection, user_id: i32) -> Result<Self, Error> {
- use schema::user_::dsl::*;
+ use crate::schema::user_::dsl::*;
user_.find(user_id)
.first::<Self>(conn)
}