API: konsola sirowni - logi operacji (GET /gyms/:id/logs), czlonkowie z q/role, related, lista sirowni z q/kind + owners; usuwanie czlonkostwa z powodem w audycie membership.deleted (swagger, testy integracyjne)
This commit is contained in:
@@ -1797,33 +1797,6 @@ export const openapi: Record<string, unknown> = {
|
||||
],
|
||||
},
|
||||
},
|
||||
'/admin/gyms/occupancy': {
|
||||
get: {
|
||||
tags: ['Admin'],
|
||||
summary: 'Live occupancy of all real gyms (admin)',
|
||||
security: [{ bearerAuth: [] }],
|
||||
responses: {
|
||||
200: { description: 'OK, returns { gyms: [{ gymId, name, capacity, count }] }' },
|
||||
},
|
||||
},
|
||||
},
|
||||
'/admin/gyms/{id}/presence-stats': {
|
||||
get: {
|
||||
tags: ['Admin'],
|
||||
summary:
|
||||
'Presence telemetry of a gym (admin): live count, day×hour heatmap, avg stay, visits/day, peak, top equipment (default range: last 30 days)',
|
||||
security: [{ bearerAuth: [] }],
|
||||
parameters: [
|
||||
{ name: 'id', in: 'path', required: true, schema: { type: 'string' } },
|
||||
{ name: 'from', in: 'query', schema: { type: 'string', format: 'date-time' } },
|
||||
{ name: 'to', in: 'query', schema: { type: 'string', format: 'date-time' } },
|
||||
],
|
||||
responses: {
|
||||
200: { description: 'OK, returns { gym, stats }' },
|
||||
404: { description: 'Gym not found' },
|
||||
},
|
||||
},
|
||||
},
|
||||
'/admin/gyms/{id}/equipment-usage': {
|
||||
get: {
|
||||
tags: ['Admin'],
|
||||
@@ -1847,8 +1820,23 @@ export const openapi: Record<string, unknown> = {
|
||||
'/admin/gyms': {
|
||||
get: {
|
||||
tags: ['Admin'],
|
||||
summary: 'List gyms (admin)',
|
||||
summary:
|
||||
'List gyms (admin). Query: q (matches name/location/city/address/postal code/owner name or email), kind (REAL|VIRTUAL). Each gym includes owners[] (OWNER members) and _count.memberships.',
|
||||
security: [{ bearerAuth: [] }],
|
||||
parameters: [
|
||||
{
|
||||
name: 'q',
|
||||
in: 'query',
|
||||
required: false,
|
||||
schema: { type: 'string', maxLength: 200 },
|
||||
},
|
||||
{
|
||||
name: 'kind',
|
||||
in: 'query',
|
||||
required: false,
|
||||
schema: { type: 'string', enum: ['REAL', 'VIRTUAL'] },
|
||||
},
|
||||
],
|
||||
},
|
||||
post: {
|
||||
tags: ['Admin'],
|
||||
@@ -1930,6 +1918,79 @@ export const openapi: Record<string, unknown> = {
|
||||
],
|
||||
},
|
||||
},
|
||||
'/admin/gyms/{id}/logs': {
|
||||
get: {
|
||||
tags: ['Admin'],
|
||||
summary:
|
||||
"Audit log of one gym (admin) — gym.* entries, membership.* tied to this gym (details.gymId) and this gym's claims/invitations",
|
||||
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, returns { logs, total }' },
|
||||
404: { description: 'Gym not found' },
|
||||
},
|
||||
},
|
||||
},
|
||||
'/admin/gyms/{id}/members': {
|
||||
get: {
|
||||
tags: ['Admin'],
|
||||
summary:
|
||||
'Members of one gym (admin) — OWNER first, then by join date; roles, joinedAt, account status, checkedInNow',
|
||||
security: [{ bearerAuth: [] }],
|
||||
parameters: [
|
||||
{ name: 'id', in: 'path', required: true, schema: { type: 'string' } },
|
||||
{ name: 'q', in: 'query', required: false, schema: { type: 'string', maxLength: 200 } },
|
||||
{
|
||||
name: 'role',
|
||||
in: 'query',
|
||||
required: false,
|
||||
schema: { type: 'string', enum: ['OWNER', 'TRAINER', 'MEMBER'] },
|
||||
},
|
||||
{
|
||||
name: 'limit',
|
||||
in: 'query',
|
||||
required: false,
|
||||
schema: { type: 'integer', minimum: 1, maximum: 200, default: 50 },
|
||||
},
|
||||
{
|
||||
name: 'offset',
|
||||
in: 'query',
|
||||
required: false,
|
||||
schema: { type: 'integer', minimum: 0, default: 0 },
|
||||
},
|
||||
],
|
||||
responses: {
|
||||
200: { description: 'OK, returns { members, total }' },
|
||||
404: { description: 'Gym not found' },
|
||||
},
|
||||
},
|
||||
},
|
||||
'/admin/gyms/{id}/related': {
|
||||
get: {
|
||||
tags: ['Admin'],
|
||||
summary: 'Claims and invitations tied to one gym (admin), newest first',
|
||||
security: [{ bearerAuth: [] }],
|
||||
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
||||
responses: {
|
||||
200: { description: 'OK, returns { claims, invitations }' },
|
||||
404: { description: 'Gym not found' },
|
||||
},
|
||||
},
|
||||
},
|
||||
'/admin/gyms/{id}/exceptions': {
|
||||
get: {
|
||||
tags: ['Admin'],
|
||||
@@ -2136,12 +2197,25 @@ export const openapi: Record<string, unknown> = {
|
||||
tags: ['Admin'],
|
||||
summary: 'Remove gym membership (admin)',
|
||||
description:
|
||||
'Writes an ActivityLog entry: membership.deleted (details: userId, gymId, roles).',
|
||||
'Writes an ActivityLog entry: membership.deleted (details: userId, gymId, roles, optional reason).',
|
||||
security: [{ bearerAuth: [] }],
|
||||
parameters: [
|
||||
{ name: 'id', in: 'path', required: true, schema: { type: 'string' } },
|
||||
{ name: 'gymId', in: 'path', required: true, schema: { type: 'string' } },
|
||||
],
|
||||
requestBody: {
|
||||
required: false,
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
reason: { type: 'string', minLength: 3, maxLength: 300 },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
'/admin/users/{id}/killstreak': {
|
||||
|
||||
Reference in New Issue
Block a user