Plany: wizard 3-etapowy tworzenia/edycji, silownia i alias tygodnia (UX + API + migracja)

This commit is contained in:
tisachi
2026-09-12 15:16:13 +02:00
parent a2d31ee46b
commit ef2fa726bb
26 changed files with 1340 additions and 361 deletions

View File

@@ -364,7 +364,10 @@ export const openapi: Record<string, unknown> = {
schema: {
type: 'object',
required: ['name'],
properties: { name: { type: 'string' }, description: { type: 'string', nullable: true } },
properties: {
name: { type: 'string' },
description: { type: 'string', nullable: true },
},
},
},
},
@@ -457,7 +460,7 @@ export const openapi: Record<string, unknown> = {
post: {
tags: ['Plans'],
summary:
'Create plan: weeks -> days (dayOfWeek) -> exercises -> sets. Optional startDate (a Monday) creates and activates the plan in one step',
'Create plan: weeks -> days (dayOfWeek) -> exercises -> sets. Optional startDate (a Monday) creates and activates the plan in one step. Optional gymId (informational; the plan owner must be a gym member) and per-week customName (alias, max 40)',
security: [{ bearerAuth: [] }],
requestBody: {
required: true,
@@ -469,6 +472,11 @@ export const openapi: Record<string, unknown> = {
properties: {
title: { type: 'string' },
weeksCount: { type: 'integer', minimum: 1, maximum: 52 },
gymId: {
type: 'string',
nullable: true,
description: 'Informational gym; the plan owner must be a member of it',
},
startDate: {
type: 'string',
description: 'YYYY-MM-DD, must be a Monday of the current or a future week',
@@ -480,6 +488,7 @@ export const openapi: Record<string, unknown> = {
required: ['index', 'days'],
properties: {
index: { type: 'integer', minimum: 0 },
customName: { type: 'string', nullable: true, maxLength: 40 },
days: {
type: 'array',
items: {
@@ -538,7 +547,8 @@ export const openapi: Record<string, unknown> = {
},
patch: {
tags: ['Plans'],
summary: 'Replace plan structure (draft only)',
summary:
'Replace plan structure (draft only). Same body as POST /plans (gymId and weeks[].customName included)',
security: [{ bearerAuth: [] }],
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
},
@@ -559,7 +569,11 @@ export const openapi: Record<string, unknown> = {
required: true,
content: {
'application/json': {
schema: { type: 'object', required: ['startDate'], properties: { startDate: { type: 'string' } } },
schema: {
type: 'object',
required: ['startDate'],
properties: { startDate: { type: 'string' } },
},
},
},
},
@@ -607,7 +621,11 @@ export const openapi: Record<string, unknown> = {
required: true,
content: {
'application/json': {
schema: { type: 'object', required: ['exerciseId'], properties: { exerciseId: { type: 'string' } } },
schema: {
type: 'object',
required: ['exerciseId'],
properties: { exerciseId: { type: 'string' } },
},
},
},
},
@@ -673,7 +691,8 @@ export const openapi: Record<string, unknown> = {
'/sessions/{id}/abandon': {
post: {
tags: ['Sessions'],
summary: 'Abandon session (data kept, day -> skipped, the training cannot be executed again)',
summary:
'Abandon session (data kept, day -> skipped, the training cannot be executed again)',
security: [{ bearerAuth: [] }],
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
},
@@ -691,7 +710,12 @@ export const openapi: Record<string, unknown> = {
summary: 'Calendar — training days of the active plan in a month',
security: [{ bearerAuth: [] }],
parameters: [
{ name: 'month', in: 'query', schema: { type: 'string' }, description: 'YYYY-MM (default: current)' },
{
name: 'month',
in: 'query',
schema: { type: 'string' },
description: 'YYYY-MM (default: current)',
},
],
},
},