3 schema::tagline::dsl::*,
5 utils::{get_conn, DbPool},
7 use diesel::{insert_into, result::Error, ExpressionMethods, QueryDsl};
8 use diesel_async::{AsyncPgConnection, RunQueryDsl};
13 for_local_site_id: LocalSiteId,
14 list_content: Option<Vec<String>>,
15 ) -> Result<(), Error> {
16 if let Some(list) = list_content {
17 let conn = &mut get_conn(pool).await?;
22 Self::clear(conn).await?;
25 let form = TaglineForm {
26 local_site_id: for_local_site_id,
32 .get_result::<Self>(conn)
44 async fn clear(conn: &mut AsyncPgConnection) -> Result<usize, Error> {
45 diesel::delete(tagline).execute(conn).await
47 pub async fn get_all(pool: &DbPool, for_local_site_id: LocalSiteId) -> Result<Vec<Self>, Error> {
48 use crate::schema::tagline::dsl::*;
49 let conn = &mut get_conn(pool).await?;
51 .filter(local_site_id.eq(for_local_site_id))
52 .get_results::<Self>(conn)