feat: User management + JWT auth routes

- Admin users CRUD: /api/admin/users + /api/admin/users/{id}
- Public auth: /api/auth/register, /api/auth/login, /api/auth/me
- User model + password hashing via existing auth module
- JWT token generation and validation
- cargo check ✅ | cargo test 18/18 ✅
This commit is contained in:
boos
2026-05-17 13:24:37 +08:00
parent 7987833ba9
commit 8568859da6
6 changed files with 409 additions and 0 deletions
+1
View File
@@ -6,3 +6,4 @@ pub mod route_channel;
pub mod setting;
pub mod site;
pub mod token_route;
pub mod user;
+16
View File
@@ -0,0 +1,16 @@
use serde::{Deserialize, Serialize};
use sqlx::FromRow;
/// A platform user (admin or regular).
#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
pub struct User {
pub id: i64,
pub username: String,
pub email: String,
#[serde(skip_serializing)]
pub password_hash: String,
pub role: String,
pub status: String,
pub created_at: Option<String>,
pub updated_at: Option<String>,
}