Remove dead code #81

Merged
dessalines merged 7 commits from remove-dead-code into main 2020-08-12 12:30:54 +00:00
4 changed files with 11 additions and 8 deletions
Showing only changes of commit afdbed30e5 - Show all commits

View File

@ -55,8 +55,9 @@ impl Crud<CommentForm> for Comment {
comment.find(comment_id).first::<Self>(conn) comment.find(comment_id).first::<Self>(conn)
} }
fn delete(_conn: &PgConnection, _comment_id: i32) -> Result<usize, Error> { fn delete(conn: &PgConnection, comment_id: i32) -> Result<usize, Error> {
unimplemented!() use crate::schema::comment::dsl::*;
diesel::delete(comment.find(comment_id)).execute(conn)
} }
dessalines marked this conversation as resolved
Review

Comment, post, user and community deletes shouldn't be removed, bc we will use them once we implement purge. (I think one of the chapo team was maybe working on it)

Comment, post, user and community deletes shouldn't be removed, bc we will use them once we implement purge. (I think one of the chapo team was maybe working on it)
Review

Okay, restored them.

Okay, restored them.
fn create(conn: &PgConnection, comment_form: &CommentForm) -> Result<Self, Error> { fn create(conn: &PgConnection, comment_form: &CommentForm) -> Result<Self, Error> {

View File

@ -60,8 +60,9 @@ impl Crud<CommunityForm> for Community {
community.find(community_id).first::<Self>(conn) community.find(community_id).first::<Self>(conn)
} }
fn delete(_conn: &PgConnection, _community_id: i32) -> Result<usize, Error> { fn delete(conn: &PgConnection, community_id: i32) -> Result<usize, Error> {
unimplemented!() use crate::schema::community::dsl::*;
diesel::delete(community.find(community_id)).execute(conn)
} }
fn create(conn: &PgConnection, new_community: &CommunityForm) -> Result<Self, Error> { fn create(conn: &PgConnection, new_community: &CommunityForm) -> Result<Self, Error> {

View File

@ -162,8 +162,9 @@ impl Crud<PostForm> for Post {
post.find(post_id).first::<Self>(conn) post.find(post_id).first::<Self>(conn)
} }
fn delete(_conn: &PgConnection, _post_id: i32) -> Result<usize, Error> { fn delete(conn: &PgConnection, post_id: i32) -> Result<usize, Error> {
unimplemented!() use crate::schema::post::dsl::*;
diesel::delete(post.find(post_id)).execute(conn)
} }
fn create(conn: &PgConnection, new_post: &PostForm) -> Result<Self, Error> { fn create(conn: &PgConnection, new_post: &PostForm) -> Result<Self, Error> {

View File

@ -70,8 +70,8 @@ impl Crud<UserForm> for User_ {
fn read(conn: &PgConnection, user_id: i32) -> Result<Self, Error> { fn read(conn: &PgConnection, user_id: i32) -> Result<Self, Error> {
user_.find(user_id).first::<Self>(conn) user_.find(user_id).first::<Self>(conn)
} }
fn delete(_conn: &PgConnection, _user_id: i32) -> Result<usize, Error> { fn delete(conn: &PgConnection, user_id: i32) -> Result<usize, Error> {
unimplemented!() diesel::delete(user_.find(user_id)).execute(conn)
} }
fn create(conn: &PgConnection, form: &UserForm) -> Result<Self, Error> { fn create(conn: &PgConnection, form: &UserForm) -> Result<Self, Error> {
insert_into(user_).values(form).get_result::<Self>(conn) insert_into(user_).values(form).get_result::<Self>(conn)