fixed deletion of requirements and added modal to see deleted requirements

This commit is contained in:
gulimabr
2025-12-02 15:05:34 -03:00
parent 5dc4f861d1
commit a65719b631
7 changed files with 358 additions and 6 deletions

View File

@@ -15,7 +15,7 @@ from src.models import (
RequirementLinkResponse, RequirementLinkCreateRequest, RequirementSearchResult,
RoleResponse, ProjectMemberResponse, UserRoleUpdateRequest, ROLE_DISPLAY_NAMES,
CommentResponse, CommentReplyResponse, CommentCreateRequest, ReplyCreateRequest,
RequirementStatusResponse
RequirementStatusResponse, DeletedRequirementResponse
)
from src.controller import AuthController
from src.config import get_openid, get_settings
@@ -1130,6 +1130,35 @@ async def get_requirement_history(
return [RequirementHistoryResponse(**h) for h in history]
@app.get("/api/projects/{project_id}/deleted-requirements", response_model=List[DeletedRequirementResponse])
async def get_deleted_requirements(
project_id: int,
request: Request,
db: AsyncSession = Depends(get_db)
):
"""
Get all deleted requirements for a project.
Returns requirements that exist in history but have been deleted.
User must be a member of the project.
Args:
project_id: The project to get deleted requirements for
Returns:
List of deleted requirements with their last known state.
"""
user = await _get_current_user_db(request, db)
# Verify user is a member of the project
await _verify_project_membership(project_id, user.id, db)
# Get deleted requirements
req_repo = RequirementRepository(db)
deleted = await req_repo.get_deleted_requirements(project_id)
return [DeletedRequirementResponse(**d) for d in deleted]
# ===========================================
# Validation Endpoints
# ===========================================