Admin: widacznosc konta usera - lastLoginAt + IP w logach logowania + kafel historii konta (kto edytowal dane, historia kar) ; GET /admin/users/:id/activity
This commit is contained in:
@@ -44,7 +44,8 @@ export const openapi: Record<string, unknown> = {
|
||||
post: {
|
||||
tags: ['Auth'],
|
||||
summary: 'Login',
|
||||
description: 'Writes an ActivityLog entry: user.logged_in (details: client = app|admin).',
|
||||
description:
|
||||
'Writes an ActivityLog entry: user.logged_in (details: client = app|admin, ip = request address). Updates user.lastLoginAt.',
|
||||
requestBody: {
|
||||
required: true,
|
||||
content: {
|
||||
@@ -89,7 +90,7 @@ export const openapi: Record<string, unknown> = {
|
||||
tags: ['Auth'],
|
||||
summary: 'Logout (clears refresh cookie)',
|
||||
description:
|
||||
'Writes an ActivityLog entry: user.logged_out (only when a refresh token is present).',
|
||||
'Writes an ActivityLog entry: user.logged_out (only when a refresh token is present; details: client, ip).',
|
||||
},
|
||||
},
|
||||
'/me': {
|
||||
@@ -1658,5 +1659,32 @@ export const openapi: Record<string, unknown> = {
|
||||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||||
},
|
||||
},
|
||||
'/admin/users/{id}/activity': {
|
||||
get: {
|
||||
tags: ['Admin'],
|
||||
summary:
|
||||
'Account history — audit entries performed on the user: logins (IP), edits, bans/suspensions, admin role, creation/deletion (admin)',
|
||||
security: [{ bearerAuth: [] }],
|
||||
parameters: [
|
||||
{ name: 'id', in: 'path', required: true, schema: { type: 'string' } },
|
||||
{
|
||||
name: 'limit',
|
||||
in: 'query',
|
||||
required: false,
|
||||
schema: { type: 'integer', minimum: 1, maximum: 500, default: 50 },
|
||||
},
|
||||
{
|
||||
name: 'offset',
|
||||
in: 'query',
|
||||
required: false,
|
||||
schema: { type: 'integer', minimum: 0, default: 0 },
|
||||
},
|
||||
],
|
||||
responses: {
|
||||
200: { description: 'OK — { logs, total }, newest first' },
|
||||
404: { description: 'User not found' },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user