Re-point cross-lane calls after comms/misc merge (registration/event)
Browse files at this commit9d34c84bbc0404af59eb183c5c74c6ad7cf03b67Parent: 4ab90d9- chore
- re-point cross-lane calls after comms/misc merge (registration/event)
2 changed files +5 -6
- src/db/event.rs +2 -3
- src/service/registration.rs +3 -3
src/db/event.rsmodified+2 -3
| @@ -8,7 +8,6 @@ use crate::database::{Database, transaction_with_retry}; | |||
| 8 | use crate::db::field_update::FieldUpdate; | 8 | use crate::db::field_update::FieldUpdate; |
| 9 | use crate::domain::class_member::{ClassMember, ClassMemberId}; | 9 | use crate::domain::class_member::{ClassMember, ClassMemberId}; |
| 10 | use crate::domain::event::{Event, EventAudience, EventDescription, EventId, EventTitle}; | 10 | use crate::domain::event::{Event, EventAudience, EventDescription, EventId, EventTitle}; |
| 11 | -use crate::domain::registration::Registration; | ||
| 12 | use crate::domain::timestamp::{Timestamp, range_error}; | 11 | use crate::domain::timestamp::{Timestamp, range_error}; |
| 13 | use crate::domain::user::{User, UserId}; | 12 | use crate::domain::user::{User, UserId}; |
| 14 | use crate::error::AppError; | 13 | use crate::error::AppError; |
| @@ -42,7 +41,7 @@ pub async fn includes( | |||
| 42 | Ok(member.is_some()) | 41 | Ok(member.is_some()) |
| 43 | } | 42 | } |
| 44 | EventAudience::Registration { .. } => { | 43 | EventAudience::Registration { .. } => { |
| 45 | - Ok(Registration::read_for_user(event, user.get_id(), db) | 44 | + Ok(crate::db::registration::read_for_user(db, event, user.get_id()) |
| 46 | .await? | 45 | .await? |
| 47 | .is_some()) | 46 | .is_some()) |
| 48 | } | 47 | } |
| @@ -83,7 +82,7 @@ pub async fn members( | |||
| 83 | .iter() | 82 | .iter() |
| 84 | .map(|member| member.get_user().clone()) | 83 | .map(|member| member.get_user().clone()) |
| 85 | .collect()), | 84 | .collect()), |
| 86 | - EventAudience::Registration { .. } => Ok(Registration::list_for_event(event, db) | 85 | + EventAudience::Registration { .. } => Ok(crate::db::registration::list_for_event(db, event) |
| 87 | .await? | 86 | .await? |
| 88 | .iter() | 87 | .iter() |
| 89 | .map(|registration| registration.get_user().clone()) | 88 | .map(|registration| registration.get_user().clone()) |
src/service/registration.rsmodified+3 -3
| @@ -7,7 +7,7 @@ use crate::constant::REGISTRATION_COUNT_FIELD; | |||
| 7 | use crate::database::Database; | 7 | use crate::database::Database; |
| 8 | use crate::db::cap; | 8 | use crate::db::cap; |
| 9 | use crate::db::registration; | 9 | use crate::db::registration; |
| 10 | -use crate::domain::event::{Event, EventId}; | 10 | +use crate::domain::event::EventId; |
| 11 | use crate::domain::registration::{Registration, RegistrationId}; | 11 | use crate::domain::registration::{Registration, RegistrationId}; |
| 12 | use crate::domain::role::Role; | 12 | use crate::domain::role::Role; |
| 13 | use crate::domain::user::UserId; | 13 | use crate::domain::user::UserId; |
| @@ -43,7 +43,7 @@ pub async fn register( | |||
| 43 | } | 43 | } |
| 44 | // Read for its refusals only — the audience kind and the closing time. | 44 | // Read for its refusals only — the audience kind and the closing time. |
| 45 | // The seat count itself is re-read by the claim. | 45 | // The seat count itself is re-read by the claim. |
| 46 | - Event::read(event, db) | 46 | + crate::db::event::read(db, event) |
| 47 | .await? | 47 | .await? |
| 48 | .ok_or(AppError::NotFound)? | 48 | .ok_or(AppError::NotFound)? |
| 49 | .registration_capacity()?; | 49 | .registration_capacity()?; |
| @@ -80,7 +80,7 @@ pub async fn register( | |||
| 80 | // the holder fell to parent while this ran — the conditional writes | 80 | // the holder fell to parent while this ran — the conditional writes |
| 81 | // match nothing (or throw) either way, and only this path pays for | 81 | // match nothing (or throw) either way, and only this path pays for |
| 82 | // the reads that tell them apart. | 82 | // the reads that tell them apart. |
| 83 | - cap::Claimed::Full => match Event::read(event, db).await? { | 83 | + cap::Claimed::Full => match crate::db::event::read(db, event).await? { |
| 84 | None => Err(AppError::NotFound), | 84 | None => Err(AppError::NotFound), |
| 85 | Some(_) => match crate::db::user::read(db, user).await? { | 85 | Some(_) => match crate::db::user::read(db, user).await? { |
| 86 | Some(held) if held.get_role() == Role::Parent => Err(AppError::Forbidden( | 86 | Some(held) if held.get_role() == Role::Parent => Err(AppError::Forbidden( |