API: adres strukturalny w endpoints /gyms (REAL wymaga ulicy/kodu/miasta, location derivowane, merge przy PATCH)

This commit is contained in:
Tilumca
2026-10-15 00:34:12 +02:00
parent 5db1c7ebbc
commit c56d9d12e6
5 changed files with 133 additions and 9 deletions

View File

@@ -204,7 +204,7 @@ export const openapi: Record<string, unknown> = {
},
post: {
tags: ['Gyms'],
summary: 'Create a gym (creator becomes its OWNER)',
summary: 'Create a gym (creator becomes OWNER; admins only for REAL, REAL requires address)',
security: [{ bearerAuth: [] }],
requestBody: {
required: true,
@@ -215,7 +215,17 @@ export const openapi: Record<string, unknown> = {
required: ['name'],
properties: {
name: { type: 'string' },
location: { type: 'string' },
kind: { type: 'string', enum: ['VIRTUAL', 'REAL'], default: 'VIRTUAL' },
isPrivate: { type: 'boolean', description: 'Tylko dla VIRTUAL' },
location: {
type: 'string',
description: 'Swobodna lokalizacja (VIRTUAL); dla REAL derivowana z adresu',
},
addressLine1: { type: 'string', description: 'Ulica i numer (REAL)' },
addressLine2: { type: 'string', nullable: true },
postalCode: { type: 'string', description: 'Kod pocztowy 00-001 (REAL)' },
city: { type: 'string', description: 'Miejscowość (REAL)' },
countryCode: { type: 'string', default: 'PL', description: 'ISO 3166-1 alpha-2' },
availability: {
type: 'array',
description: '7 dni (Pon-Niedz), każdy null lub { start, end }',