Remove dead code #81
|
@ -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
|
|||||||
|
|
||||||
fn create(conn: &PgConnection, comment_form: &CommentForm) -> Result<Self, Error> {
|
fn create(conn: &PgConnection, comment_form: &CommentForm) -> Result<Self, Error> {
|
||||||
|
|
|
@ -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> {
|
||||||
|
|
|
@ -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> {
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue
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)
Okay, restored them.