diff --git a/backend/internal/certificate.js b/backend/internal/certificate.js index f776474d..76eb8fa5 100644 --- a/backend/internal/certificate.js +++ b/backend/internal/certificate.js @@ -584,7 +584,7 @@ const internalCertificate = { } }); - const certificate = internalCertificate.update(access, { + const certificate = await internalCertificate.update(access, { id: data.id, expires_on: moment(validations.certificate.dates.to, "X").format("YYYY-MM-DD HH:mm:ss"), domain_names: [validations.certificate.cn], diff --git a/backend/schema/components/audit-log-list.json b/backend/schema/components/audit-log-list.json new file mode 100644 index 00000000..74368528 --- /dev/null +++ b/backend/schema/components/audit-log-list.json @@ -0,0 +1,7 @@ +{ + "type": "array", + "description": "Audit Log list", + "items": { + "$ref": "./audit-log-object.json" + } +} diff --git a/backend/schema/components/audit-log-object.json b/backend/schema/components/audit-log-object.json index 3e5e8594..4ed25e5c 100644 --- a/backend/schema/components/audit-log-object.json +++ b/backend/schema/components/audit-log-object.json @@ -1,7 +1,16 @@ { "type": "object", "description": "Audit Log object", - "required": ["id", "created_on", "modified_on", "user_id", "object_type", "object_id", "action", "meta"], + "required": [ + "id", + "created_on", + "modified_on", + "user_id", + "object_type", + "object_id", + "action", + "meta" + ], "additionalProperties": false, "properties": { "id": { @@ -27,6 +36,9 @@ }, "meta": { "type": "object" + }, + "user": { + "$ref": "./user-object.json" } } } diff --git a/backend/schema/components/stream-object.json b/backend/schema/components/stream-object.json index 848c30e6..d4ba0a27 100644 --- a/backend/schema/components/stream-object.json +++ b/backend/schema/components/stream-object.json @@ -31,7 +31,7 @@ }, { "type": "string", - "format": "ipv4" + "format": "^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$" }, { "type": "string", diff --git a/backend/schema/paths/audit-log/get.json b/backend/schema/paths/audit-log/get.json index bc43e29d..ecda9cef 100644 --- a/backend/schema/paths/audit-log/get.json +++ b/backend/schema/paths/audit-log/get.json @@ -1,6 +1,6 @@ { - "operationId": "getAuditLog", - "summary": "Get Audit Log", + "operationId": "getAuditLogs", + "summary": "Get Audit Logs", "tags": ["Audit Log"], "security": [ { @@ -44,7 +44,7 @@ } }, "schema": { - "$ref": "../../components/audit-log-object.json" + "$ref": "../../components/audit-log-list.json" } } } diff --git a/backend/schema/paths/audit-log/id/get.json b/backend/schema/paths/audit-log/id/get.json new file mode 100644 index 00000000..74f59723 --- /dev/null +++ b/backend/schema/paths/audit-log/id/get.json @@ -0,0 +1,73 @@ +{ + "operationId": "getAuditLog", + "summary": "Get Audit Log Event", + "tags": [ + "Audit Log" + ], + "security": [ + { + "BearerAuth": [ + "audit-log" + ] + } + ], + "parameters": [ + { + "in": "path", + "name": "id", + "schema": { + "type": "integer", + "minimum": 1 + }, + "required": true, + "example": 1 + } + ], + "responses": { + "200": { + "description": "200 response", + "content": { + "application/json": { + "examples": { + "default": { + "value": { + "id": 1, + "created_on": "2025-09-15T17:27:45.000Z", + "modified_on": "2025-09-15T17:27:45.000Z", + "user_id": 1, + "object_type": "user", + "object_id": 1, + "action": "created", + "meta": { + "id": 1, + "created_on": "2025-09-15T17:27:45.000Z", + "modified_on": "2025-09-15T17:27:45.000Z", + "is_disabled": false, + "email": "jc@jc21.com", + "name": "Jamie", + "nickname": "Jamie", + "avatar": "//www.gravatar.com/avatar/6193176330f8d38747f038c170ddb193?default=mm", + "roles": [ + "admin" + ], + "permissions": { + "visibility": "all", + "proxy_hosts": "manage", + "redirection_hosts": "manage", + "dead_hosts": "manage", + "streams": "manage", + "access_lists": "manage", + "certificates": "manage" + } + } + } + } + }, + "schema": { + "$ref": "../../../components/audit-log-object.json" + } + } + } + } + } +} diff --git a/backend/schema/swagger.json b/backend/schema/swagger.json index 4a502b4e..b1076916 100644 --- a/backend/schema/swagger.json +++ b/backend/schema/swagger.json @@ -29,6 +29,11 @@ "$ref": "./paths/audit-log/get.json" } }, + "/audit-log/{id}": { + "get": { + "$ref": "./paths/audit-log/id/get.json" + } + }, "/nginx/access-lists": { "get": { "$ref": "./paths/nginx/access-lists/get.json"