refactor(backend/api): extract DSFA schemas + services (Step 4 — file 14 of 18)
- Create compliance/schemas/dsfa.py (161 LOC) — extract DSFACreate, DSFAUpdate, DSFAStatusUpdate, DSFASectionUpdate, DSFAApproveRequest - Create compliance/services/dsfa_service.py (386 LOC) — CRUD + helpers + stats + audit-log + CSV export; uses domain errors - Create compliance/services/dsfa_workflow_service.py (347 LOC) — status update, section update, submit-for-review, approve, export JSON, versions - Rewrite compliance/api/dsfa_routes.py (339 LOC) as thin handlers with Depends + translate_domain_errors(); re-export legacy symbols via __all__ - Add [mypy-compliance.api.dsfa_routes] ignore_errors = False to mypy.ini - Update tests: 422 -> 400 for domain ValidationError (6 assertions) - Regenerate OpenAPI baseline (360 paths / 484 operations — unchanged) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -374,59 +374,6 @@
|
||||
"title": "ApprovalCommentRequest",
|
||||
"type": "object"
|
||||
},
|
||||
"ApprovalHistoryEntry": {
|
||||
"properties": {
|
||||
"action": {
|
||||
"title": "Action",
|
||||
"type": "string"
|
||||
},
|
||||
"approver": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Approver"
|
||||
},
|
||||
"comment": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Comment"
|
||||
},
|
||||
"created_at": {
|
||||
"format": "date-time",
|
||||
"title": "Created At",
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"title": "Id",
|
||||
"type": "string"
|
||||
},
|
||||
"version_id": {
|
||||
"title": "Version Id",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"version_id",
|
||||
"action",
|
||||
"approver",
|
||||
"comment",
|
||||
"created_at"
|
||||
],
|
||||
"title": "ApprovalHistoryEntry",
|
||||
"type": "object"
|
||||
},
|
||||
"AssignRequest": {
|
||||
"properties": {
|
||||
"assignee_id": {
|
||||
@@ -19563,122 +19510,6 @@
|
||||
"title": "ConsentCreate",
|
||||
"type": "object"
|
||||
},
|
||||
"compliance__api__legal_document_routes__VersionCreate": {
|
||||
"properties": {
|
||||
"content": {
|
||||
"title": "Content",
|
||||
"type": "string"
|
||||
},
|
||||
"created_by": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Created By"
|
||||
},
|
||||
"document_id": {
|
||||
"title": "Document Id",
|
||||
"type": "string"
|
||||
},
|
||||
"language": {
|
||||
"default": "de",
|
||||
"title": "Language",
|
||||
"type": "string"
|
||||
},
|
||||
"summary": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Summary"
|
||||
},
|
||||
"title": {
|
||||
"title": "Title",
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"title": "Version",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"document_id",
|
||||
"version",
|
||||
"title",
|
||||
"content"
|
||||
],
|
||||
"title": "VersionCreate",
|
||||
"type": "object"
|
||||
},
|
||||
"compliance__api__legal_document_routes__VersionUpdate": {
|
||||
"properties": {
|
||||
"content": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Content"
|
||||
},
|
||||
"language": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Language"
|
||||
},
|
||||
"summary": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Summary"
|
||||
},
|
||||
"title": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Title"
|
||||
},
|
||||
"version": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Version"
|
||||
}
|
||||
},
|
||||
"title": "VersionUpdate",
|
||||
"type": "object"
|
||||
},
|
||||
"compliance__api__notfallplan_routes__IncidentCreate": {
|
||||
"properties": {
|
||||
"affected_data_categories": {
|
||||
@@ -20361,6 +20192,122 @@
|
||||
],
|
||||
"title": "StatusUpdate",
|
||||
"type": "object"
|
||||
},
|
||||
"compliance__schemas__legal_document__VersionCreate": {
|
||||
"properties": {
|
||||
"content": {
|
||||
"title": "Content",
|
||||
"type": "string"
|
||||
},
|
||||
"created_by": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Created By"
|
||||
},
|
||||
"document_id": {
|
||||
"title": "Document Id",
|
||||
"type": "string"
|
||||
},
|
||||
"language": {
|
||||
"default": "de",
|
||||
"title": "Language",
|
||||
"type": "string"
|
||||
},
|
||||
"summary": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Summary"
|
||||
},
|
||||
"title": {
|
||||
"title": "Title",
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"title": "Version",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"document_id",
|
||||
"version",
|
||||
"title",
|
||||
"content"
|
||||
],
|
||||
"title": "VersionCreate",
|
||||
"type": "object"
|
||||
},
|
||||
"compliance__schemas__legal_document__VersionUpdate": {
|
||||
"properties": {
|
||||
"content": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Content"
|
||||
},
|
||||
"language": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Language"
|
||||
},
|
||||
"summary": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Summary"
|
||||
},
|
||||
"title": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Title"
|
||||
},
|
||||
"version": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Version"
|
||||
}
|
||||
},
|
||||
"title": "VersionUpdate",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -23428,7 +23375,7 @@
|
||||
},
|
||||
"/api/compliance/controls/paginated": {
|
||||
"get": {
|
||||
"description": "List controls with pagination and eager-loaded relationships.\n\nThis endpoint is optimized for large datasets with:\n- Eager loading to prevent N+1 queries\n- Server-side pagination\n- Full-text search support",
|
||||
"description": "List controls with pagination.",
|
||||
"operationId": "list_controls_paginated_api_compliance_controls_paginated_get",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -23708,13 +23655,17 @@
|
||||
},
|
||||
"/api/compliance/create-indexes": {
|
||||
"post": {
|
||||
"description": "Create additional performance indexes for large datasets.\n\nThese indexes are optimized for:\n- Pagination queries (1000+ requirements)\n- Full-text search\n- Filtering by status/priority",
|
||||
"description": "Create additional performance indexes.",
|
||||
"operationId": "create_performance_indexes_api_compliance_create_indexes_post",
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"additionalProperties": true,
|
||||
"title": "Response Create Performance Indexes Api Compliance Create Indexes Post",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -23821,7 +23772,7 @@
|
||||
},
|
||||
"/api/compliance/dsfa": {
|
||||
"get": {
|
||||
"description": "Liste aller DSFAs f\u00fcr einen Tenant.",
|
||||
"description": "Liste aller DSFAs fuer einen Tenant.",
|
||||
"operationId": "list_dsfas_api_compliance_dsfa_get",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -23900,7 +23851,14 @@
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"items": {
|
||||
"additionalProperties": true,
|
||||
"type": "object"
|
||||
},
|
||||
"title": "Response List Dsfas Api Compliance Dsfa Get",
|
||||
"type": "array"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -23957,7 +23915,11 @@
|
||||
"201": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"additionalProperties": true,
|
||||
"title": "Response Create Dsfa Api Compliance Dsfa Post",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -24029,7 +23991,14 @@
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"items": {
|
||||
"additionalProperties": true,
|
||||
"type": "object"
|
||||
},
|
||||
"title": "Response Get Audit Log Api Compliance Dsfa Audit Log Get",
|
||||
"type": "array"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -24081,7 +24050,13 @@
|
||||
"501": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": "Response Get By Assessment Api Compliance Dsfa By Assessment Assessment Id Get",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -24145,7 +24120,7 @@
|
||||
},
|
||||
"/api/compliance/dsfa/from-assessment/{assessment_id}": {
|
||||
"post": {
|
||||
"description": "Stub: Create DSFA from UCCA assessment. Requires cross-service communication.",
|
||||
"description": "Stub: Create DSFA from UCCA assessment.",
|
||||
"operationId": "create_from_assessment_api_compliance_dsfa_from_assessment__assessment_id__post",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -24172,7 +24147,13 @@
|
||||
"501": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": "Response Create From Assessment Api Compliance Dsfa From Assessment Assessment Id Post",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -24187,7 +24168,7 @@
|
||||
},
|
||||
"/api/compliance/dsfa/stats": {
|
||||
"get": {
|
||||
"description": "Z\u00e4hler nach Status und Risiko-Level.",
|
||||
"description": "Zaehler nach Status und Risiko-Level.",
|
||||
"operationId": "get_stats_api_compliance_dsfa_stats_get",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -24211,7 +24192,11 @@
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"additionalProperties": true,
|
||||
"title": "Response Get Stats Api Compliance Dsfa Stats Get",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -24236,7 +24221,7 @@
|
||||
},
|
||||
"/api/compliance/dsfa/{dsfa_id}": {
|
||||
"delete": {
|
||||
"description": "DSFA l\u00f6schen (Art. 17 DSGVO).",
|
||||
"description": "DSFA loeschen (Art. 17 DSGVO).",
|
||||
"operationId": "delete_dsfa_api_compliance_dsfa__dsfa_id__delete",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -24269,7 +24254,11 @@
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"additionalProperties": true,
|
||||
"title": "Response Delete Dsfa Api Compliance Dsfa Dsfa Id Delete",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -24325,7 +24314,11 @@
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"additionalProperties": true,
|
||||
"title": "Response Get Dsfa Api Compliance Dsfa Dsfa Id Get",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -24391,7 +24384,11 @@
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"additionalProperties": true,
|
||||
"title": "Response Update Dsfa Api Compliance Dsfa Dsfa Id Put",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -24459,7 +24456,11 @@
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"additionalProperties": true,
|
||||
"title": "Response Approve Dsfa Api Compliance Dsfa Dsfa Id Approve Post",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -24527,7 +24528,11 @@
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"additionalProperties": true,
|
||||
"title": "Response Export Dsfa Json Api Compliance Dsfa Dsfa Id Export Get",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -24604,7 +24609,11 @@
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"additionalProperties": true,
|
||||
"title": "Response Update Section Api Compliance Dsfa Dsfa Id Sections Section Number Put",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -24672,7 +24681,11 @@
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"additionalProperties": true,
|
||||
"title": "Response Update Dsfa Status Api Compliance Dsfa Dsfa Id Status Patch",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -24697,7 +24710,7 @@
|
||||
},
|
||||
"/api/compliance/dsfa/{dsfa_id}/submit-for-review": {
|
||||
"post": {
|
||||
"description": "Submit a DSFA for DPO review (draft \u2192 in-review).",
|
||||
"description": "Submit a DSFA for DPO review (draft -> in-review).",
|
||||
"operationId": "submit_for_review_api_compliance_dsfa__dsfa_id__submit_for_review_post",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -24730,7 +24743,11 @@
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"additionalProperties": true,
|
||||
"title": "Response Submit For Review Api Compliance Dsfa Dsfa Id Submit For Review Post",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -24788,7 +24805,9 @@
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"title": "Response List Dsfa Versions Api Compliance Dsfa Dsfa Id Versions Get"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -24855,7 +24874,9 @@
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"title": "Response Get Dsfa Version Api Compliance Dsfa Dsfa Id Versions Version Number Get"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -30989,7 +31010,11 @@
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"additionalProperties": true,
|
||||
"title": "Response Init Tables Api Compliance Init Tables Post",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -33186,7 +33211,6 @@
|
||||
},
|
||||
"/api/compliance/legal-documents/audit-log": {
|
||||
"get": {
|
||||
"description": "Consent audit trail (paginated).",
|
||||
"operationId": "get_audit_log_api_compliance_legal_documents_audit_log_get",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -33265,7 +33289,11 @@
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"additionalProperties": true,
|
||||
"title": "Response Get Audit Log Api Compliance Legal Documents Audit Log Get",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -33290,7 +33318,6 @@
|
||||
},
|
||||
"/api/compliance/legal-documents/consents": {
|
||||
"post": {
|
||||
"description": "Record user consent for a legal document.",
|
||||
"operationId": "record_consent_api_compliance_legal_documents_consents_post",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -33324,7 +33351,11 @@
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"additionalProperties": true,
|
||||
"title": "Response Record Consent Api Compliance Legal Documents Consents Post",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -33349,7 +33380,6 @@
|
||||
},
|
||||
"/api/compliance/legal-documents/consents/check/{document_type}": {
|
||||
"get": {
|
||||
"description": "Check if user has active consent for a document type.",
|
||||
"operationId": "check_consent_api_compliance_legal_documents_consents_check__document_type__get",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -33391,7 +33421,11 @@
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"additionalProperties": true,
|
||||
"title": "Response Check Consent Api Compliance Legal Documents Consents Check Document Type Get",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -33416,7 +33450,6 @@
|
||||
},
|
||||
"/api/compliance/legal-documents/consents/my": {
|
||||
"get": {
|
||||
"description": "Get all consents for a specific user.",
|
||||
"operationId": "get_my_consents_api_compliance_legal_documents_consents_my_get",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -33449,7 +33482,14 @@
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"items": {
|
||||
"additionalProperties": true,
|
||||
"type": "object"
|
||||
},
|
||||
"title": "Response Get My Consents Api Compliance Legal Documents Consents My Get",
|
||||
"type": "array"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -33474,7 +33514,6 @@
|
||||
},
|
||||
"/api/compliance/legal-documents/consents/{consent_id}": {
|
||||
"delete": {
|
||||
"description": "Withdraw a consent (DSGVO Art. 7 Abs. 3).",
|
||||
"operationId": "withdraw_consent_api_compliance_legal_documents_consents__consent_id__delete",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -33507,7 +33546,11 @@
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"additionalProperties": true,
|
||||
"title": "Response Withdraw Consent Api Compliance Legal Documents Consents Consent Id Delete",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -33532,7 +33575,6 @@
|
||||
},
|
||||
"/api/compliance/legal-documents/cookie-categories": {
|
||||
"get": {
|
||||
"description": "List all cookie categories.",
|
||||
"operationId": "list_cookie_categories_api_compliance_legal_documents_cookie_categories_get",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -33556,7 +33598,14 @@
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"items": {
|
||||
"additionalProperties": true,
|
||||
"type": "object"
|
||||
},
|
||||
"title": "Response List Cookie Categories Api Compliance Legal Documents Cookie Categories Get",
|
||||
"type": "array"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -33579,7 +33628,6 @@
|
||||
]
|
||||
},
|
||||
"post": {
|
||||
"description": "Create a cookie category.",
|
||||
"operationId": "create_cookie_category_api_compliance_legal_documents_cookie_categories_post",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -33613,7 +33661,11 @@
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"additionalProperties": true,
|
||||
"title": "Response Create Cookie Category Api Compliance Legal Documents Cookie Categories Post",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -33638,7 +33690,6 @@
|
||||
},
|
||||
"/api/compliance/legal-documents/cookie-categories/{category_id}": {
|
||||
"delete": {
|
||||
"description": "Delete a cookie category.",
|
||||
"operationId": "delete_cookie_category_api_compliance_legal_documents_cookie_categories__category_id__delete",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -33689,7 +33740,6 @@
|
||||
]
|
||||
},
|
||||
"put": {
|
||||
"description": "Update a cookie category.",
|
||||
"operationId": "update_cookie_category_api_compliance_legal_documents_cookie_categories__category_id__put",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -33732,7 +33782,11 @@
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"additionalProperties": true,
|
||||
"title": "Response Update Cookie Category Api Compliance Legal Documents Cookie Categories Category Id Put",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -33757,7 +33811,6 @@
|
||||
},
|
||||
"/api/compliance/legal-documents/documents": {
|
||||
"get": {
|
||||
"description": "List all legal documents, optionally filtered by tenant or type.",
|
||||
"operationId": "list_documents_api_compliance_legal_documents_documents_get",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -33824,7 +33877,6 @@
|
||||
]
|
||||
},
|
||||
"post": {
|
||||
"description": "Create a new legal document type.",
|
||||
"operationId": "create_document_api_compliance_legal_documents_documents_post",
|
||||
"requestBody": {
|
||||
"content": {
|
||||
@@ -33867,7 +33919,6 @@
|
||||
},
|
||||
"/api/compliance/legal-documents/documents/{document_id}": {
|
||||
"delete": {
|
||||
"description": "Delete a legal document and all its versions.",
|
||||
"operationId": "delete_document_api_compliance_legal_documents_documents__document_id__delete",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -33902,7 +33953,6 @@
|
||||
]
|
||||
},
|
||||
"get": {
|
||||
"description": "Get a single legal document by ID.",
|
||||
"operationId": "get_document_api_compliance_legal_documents_documents__document_id__get",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -33946,7 +33996,6 @@
|
||||
},
|
||||
"/api/compliance/legal-documents/documents/{document_id}/versions": {
|
||||
"get": {
|
||||
"description": "List all versions for a legal document.",
|
||||
"operationId": "list_versions_api_compliance_legal_documents_documents__document_id__versions_get",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -33994,7 +34043,6 @@
|
||||
},
|
||||
"/api/compliance/legal-documents/public": {
|
||||
"get": {
|
||||
"description": "Active documents for end-user display.",
|
||||
"operationId": "list_public_documents_api_compliance_legal_documents_public_get",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -34018,7 +34066,14 @@
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"items": {
|
||||
"additionalProperties": true,
|
||||
"type": "object"
|
||||
},
|
||||
"title": "Response List Public Documents Api Compliance Legal Documents Public Get",
|
||||
"type": "array"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -34043,7 +34098,6 @@
|
||||
},
|
||||
"/api/compliance/legal-documents/public/{document_type}/latest": {
|
||||
"get": {
|
||||
"description": "Get the latest published version of a document type.",
|
||||
"operationId": "get_latest_published_api_compliance_legal_documents_public__document_type__latest_get",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -34086,7 +34140,11 @@
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"additionalProperties": true,
|
||||
"title": "Response Get Latest Published Api Compliance Legal Documents Public Document Type Latest Get",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -34111,7 +34169,6 @@
|
||||
},
|
||||
"/api/compliance/legal-documents/stats/consents": {
|
||||
"get": {
|
||||
"description": "Consent statistics for dashboard.",
|
||||
"operationId": "get_consent_stats_api_compliance_legal_documents_stats_consents_get",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -34135,7 +34192,11 @@
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"additionalProperties": true,
|
||||
"title": "Response Get Consent Stats Api Compliance Legal Documents Stats Consents Get",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -34160,13 +34221,12 @@
|
||||
},
|
||||
"/api/compliance/legal-documents/versions": {
|
||||
"post": {
|
||||
"description": "Create a new version for a legal document.",
|
||||
"operationId": "create_version_api_compliance_legal_documents_versions_post",
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/compliance__api__legal_document_routes__VersionCreate"
|
||||
"$ref": "#/components/schemas/compliance__schemas__legal_document__VersionCreate"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -34203,7 +34263,6 @@
|
||||
},
|
||||
"/api/compliance/legal-documents/versions/upload-word": {
|
||||
"post": {
|
||||
"description": "Convert DOCX to HTML using mammoth (if available) or return raw text.",
|
||||
"operationId": "upload_word_api_compliance_legal_documents_versions_upload_word_post",
|
||||
"requestBody": {
|
||||
"content": {
|
||||
@@ -34248,7 +34307,6 @@
|
||||
},
|
||||
"/api/compliance/legal-documents/versions/{version_id}": {
|
||||
"get": {
|
||||
"description": "Get a single version by ID.",
|
||||
"operationId": "get_version_api_compliance_legal_documents_versions__version_id__get",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -34290,7 +34348,6 @@
|
||||
]
|
||||
},
|
||||
"put": {
|
||||
"description": "Update a draft legal document version.",
|
||||
"operationId": "update_version_api_compliance_legal_documents_versions__version_id__put",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -34307,7 +34364,7 @@
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/compliance__api__legal_document_routes__VersionUpdate"
|
||||
"$ref": "#/components/schemas/compliance__schemas__legal_document__VersionUpdate"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -34344,7 +34401,6 @@
|
||||
},
|
||||
"/api/compliance/legal-documents/versions/{version_id}/approval-history": {
|
||||
"get": {
|
||||
"description": "Get the full approval audit trail for a version.",
|
||||
"operationId": "get_approval_history_api_compliance_legal_documents_versions__version_id__approval_history_get",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -34363,7 +34419,8 @@
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/ApprovalHistoryEntry"
|
||||
"additionalProperties": true,
|
||||
"type": "object"
|
||||
},
|
||||
"title": "Response Get Approval History Api Compliance Legal Documents Versions Version Id Approval History Get",
|
||||
"type": "array"
|
||||
@@ -34392,7 +34449,6 @@
|
||||
},
|
||||
"/api/compliance/legal-documents/versions/{version_id}/approve": {
|
||||
"post": {
|
||||
"description": "Approve a version under review.",
|
||||
"operationId": "approve_version_api_compliance_legal_documents_versions__version_id__approve_post",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -34446,7 +34502,6 @@
|
||||
},
|
||||
"/api/compliance/legal-documents/versions/{version_id}/publish": {
|
||||
"post": {
|
||||
"description": "Publish an approved version.",
|
||||
"operationId": "publish_version_api_compliance_legal_documents_versions__version_id__publish_post",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -34500,7 +34555,6 @@
|
||||
},
|
||||
"/api/compliance/legal-documents/versions/{version_id}/reject": {
|
||||
"post": {
|
||||
"description": "Reject a version under review.",
|
||||
"operationId": "reject_version_api_compliance_legal_documents_versions__version_id__reject_post",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -34554,7 +34608,6 @@
|
||||
},
|
||||
"/api/compliance/legal-documents/versions/{version_id}/submit-review": {
|
||||
"post": {
|
||||
"description": "Submit a draft version for review.",
|
||||
"operationId": "submit_review_api_compliance_legal_documents_versions__version_id__submit_review_post",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -39445,7 +39498,7 @@
|
||||
},
|
||||
"/api/compliance/requirements": {
|
||||
"get": {
|
||||
"description": "List requirements with pagination and eager-loaded relationships.\n\nThis endpoint is optimized for large datasets (1000+ requirements) with:\n- Eager loading to prevent N+1 queries\n- Server-side pagination\n- Full-text search support",
|
||||
"description": "List requirements with pagination.",
|
||||
"operationId": "list_requirements_paginated_api_compliance_requirements_get",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -39635,7 +39688,11 @@
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"additionalProperties": true,
|
||||
"title": "Response Delete Requirement Api Compliance Requirements Requirement Id Delete",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -39686,7 +39743,11 @@
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"additionalProperties": true,
|
||||
"title": "Response Get Requirement Api Compliance Requirements Requirement Id Get",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -39737,7 +39798,11 @@
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"additionalProperties": true,
|
||||
"title": "Response Update Requirement Api Compliance Requirements Requirement Id Put",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
@@ -40741,13 +40806,17 @@
|
||||
},
|
||||
"/api/compliance/seed-risks": {
|
||||
"post": {
|
||||
"description": "Seed only risks (incremental update for existing databases).",
|
||||
"description": "Seed only risks.",
|
||||
"operationId": "seed_risks_only_api_compliance_seed_risks_post",
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
"schema": {
|
||||
"additionalProperties": true,
|
||||
"title": "Response Seed Risks Only Api Compliance Seed Risks Post",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
|
||||
@@ -712,11 +712,11 @@ class TestDSFARouteCRUD:
|
||||
|
||||
def test_create_invalid_status(self):
|
||||
resp = client.post("/api/compliance/dsfa", json={"title": "Bad", "status": "invalid"})
|
||||
assert resp.status_code == 422
|
||||
assert resp.status_code == 400 # ValidationError -> 400
|
||||
|
||||
def test_create_invalid_risk_level(self):
|
||||
resp = client.post("/api/compliance/dsfa", json={"title": "Bad", "risk_level": "extreme"})
|
||||
assert resp.status_code == 422
|
||||
assert resp.status_code == 400 # ValidationError -> 400
|
||||
|
||||
|
||||
# =============================================================================
|
||||
@@ -760,7 +760,7 @@ class TestDSFARouteStatusPatch:
|
||||
f"/api/compliance/dsfa/{created['id']}/status",
|
||||
json={"status": "bogus"},
|
||||
)
|
||||
assert resp.status_code == 422
|
||||
assert resp.status_code == 400 # ValidationError -> 400
|
||||
|
||||
def test_patch_status_not_found(self):
|
||||
resp = client.patch(
|
||||
@@ -810,7 +810,7 @@ class TestDSFARouteSectionUpdate:
|
||||
f"/api/compliance/dsfa/{created['id']}/sections/9",
|
||||
json={"content": "X"},
|
||||
)
|
||||
assert resp.status_code == 422
|
||||
assert resp.status_code == 400 # ValidationError -> 400
|
||||
|
||||
def test_update_section_not_found(self):
|
||||
resp = client.put(
|
||||
@@ -839,7 +839,7 @@ class TestDSFARouteWorkflow:
|
||||
client.post(f"/api/compliance/dsfa/{created['id']}/submit-for-review")
|
||||
# Try to submit again (already in-review)
|
||||
resp = client.post(f"/api/compliance/dsfa/{created['id']}/submit-for-review")
|
||||
assert resp.status_code == 422
|
||||
assert resp.status_code == 400 # ValidationError -> 400
|
||||
|
||||
def test_submit_not_found(self):
|
||||
resp = client.post(f"/api/compliance/dsfa/{uuid.uuid4()}/submit-for-review")
|
||||
@@ -871,7 +871,7 @@ class TestDSFARouteWorkflow:
|
||||
f"/api/compliance/dsfa/{created['id']}/approve",
|
||||
json={"approved": True},
|
||||
)
|
||||
assert resp.status_code == 422
|
||||
assert resp.status_code == 400 # ValidationError -> 400
|
||||
|
||||
def test_approve_not_found(self):
|
||||
resp = client.post(
|
||||
|
||||
Reference in New Issue
Block a user