use diesel_async::RunQueryDsl;
impl CustomEmoji {
- pub async fn create(pool: &DbPool, form: &CustomEmojiInsertForm) -> Result<Self, Error> {
+ pub async fn create(pool: &mut DbPool<'_>, form: &CustomEmojiInsertForm) -> Result<Self, Error> {
let conn = &mut get_conn(pool).await?;
insert_into(custom_emoji)
.values(form)
.await
}
pub async fn update(
- pool: &DbPool,
+ pool: &mut DbPool<'_>,
emoji_id: CustomEmojiId,
form: &CustomEmojiUpdateForm,
) -> Result<Self, Error> {
.get_result::<Self>(conn)
.await
}
- pub async fn delete(pool: &DbPool, emoji_id: CustomEmojiId) -> Result<usize, Error> {
+ pub async fn delete(pool: &mut DbPool<'_>, emoji_id: CustomEmojiId) -> Result<usize, Error> {
let conn = &mut get_conn(pool).await?;
diesel::delete(custom_emoji.find(emoji_id))
.execute(conn)
impl CustomEmojiKeyword {
pub async fn create(
- pool: &DbPool,
+ pool: &mut DbPool<'_>,
form: Vec<CustomEmojiKeywordInsertForm>,
) -> Result<Vec<Self>, Error> {
let conn = &mut get_conn(pool).await?;
.get_results::<Self>(conn)
.await
}
- pub async fn delete(pool: &DbPool, emoji_id: CustomEmojiId) -> Result<usize, Error> {
+ pub async fn delete(pool: &mut DbPool<'_>, emoji_id: CustomEmojiId) -> Result<usize, Error> {
let conn = &mut get_conn(pool).await?;
diesel::delete(custom_emoji_keyword.filter(custom_emoji_id.eq(emoji_id)))
.execute(conn)