use anyhow::Result;
use sqlx::PgPool;
use crate::domain::entity::Sms;
pub const TABLE_NAME: &str = "messaging.sms";
pub struct SmsRepository(
backbone_orm::GenericCrudRepository<Sms, backbone_orm::SoftDelete>,
);
impl std::ops::Deref for SmsRepository {
type Target = backbone_orm::GenericCrudRepository<Sms, backbone_orm::SoftDelete>;
fn deref(&self) -> &Self::Target { &self.0 }
}
impl SmsRepository {
pub fn new(pool: PgPool) -> Self {
Self(backbone_orm::GenericCrudRepository::new(pool, TABLE_NAME))
}
}
impl SmsRepository {
pub async fn find_by_uuid(&self, uuid: &str) -> Result<Option<Sms>> {
self.find_by_text_field("uuid", uuid).await
}
pub async fn exists_by_uuid(&self, uuid: &str) -> Result<bool> {
self.exists_by_text_field("uuid", uuid).await
}
}
backbone_core::impl_crud_repository!(SmsRepository, Sms, soft_delete);