Plany i sesje: porzucenie/konczenie tylko z ACTIVE, przyszle dni bez skip, usuwanie tylko cwiczen dodanych do sesji

This commit is contained in:
tisachi
2026-10-11 16:34:47 +02:00
parent 42798939a5
commit cfac9dadd0
10 changed files with 415 additions and 86 deletions

View File

@@ -610,17 +610,27 @@ export const openapi: Record<string, unknown> = {
'/plans/{id}/abandon': {
post: {
tags: ['Plans'],
summary: 'Abandon plan',
summary: 'Abandon plan (only from ACTIVE status)',
security: [{ bearerAuth: [] }],
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
responses: {
200: { description: 'OK' },
400: { description: 'Only an active plan can be abandoned' },
404: { description: 'Plan not found' },
},
},
},
'/plans/{id}/complete': {
post: {
tags: ['Plans'],
summary: 'Manually archive plan',
summary: 'Manually archive plan (only from ACTIVE status)',
security: [{ bearerAuth: [] }],
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
responses: {
200: { description: 'OK' },
400: { description: 'Only an active plan can be completed' },
404: { description: 'Plan not found' },
},
},
},
'/plans/{id}/share': {
@@ -670,9 +680,16 @@ export const openapi: Record<string, unknown> = {
'/days/{dayId}/sessions': {
post: {
tags: ['Sessions'],
summary: 'Start session for a planned day (one active session per user)',
summary:
'Start session for a planned day (requires ACTIVE plan, one active session per user)',
security: [{ bearerAuth: [] }],
parameters: [{ name: 'dayId', in: 'path', required: true, schema: { type: 'string' } }],
responses: {
201: { description: 'Session started' },
400: { description: 'Training plan is not active / Day is not in planned state' },
404: { description: 'Day not found' },
409: { description: 'You already have an active session' },
},
},
},
'/sessions/{id}': {
@@ -706,7 +723,8 @@ export const openapi: Record<string, unknown> = {
'/sessions/exercises/{id}': {
patch: {
tags: ['Sessions'],
summary: 'Hide or remove exercise (data kept for restore)',
summary:
'Hide or remove exercise (data kept for restore); removing allowed only for exercises added to the session',
security: [{ bearerAuth: [] }],
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
requestBody: {
@@ -719,6 +737,11 @@ export const openapi: Record<string, unknown> = {
},
},
},
responses: {
200: { description: 'OK' },
400: { description: 'Only exercises added to the session can be removed' },
404: { description: 'Session exercise not found' },
},
},
},
'/sessions/exercises/{id}/sets': {