You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-07-29 22:01:14 +03:00
Split the mutations and make them use an input object instead of different parameters
This commit is contained in:
@ -12,6 +12,8 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use std::ops::Deref;
|
||||
|
||||
use chrono::{DateTime, Duration, Utc};
|
||||
use rand::{Rng, SeedableRng};
|
||||
use serde::Serialize;
|
||||
@ -131,6 +133,13 @@ pub enum UserEmailVerificationState {
|
||||
Valid,
|
||||
}
|
||||
|
||||
impl UserEmailVerificationState {
|
||||
#[must_use]
|
||||
pub fn is_valid(&self) -> bool {
|
||||
matches!(self, Self::Valid)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
|
||||
pub struct UserEmailVerification {
|
||||
pub id: Ulid,
|
||||
@ -140,6 +149,14 @@ pub struct UserEmailVerification {
|
||||
pub state: UserEmailVerificationState,
|
||||
}
|
||||
|
||||
impl Deref for UserEmailVerification {
|
||||
type Target = UserEmailVerificationState;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.state
|
||||
}
|
||||
}
|
||||
|
||||
impl UserEmailVerification {
|
||||
#[must_use]
|
||||
pub fn samples(now: chrono::DateTime<Utc>, rng: &mut impl Rng) -> Vec<Self> {
|
||||
|
Reference in New Issue
Block a user