type InsertForm = CommentReplyInsertForm;
type UpdateForm = CommentReplyUpdateForm;
type IdType = CommentReplyId;
- async fn read(pool: &DbPool, comment_reply_id: CommentReplyId) -> Result<Self, Error> {
+ async fn read(pool: &mut DbPool<'_>, comment_reply_id: CommentReplyId) -> Result<Self, Error> {
let conn = &mut get_conn(pool).await?;
comment_reply
.find(comment_reply_id)
.await
}
- async fn create(pool: &DbPool, comment_reply_form: &Self::InsertForm) -> Result<Self, Error> {
+ async fn create(
+ pool: &mut DbPool<'_>,
+ comment_reply_form: &Self::InsertForm,
+ ) -> Result<Self, Error> {
let conn = &mut get_conn(pool).await?;
// since the return here isnt utilized, we dont need to do an update
}
async fn update(
- pool: &DbPool,
+ pool: &mut DbPool<'_>,
comment_reply_id: CommentReplyId,
comment_reply_form: &Self::UpdateForm,
) -> Result<Self, Error> {
impl CommentReply {
pub async fn mark_all_as_read(
- pool: &DbPool,
+ pool: &mut DbPool<'_>,
for_recipient_id: PersonId,
) -> Result<Vec<CommentReply>, Error> {
let conn = &mut get_conn(pool).await?;
.await
}
- pub async fn read_by_comment(pool: &DbPool, for_comment_id: CommentId) -> Result<Self, Error> {
+ pub async fn read_by_comment(
+ pool: &mut DbPool<'_>,
+ for_comment_id: CommentId,
+ ) -> Result<Self, Error> {
let conn = &mut get_conn(pool).await?;
comment_reply
.filter(comment_id.eq(for_comment_id))
#[cfg(test)]
mod tests {
+ #![allow(clippy::unwrap_used)]
+ #![allow(clippy::indexing_slicing)]
+
use crate::{
source::{
comment::{Comment, CommentInsertForm},
#[serial]
async fn test_crud() {
let pool = &build_db_pool_for_tests().await;
+ let pool = &mut pool.into();
- let inserted_instance = Instance::create(pool, "my_domain.tld").await.unwrap();
+ let inserted_instance = Instance::read_or_create(pool, "my_domain.tld".to_string())
+ .await
+ .unwrap();
let new_person = PersonInsertForm::builder()
.name("terrylake".into())