active log add

This commit is contained in:
2026-07-16 17:53:45 +05:00
parent 585ba63bc2
commit 3636e1ca53
15 changed files with 856 additions and 29 deletions

View File

@@ -15,6 +15,129 @@ const docTemplate = `{
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/activity-logs": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Returns a paginated audit trail of user actions (create/update/delete)",
"produces": [
"application/json"
],
"tags": [
"activity-logs"
],
"summary": "List activity logs",
"parameters": [
{
"type": "integer",
"description": "Filter by user ID",
"name": "user_id",
"in": "query"
},
{
"type": "string",
"description": "Filter by module (e.g. cards, branch-users)",
"name": "module",
"in": "query"
},
{
"type": "string",
"description": "Filter by action (create, update, delete)",
"name": "action",
"in": "query"
},
{
"type": "integer",
"default": 1,
"description": "Page number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"default": 10,
"description": "Items per page",
"name": "limit",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/appresult.AppSuccess"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/appresult.AppError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/appresult.AppError"
}
}
}
}
},
"/activity-logs/{id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Returns a single activity log entry",
"produces": [
"application/json"
],
"tags": [
"activity-logs"
],
"summary": "Get activity log by ID",
"parameters": [
{
"type": "integer",
"description": "Activity log ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/appresult.AppSuccess"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/appresult.AppError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/appresult.AppError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/appresult.AppError"
}
}
}
}
},
"/branch-users": {
"get": {
"security": [

View File

@@ -9,6 +9,129 @@
"host": "localhost:5050",
"basePath": "/api/admin",
"paths": {
"/activity-logs": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Returns a paginated audit trail of user actions (create/update/delete)",
"produces": [
"application/json"
],
"tags": [
"activity-logs"
],
"summary": "List activity logs",
"parameters": [
{
"type": "integer",
"description": "Filter by user ID",
"name": "user_id",
"in": "query"
},
{
"type": "string",
"description": "Filter by module (e.g. cards, branch-users)",
"name": "module",
"in": "query"
},
{
"type": "string",
"description": "Filter by action (create, update, delete)",
"name": "action",
"in": "query"
},
{
"type": "integer",
"default": 1,
"description": "Page number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"default": 10,
"description": "Items per page",
"name": "limit",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/appresult.AppSuccess"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/appresult.AppError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/appresult.AppError"
}
}
}
}
},
"/activity-logs/{id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Returns a single activity log entry",
"produces": [
"application/json"
],
"tags": [
"activity-logs"
],
"summary": "Get activity log by ID",
"parameters": [
{
"type": "integer",
"description": "Activity log ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/appresult.AppSuccess"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/appresult.AppError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/appresult.AppError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/appresult.AppError"
}
}
}
}
},
"/branch-users": {
"get": {
"security": [

View File

@@ -1221,6 +1221,85 @@ info:
title: Service APIs
version: "1.0"
paths:
/activity-logs:
get:
description: Returns a paginated audit trail of user actions (create/update/delete)
parameters:
- description: Filter by user ID
in: query
name: user_id
type: integer
- description: Filter by module (e.g. cards, branch-users)
in: query
name: module
type: string
- description: Filter by action (create, update, delete)
in: query
name: action
type: string
- default: 1
description: Page number
in: query
name: page
type: integer
- default: 10
description: Items per page
in: query
name: limit
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/appresult.AppSuccess'
"400":
description: Bad Request
schema:
$ref: '#/definitions/appresult.AppError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/appresult.AppError'
security:
- BearerAuth: []
summary: List activity logs
tags:
- activity-logs
/activity-logs/{id}:
get:
description: Returns a single activity log entry
parameters:
- description: Activity log ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/appresult.AppSuccess'
"400":
description: Bad Request
schema:
$ref: '#/definitions/appresult.AppError'
"404":
description: Not Found
schema:
$ref: '#/definitions/appresult.AppError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/appresult.AppError'
security:
- BearerAuth: []
summary: Get activity log by ID
tags:
- activity-logs
/branch-users:
get:
description: Returns the authenticated user's branch-user assignments with the