pub async fn delete_list(list_id: i32, user_id: i32, db: PostgresDbConn) -> ResponseWithStatus {
    db.run(move |conn| {
        if UserList::is_list_owner(list_id, user_id, conn) {
            if List::delete_list(list_id, conn) {
                ResponseWithStatus::with(Status::Ok.code, constants::MESSAGE_DELETE_LIST_SUCCESS)
            } else {
                ResponseWithStatus::with(Status::BadRequest.code, constants::MESSAGE_DELETE_LIST_FAILED)
            }
        } else {
            ResponseWithStatus::with(Status::BadRequest.code, constants::MESSAGE_DELETE_NOT_OWNER)
        }
    }).await
}
/// Attempts to delete the list with the given `list_id`. Makes sure that the user with `user_id`
/// owns the list before deleting it. Also, through cascading, deletes any `UserList` or `Item`s
/// related to the list.
Attempts to delete the list with the given `list_id`. Makes sure that the user with `user_id`
owns the list before deleting it. Also, through cascading, deletes any `UserList` or `Item`s
related to the list.
Attempts to delete the list with the given ` list_id ` . Makes sure that the user with ` user_id ` owns the list before deleting it . Also through cascading deletes any ` UserList ` or ` Item ` s related to the list .
pub async fn delete_list(list_id: i32, user_id: i32, db: PostgresDbConn) -> ResponseWithStatus {
    db.run(move |conn| {
        if UserList::is_list_owner(list_id, user_id, conn) {
            if List::delete_list(list_id, conn) {
                ResponseWithStatus::with(Status::Ok.code, constants::MESSAGE_DELETE_LIST_SUCCESS)
            } else {
                ResponseWithStatus::with(Status::BadRequest.code, constants::MESSAGE_DELETE_LIST_FAILED)
            }
        } else {
            ResponseWithStatus::with(Status::BadRequest.code, constants::MESSAGE_DELETE_NOT_OWNER)
        }
    }).await
}
pub async fn delete_list ( list_id : i32 , user_id : i32 , db : PostgresDbConn ) -> ResponseWithStatus { db . run ( move | conn | { if UserList :: is_list_owner ( list_id , user_id , conn ) { if List :: delete_list ( list_id , conn ) { ResponseWithStatus :: with ( Status :: Ok . code , constants :: MESSAGE_DELETE_LIST_SUCCESS ) } else { ResponseWithStatus :: with ( Status :: BadRequest . code , constants :: MESSAGE_DELETE_LIST_FAILED ) } } else { ResponseWithStatus :: with ( Status :: BadRequest . code , constants :: MESSAGE_DELETE_NOT_OWNER ) } } ) . await }
Attempts to delete the list with the given `list_id`.
Attempts to delete the list with the given ` list_id ` .
list_id
i32
user_id
i32
db
PostgresDbConn
list_id
i32
user_id
i32
db
PostgresDbConn