- Add gitignore and prettier configuration files for project scaffolding - Implement room access control service with project member verification - Create user access key management with CRUD operations and activity logging - Add accordion UI component for frontend expandable sections - Implement room AI configuration with list, upsert, and delete operations - Add AI event types for agent join/leave/status change tracking - Create streaming AI processing services for mode and react patterns - Build room AI service with model detection and idempotency handling - Integrate chat service orchestration for AI message processing - Add typing indicators and stream cancellation for AI interactions - Implement mention parsing and context extraction for AI agents
76 lines
2.7 KiB
Rust
76 lines
2.7 KiB
Rust
use crate::ApiResponse;
|
|
use crate::error::ApiError;
|
|
use actix_web::{HttpResponse, Result, web};
|
|
use service::AppService;
|
|
use service::auth::password::{ChangePasswordParams, ConfirmResetPasswordParams, ResetPasswordParams};
|
|
use session::Session;
|
|
|
|
#[utoipa::path(
|
|
post,
|
|
path = "/api/auth/password/change",
|
|
request_body = ChangePasswordParams,
|
|
responses(
|
|
(status = 200, description = "Password changed successfully", body = ApiResponse<String>),
|
|
(status = 401, description = "Unauthorized or invalid password", body = ApiResponse<ApiError>),
|
|
(status = 400, description = "Bad request", body = ApiResponse<ApiError>),
|
|
(status = 500, description = "Internal server error", body = ApiResponse<ApiError>),
|
|
(status = 404, description = "Not found", body = ApiResponse<ApiError>),
|
|
),
|
|
tag = "Auth"
|
|
)]
|
|
pub async fn api_user_change_password(
|
|
service: web::Data<AppService>,
|
|
session: Session,
|
|
params: web::Json<ChangePasswordParams>,
|
|
) -> Result<HttpResponse, ApiError> {
|
|
service
|
|
.auth_change_password(&session, params.into_inner())
|
|
.await?;
|
|
Ok(crate::api_success())
|
|
}
|
|
|
|
#[utoipa::path(
|
|
post,
|
|
path = "/api/auth/password/reset",
|
|
request_body = ResetPasswordParams,
|
|
responses(
|
|
(status = 401, description = "Unauthorized", body = ApiResponse<ApiError>),
|
|
(status = 200, description = "Password reset email sent if account exists", body = ApiResponse<String>),
|
|
(status = 500, description = "Internal server error", body = ApiResponse<ApiError>),
|
|
),
|
|
tag = "Auth"
|
|
)]
|
|
pub async fn api_user_request_password_reset(
|
|
service: web::Data<AppService>,
|
|
_session: Session,
|
|
params: web::Json<ResetPasswordParams>,
|
|
) -> Result<HttpResponse, ApiError> {
|
|
service
|
|
.auth_request_password_reset(params.into_inner())
|
|
.await?;
|
|
Ok(crate::api_success())
|
|
}
|
|
|
|
#[utoipa::path(
|
|
post,
|
|
path = "/api/auth/password/confirm",
|
|
request_body = ConfirmResetPasswordParams,
|
|
responses(
|
|
(status = 200, description = "Password reset confirmed", body = ApiResponse<String>),
|
|
(status = 400, description = "Invalid or expired token", body = ApiResponse<ApiError>),
|
|
(status = 404, description = "User not found", body = ApiResponse<ApiError>),
|
|
(status = 500, description = "Internal server error", body = ApiResponse<ApiError>),
|
|
),
|
|
tag = "Auth"
|
|
)]
|
|
pub async fn api_user_confirm_password_reset(
|
|
service: web::Data<AppService>,
|
|
_session: Session,
|
|
params: web::Json<ConfirmResetPasswordParams>,
|
|
) -> Result<HttpResponse, ApiError> {
|
|
service
|
|
.auth_confirm_password_reset(params.into_inner())
|
|
.await?;
|
|
Ok(crate::api_success())
|
|
}
|