Billy Chan b63223d78d
Getting Started with Loco & SeaORM (#2230)
* Getting Started with Loco & SeaORM

* README

* edit

* README
2024-05-28 15:06:53 +08:00

24 lines
545 B
Rust

use serde::{Deserialize, Serialize};
use crate::models::_entities::users;
#[derive(Debug, Deserialize, Serialize)]
pub struct LoginResponse {
pub token: String,
pub pid: String,
pub name: String,
pub is_verified: bool,
}
impl LoginResponse {
#[must_use]
pub fn new(user: &users::Model, token: &String) -> Self {
Self {
token: token.to_string(),
pid: user.pid.to_string(),
name: user.name.clone(),
is_verified: user.email_verified_at.is_some(),
}
}
}