refactor: simplify route handlers by removing redundant ID parsing logic
This commit is contained in:
@@ -60,7 +60,11 @@ func KnowledgeBaseAnyList_all(ctx *gin.Context) {
|
||||
httpx.WriteJSON(ctx, results)
|
||||
}
|
||||
|
||||
func KnowledgeBaseGetBy(ctx *gin.Context, id int64) {
|
||||
func KnowledgeBaseGetBy(ctx *gin.Context) {
|
||||
id, ok := httpx.GetPathInt64(ctx, "id")
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
if _, err := services.AuthService.RequirePermission(ctx, constants.PermissionKnowledgeBaseView); err != nil {
|
||||
httpx.WriteJSON(ctx, err)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user