Skip to main content

sova_auth/
events.rs

1//! Domain events emitted on the app [`EventBus`](sova_core::EventBus).
2
3use sova_core::Event;
4
5/// Fired after a successful registration (before/with login finish).
6#[derive(Debug, Clone)]
7pub struct UserRegistered {
8    pub user_id: i64,
9    pub email: String,
10}
11
12impl Event for UserRegistered {
13    fn name(&self) -> &'static str {
14        "auth.user_registered"
15    }
16}
17
18/// Fired after a successful interactive login (session established).
19#[derive(Debug, Clone)]
20pub struct UserLoggedIn {
21    pub user_id: i64,
22    pub email: String,
23}
24
25impl Event for UserLoggedIn {
26    fn name(&self) -> &'static str {
27        "auth.user_logged_in"
28    }
29}