fix: BUG-038 (audit log for tags/tasks/wiki/mail/calendar), BUG-072 (workflow instance), BUG-052 (miniapps), BUG-047 (approvals), BUG-037 (compliance), BUG-030 (GRANT DELETE), BUG-016 (search use_ai), BUG-014 (tags assign), BUG-009 (contact folders), BUG-073 (broken imports)
Check Cross-Plugin Imports / check (push) Has been cancelled
Check Cross-Plugin Imports / check (push) Has been cancelled
This commit is contained in:
@@ -7,6 +7,7 @@ from app.core.db import get_db
|
||||
from app.deps import get_current_user, require_permission
|
||||
from app.plugins.builtins.wiki import services
|
||||
from app.plugins.builtins.wiki.schemas import ArticleCreate, ArticleUpdate, CategoryCreate, CategoryUpdate
|
||||
from app.core.audit import log_audit
|
||||
|
||||
router = APIRouter(prefix="/api/v1/wiki", tags=["wiki"])
|
||||
|
||||
@@ -33,9 +34,12 @@ async def create_article(
|
||||
db: AsyncSession = Depends(get_db),
|
||||
current_user: dict = Depends(require_permission("wiki:write")),
|
||||
):
|
||||
return await services.create_article(
|
||||
db, uuid.UUID(current_user["tenant_id"]), uuid.UUID(current_user["user_id"]), body.model_dump(),
|
||||
)
|
||||
tenant_id = uuid.UUID(current_user["tenant_id"])
|
||||
user_id = uuid.UUID(current_user["user_id"])
|
||||
result = await services.create_article(db, tenant_id, user_id, body.model_dump())
|
||||
if result and result.get("id"):
|
||||
await log_audit(db, tenant_id, user_id, "create", "wiki_article", uuid.UUID(result["id"]), changes={"title": body.title})
|
||||
return result
|
||||
|
||||
|
||||
@router.get("/articles/{article_id}")
|
||||
@@ -72,9 +76,12 @@ async def delete_article(
|
||||
db: AsyncSession = Depends(get_db),
|
||||
current_user: dict = Depends(require_permission("wiki:delete")),
|
||||
):
|
||||
ok = await services.delete_article(db, uuid.UUID(current_user["tenant_id"]), uuid.UUID(article_id))
|
||||
tenant_id = uuid.UUID(current_user["tenant_id"])
|
||||
user_id = uuid.UUID(current_user["user_id"])
|
||||
ok = await services.delete_article(db, tenant_id, uuid.UUID(article_id))
|
||||
if not ok:
|
||||
raise HTTPException(status_code=404, detail={"detail": "Article not found", "code": "not_found"})
|
||||
await log_audit(db, tenant_id, user_id, "delete", "wiki_article", uuid.UUID(article_id))
|
||||
|
||||
|
||||
@router.get("/articles/{article_id}/versions")
|
||||
|
||||
Reference in New Issue
Block a user