feat(session): integrate actix-web framework with enhanced session management

- Added actix-web and actix-multipart dependencies to Cargo.toml
- Integrated actix-web ResponseError trait for AppError handling
- Migrated session module to use actix-web request lifecycle management
- Enhanced Session struct with request-local state handling capabilities
- Implemented proper HTTP status code mapping for various error types
- Added comprehensive session middleware integration points
- Updated session state persistence and modification tracking logic
- Integrated proper JSON response formatting for error messages
- Added support for session renewal, purge, and unchanged state management
This commit is contained in:
zhenyi
2026-06-07 17:41:57 +08:00
parent 6a8e978073
commit 4e2c1c932a
11 changed files with 793 additions and 77 deletions
+13
View File
@@ -541,6 +541,19 @@ impl WorkspaceService {
.ok_or(AppError::NotFound("workspace not found".into()))
}
pub(crate) async fn find_workspace_by_name(&self, name: &str) -> Result<Workspace, AppError> {
sqlx::query_as::<_, Workspace>(
"SELECT id, owner_id, name, description, avatar_url, visibility, plan, status, \
default_role, is_personal, archived_at, created_at, updated_at, deleted_at \
FROM workspace WHERE lower(name) = lower($1) AND deleted_at IS NULL",
)
.bind(name)
.fetch_optional(self.ctx.db.reader())
.await
.map_err(AppError::Database)?
.ok_or(AppError::NotFound("workspace not found".into()))
}
pub async fn workspace_user_role(
&self,
user_uid: Uuid,