use diesel_async::RunQueryDsl;
impl PersonPostAggregates {
- pub async fn upsert(pool: &DbPool, form: &PersonPostAggregatesForm) -> Result<Self, Error> {
+ pub async fn upsert(
+ pool: &mut DbPool<'_>,
+ form: &PersonPostAggregatesForm,
+ ) -> Result<Self, Error> {
let conn = &mut get_conn(pool).await?;
insert_into(person_post_aggregates)
.values(form)
.get_result::<Self>(conn)
.await
}
- pub async fn read(pool: &DbPool, person_id_: PersonId, post_id_: PostId) -> Result<Self, Error> {
+ pub async fn read(
+ pool: &mut DbPool<'_>,
+ person_id_: PersonId,
+ post_id_: PostId,
+ ) -> Result<Self, Error> {
let conn = &mut get_conn(pool).await?;
person_post_aggregates
.filter(post_id.eq(post_id_).and(person_id.eq(person_id_)))