feat: error when starting BAL if user already has an ongoing one
All checks were successful
/ test (push) Successful in 15m24s

This commit is contained in:
Ninjdai 2025-08-11 17:26:08 +02:00
parent c667608fbb
commit ffa19712bd
2 changed files with 9 additions and 0 deletions

View file

@ -25,6 +25,11 @@ pub enum BalState {
Ended
}
pub async fn get_user_ongoing_bal<C>(db_conn: &C, user_id: u32) -> Option<Model>
where C: ConnectionTrait {
Entity::find().filter(Column::UserId.eq(user_id)).filter(Column::State.eq(BalState::Ongoing)).one(db_conn).await.unwrap_or(None)
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::book_instance::Entity")]