openapi: 3.1.0 info: title: API FitConnect - Backend Node.js + MySQL version: "1.0.0" description: | API do **FitConnect** — plataforma de treinos, nutrição e agenda. - **Stack**: NestJS, TypeScript, Prisma, MySQL. - **Autenticação**: JWT Bearer (Access) + Refresh Token via **cookie HttpOnly** (`refresh_token`). - **Datas**: todas as datas/horários em **UTC** (o front converte para o fuso do usuário). - **Paginação padrão**: `?page=&limit=` e, quando aplicável, `?search=`. - **Soft delete**: itens com `deletedAt` não são retornados por padrão. contact: name: Equipe FitConnect url: https://fitconnect.example.com email: contato@fitconnect.com license: name: MIT url: https://opensource.org/licenses/MIT servers: - url: http://localhost:3001 description: Servidor local (desenvolvimento) - url: https://api.fitconnect.com description: Servidor de produção tags: - name: Auth description: Autenticação e sessão - name: Usuários description: Perfis, papéis e gerenciamento de usuários (RBAC) - name: Exercícios description: Catálogo de exercícios - name: Treinos description: Criação e listagem de treinos - name: Nutrição description: Planos alimentares, refeições e itens - name: Agenda description: Agendamentos e eventos - name: Gemini description: Integração futura com Google Gemini (placeholder) security: - bearerAuth: [] components: securitySchemes: bearerAuth: type: http scheme: bearer bearerFormat: JWT description: | **JWT Bearer** — envie `Authorization: Bearer ` em chamadas autenticadas. refreshCookie: type: apiKey in: cookie name: refresh_token description: | **Refresh Token** em cookie **HttpOnly** (`refresh_token`), lido pelo backend em `/auth/refresh`. Observação: a UI do Swagger geralmente **não envia** cookies HttpOnly a partir do navegador. schemas: # Enums Papel: type: string enum: [cliente, personal, nutricionista, admin] Foco: type: string enum: [hipertrofia, emagrecimento, manutenção] TipoEvento: type: string enum: [treino, nutricao, consulta] StatusEvento: type: string enum: [agendado, concluido, cancelado] # Shared ErrorResponse: type: object properties: sucesso: { type: boolean, example: false } statusCode: { type: integer, example: 400 } caminho: { type: string, example: "/rota" } timestamp: { type: string, format: date-time, example: "2025-10-23T12:00:00.000Z" } erro: description: Pode ser string ou objeto com mensagens de validação oneOf: - type: string example: "Requisição inválida" - type: object example: message: ["campo X é obrigatório"] Paginacao: type: object properties: total: { type: integer, example: 42 } page: { type: integer, example: 1 } limit: { type: integer, example: 20 } items: type: array items: {} required: [total, page, limit, items] # Auth RegistrarRequest: type: object properties: nome: { type: string, example: "Carlos Silva" } email: { type: string, format: email, example: "carlos@email.com" } senha: { type: string, minLength: 6, example: "123456" } peso: { type: number, nullable: true, example: 78 } altura: { type: number, nullable: true, example: 1.78 } foco: { $ref: "#/components/schemas/Foco" } objetivo: { type: string, nullable: true, example: "Ganho de massa" } possuiPersonal: { type: boolean, example: true } possuiNutricionista: { type: boolean, example: true } required: [nome, email, senha] LoginRequest: type: object properties: email: { type: string, format: email, example: "usuario@email.com" } senha: { type: string, example: "123456" } required: [email, senha] AuthUsuario: type: object properties: id: { type: string, example: "clxUser01" } nome: { type: string, example: "Carlos Silva" } email: { type: string, example: "usuario@email.com" } avatarUrl: { type: string, nullable: true, example: "https://cdn.exemplo/avatar.png" } peso: { type: number, nullable: true, example: 78 } altura: { type: number, nullable: true, example: 1.78 } foco: { $ref: "#/components/schemas/Foco" } objetivo: { type: string, nullable: true, example: "Ganho de massa" } possuiPersonal: { type: boolean, example: true } possuiNutricionista: { type: boolean, example: true } papel: { $ref: "#/components/schemas/Papel" } createdAt: { type: string, format: date-time, example: "2025-10-22T11:00:00.000Z" } updatedAt: { type: string, format: date-time, example: "2025-10-22T11:00:00.000Z" } TokensResponse: type: object properties: accessToken: { type: string, example: "eyJhbGciOiJIUzI1NiIsInR5cCI6..." } refreshToken: { type: string, example: "eyJhbGciOiJIUzI1NiIsInR5cCI6..." } usuario: { $ref: "#/components/schemas/AuthUsuario" } required: [accessToken, refreshToken, usuario] # Usuários Usuario: allOf: - $ref: "#/components/schemas/AuthUsuario" AtualizarUsuarioRequest: type: object properties: nome: { type: string, example: "Carlos Silva" } avatarUrl: { type: string, example: "https://cdn.exemplo/avatar2.png" } peso: { type: number, example: 79.2 } altura: { type: number, example: 1.78 } foco: { $ref: "#/components/schemas/Foco" } objetivo: { type: string, example: "Ganho de massa e resistência" } possuiPersonal: { type: boolean, example: true } possuiNutricionista: { type: boolean, example: true } # Exercícios Exercicio: type: object properties: id: { type: string, example: "ex1" } nome: { type: string, example: "Supino reto" } grupoMuscular: { type: string, example: "Peito" } descricao: { type: string, nullable: true, example: "Execução no banco reto" } videoUrl: { type: string, nullable: true, example: "https://videos.exemplo/supino.mp4" } criadoPorId: { type: string, example: "clxPersonal01" } createdAt: { type: string, format: date-time } updatedAt: { type: string, format: date-time } CriarExercicioRequest: type: object properties: nome: { type: string, example: "Agachamento livre" } grupoMuscular: { type: string, example: "Pernas" } descricao: { type: string, example: "Postura ereta, barra nas costas" } videoUrl: { type: string, example: "https://videos.exemplo/agachamento.mp4" } criadoPorId: { type: string, example: "clxPersonal01" } required: [nome, grupoMuscular, criadoPorId] AtualizarExercicioRequest: type: object properties: nome: { type: string, example: "Agachamento livre" } grupoMuscular: { type: string, example: "Pernas" } descricao: { type: string, example: "Execução controlada" } videoUrl: { type: string, example: "https://videos.exemplo/agachamento-novo.mp4" } # Treinos TreinoExercicio: type: object properties: id: { type: string, example: "tx1" } exercicioId: { type: string, example: "ex1" } series: { type: integer, example: 4 } repeticoes: { type: integer, example: 10 } descansoSeg: { type: integer, example: 90 } ordem: { type: integer, example: 1 } Treino: type: object properties: id: { type: string, example: "tr1" } usuarioId: { type: string, example: "clxUser01" } nome: { type: string, example: "Treino Base" } descricao: { type: string, nullable: true, example: "Full body iniciante" } duracao: { type: integer, nullable: true, example: 60 } criadoPor: { type: string, example: "clxPersonal01" } concluido: { type: boolean, example: false } createdAt: { type: string, format: date-time } updatedAt: { type: string, format: date-time } exercicios: type: array items: { $ref: "#/components/schemas/TreinoExercicio" } CriarTreinoRequest: type: object properties: usuarioId: { type: string, example: "clxUser01" } nome: { type: string, example: "Treino Base" } descricao: { type: string, example: "Full body iniciante" } duracao: { type: integer, example: 60 } criadoPor: { type: string, example: "clxPersonal01" } concluido: { type: boolean, example: false } exercicios: type: array items: type: object properties: exercicioId: { type: string, example: "ex1" } series: { type: integer, example: 4 } repeticoes: { type: integer, example: 10 } descansoSeg: { type: integer, example: 90 } ordem: { type: integer, example: 1 } required: [usuarioId, nome, criadoPor, exercicios] AtualizarTreinoRequest: type: object properties: nome: { type: string, example: "Treino Intermediário" } descricao: { type: string, example: "Ênfase em superiores" } duracao: { type: integer, example: 70 } concluido: { type: boolean, example: true } # Nutrição ItemAlimentar: type: object properties: id: { type: string, example: "it1" } nome: { type: string, example: "Ovos mexidos" } calorias: { type: integer, example: 200 } proteina: { type: integer, example: 15 } carboidrato: { type: integer, example: 2 } gordura: { type: integer, example: 14 } Refeicao: type: object properties: id: { type: string, example: "rf1" } nome: { type: string, example: "Café da manhã" } horario: { type: string, example: "08:00" } calorias: { type: integer, example: 600 } proteina: { type: integer, example: 30 } carboidrato: { type: integer, example: 70 } gordura: { type: integer, example: 20 } itens: type: array items: { $ref: "#/components/schemas/ItemAlimentar" } PlanoAlimentar: type: object properties: id: { type: string, example: "pl1" } usuarioId: { type: string, example: "clxUser01" } titulo: { type: string, example: "Hipertrofia — 2.400 kcal" } caloriasTotais: { type: integer, example: 2400 } proteinaTotal: { type: integer, example: 160 } carboidratoTotal: { type: integer, example: 260 } gorduraTotal: { type: integer, example: 80 } createdAt: { type: string, format: date-time } updatedAt: { type: string, format: date-time } refeicoes: type: array items: { $ref: "#/components/schemas/Refeicao" } CriarPlanoRequest: type: object properties: usuarioId: { type: string, example: "clxUser01" } titulo: { type: string, example: "Hipertrofia — 2.400 kcal" } caloriasTotais: { type: integer, example: 2400 } proteinaTotal: { type: integer, example: 160 } carboidratoTotal: { type: integer, example: 260 } gorduraTotal: { type: integer, example: 80 } refeicoes: type: array items: type: object properties: nome: { type: string, example: "Café da manhã" } horario: { type: string, example: "08:00" } calorias: { type: integer, example: 600 } proteina: { type: integer, example: 30 } carboidrato: { type: integer, example: 70 } gordura: { type: integer, example: 20 } itens: type: array items: type: object properties: nome: { type: string, example: "Ovos mexidos" } calorias: { type: integer, example: 200 } proteina: { type: integer, example: 15 } carboidrato: { type: integer, example: 2 } gordura: { type: integer, example: 14 } required: [usuarioId, titulo, caloriasTotais, proteinaTotal, carboidratoTotal, gorduraTotal, refeicoes] AtualizarPlanoRequest: type: object properties: titulo: { type: string, example: "Hipertrofia — 2.500 kcal" } caloriasTotais: { type: integer, example: 2500 } proteinaTotal: { type: integer, example: 170 } carboidratoTotal: { type: integer, example: 270 } gorduraTotal: { type: integer, example: 85 } # Agenda EventoAgendado: type: object properties: id: { type: string, example: "ev1" } usuarioId: { type: string, example: "clxUser01" } titulo: { type: string, example: "Treino A" } tipo: { $ref: "#/components/schemas/TipoEvento" } dataHora: { type: string, format: date-time, example: "2025-10-24T14:00:00Z" } duracaoMin: { type: integer, example: 60 } local: { type: string, nullable: true, example: "Academia Fit Top" } comProfissional: { type: boolean, example: true } isOnline: { type: boolean, example: false } status: { $ref: "#/components/schemas/StatusEvento" } createdAt: { type: string, format: date-time } updatedAt: { type: string, format: date-time } CriarEventoRequest: type: object properties: usuarioId: { type: string, example: "clxUser01" } titulo: { type: string, example: "Treino A" } tipo: { $ref: "#/components/schemas/TipoEvento" } dataHora: { type: string, format: date-time, example: "2025-10-24T14:00:00Z" } duracaoMin: { type: integer, example: 60 } local: { type: string, example: "Academia Fit Top" } comProfissional: { type: boolean, example: true } isOnline: { type: boolean, example: false } required: [usuarioId, titulo, tipo, dataHora, duracaoMin] AtualizarStatusEventoRequest: type: object properties: status: { $ref: "#/components/schemas/StatusEvento" } required: [status] responses: UnauthorizedError: description: Não autorizado (JWT ausente ou inválido) content: application/json: schema: { $ref: "#/components/schemas/ErrorResponse" } examples: padrao: value: { statusCode: 401, message: "Não autorizado" } NotFoundError: description: Recurso não encontrado content: application/json: schema: { $ref: "#/components/schemas/ErrorResponse" } examples: padrao: value: { statusCode: 404, message: "Recurso não encontrado" } BadRequestError: description: Erro de validação ou requisição inválida content: application/json: schema: { $ref: "#/components/schemas/ErrorResponse" } examples: validacao: value: sucesso: false statusCode: 400 caminho: "/rota" timestamp: "2025-10-23T12:00:00.000Z" erro: message: ["campo X é obrigatório"] paths: ######################################## # AUTH # ######################################## /auth/registrar: post: tags: [Auth] summary: Registrar novo usuário description: Cria um novo usuário e retorna tokens JWT (access/refresh) + dados públicos do usuário. requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/RegistrarRequest" } examples: registrar: value: nome: "Carlos Silva" email: "carlos@email.com" senha: "123456" foco: "hipertrofia" objetivo: "Ganho de massa" possuiPersonal: true possuiNutricionista: true responses: "201": description: Usuário registrado content: application/json: schema: { $ref: "#/components/schemas/TokensResponse" } "400": $ref: "#/components/responses/BadRequestError" /auth/login: post: tags: [Auth] summary: Realiza login do usuário description: Autentica por e-mail e senha e retorna tokens JWT (access/refresh) + dados públicos do usuário. requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/LoginRequest" } examples: login: value: email: "usuario@email.com" senha: "123456" responses: "200": description: Login realizado content: application/json: schema: { $ref: "#/components/schemas/TokensResponse" } "401": $ref: "#/components/responses/UnauthorizedError" /auth/refresh: post: tags: [Auth] summary: Renova o access token usando o refresh token description: | Gera novos tokens a partir do **refresh token** armazenado em **cookie HttpOnly** `refresh_token`. Observação: a UI do Swagger normalmente não envia cookies HttpOnly automaticamente. security: - refreshCookie: [] responses: "200": description: Tokens renovados content: application/json: schema: { $ref: "#/components/schemas/TokensResponse" } "401": $ref: "#/components/responses/UnauthorizedError" /auth/me: get: tags: [Auth] summary: Retorna o perfil do usuário autenticado security: - bearerAuth: [] responses: "200": description: Perfil autenticado content: application/json: schema: type: object properties: user: $ref: "#/components/schemas/AuthUsuario" "401": $ref: "#/components/responses/UnauthorizedError" /auth/logout: post: tags: [Auth] summary: Efetua logout e invalida o refresh token description: Remove o hash do refresh token no servidor e limpa o cookie `refresh_token`. security: - bearerAuth: [] responses: "200": description: Logout realizado content: application/json: schema: type: object properties: message: { type: string, example: "Logout realizado" } "401": $ref: "#/components/responses/UnauthorizedError" ######################################## # USUÁRIOS # ######################################## /usuarios: get: tags: [Usuários] summary: Lista usuários (admin) description: Lista usuários com filtros de paginação e busca (apenas **admin**). security: - bearerAuth: [] parameters: - name: page in: query schema: { type: integer, minimum: 1, default: 1 } - name: limit in: query schema: { type: integer, minimum: 1, default: 20 } - name: search in: query schema: { type: string } - name: papel in: query schema: { $ref: "#/components/schemas/Papel" } responses: "200": description: Lista paginada de usuários content: application/json: schema: allOf: - $ref: "#/components/schemas/Paginacao" - type: object properties: items: type: array items: { $ref: "#/components/schemas/Usuario" } examples: exemplo: value: total: 2 page: 1 limit: 20 items: - id: "clxUser01" nome: "Carlos Silva" email: "carlos@email.com" papel: "cliente" - id: "clxAdmin01" nome: "Admin" email: "admin@fitconnect.com" papel: "admin" "401": $ref: "#/components/responses/UnauthorizedError" /usuarios/{id}: get: tags: [Usuários] summary: Busca perfil de usuário security: - bearerAuth: [] parameters: - name: id in: path required: true schema: { type: string } responses: "200": description: Usuário encontrado content: application/json: schema: { $ref: "#/components/schemas/Usuario" } "404": $ref: "#/components/responses/NotFoundError" "401": $ref: "#/components/responses/UnauthorizedError" patch: tags: [Usuários] summary: Atualiza perfil (próprio ou admin) description: Usuário pode alterar o próprio perfil; **admin** pode alterar qualquer usuário. security: - bearerAuth: [] parameters: - name: id in: path required: true schema: { type: string } requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/AtualizarUsuarioRequest" } responses: "200": description: Perfil atualizado content: application/json: schema: { $ref: "#/components/schemas/Usuario" } "401": $ref: "#/components/responses/UnauthorizedError" "404": $ref: "#/components/responses/NotFoundError" delete: tags: [Usuários] summary: Exclui (soft delete) um usuário (admin) security: - bearerAuth: [] parameters: - name: id in: path required: true schema: { type: string } responses: "200": description: Usuário excluído logicamente content: application/json: schema: type: object properties: id: { type: string, example: "clxUser01" } deletedAt: { type: string, format: date-time } "401": $ref: "#/components/responses/UnauthorizedError" "404": $ref: "#/components/responses/NotFoundError" ######################################## # EXERCÍCIOS # ######################################## /exercicios: get: tags: [Exercícios] summary: Lista exercícios security: - bearerAuth: [] parameters: - name: page in: query schema: { type: integer, minimum: 1, default: 1 } - name: limit in: query schema: { type: integer, minimum: 1, default: 50 } - name: search in: query schema: { type: string, example: "supino" } responses: "200": description: Lista paginada de exercícios content: application/json: schema: allOf: - $ref: "#/components/schemas/Paginacao" - type: object properties: items: type: array items: { $ref: "#/components/schemas/Exercicio" } "401": $ref: "#/components/responses/UnauthorizedError" post: tags: [Exercícios] summary: Cria um exercício security: - bearerAuth: [] requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/CriarExercicioRequest" } responses: "201": description: Exercício criado content: application/json: schema: { $ref: "#/components/schemas/Exercicio" } "400": $ref: "#/components/responses/BadRequestError" "401": $ref: "#/components/responses/UnauthorizedError" /exercicios/{id}: get: tags: [Exercícios] summary: Busca um exercício por ID security: - bearerAuth: [] parameters: - name: id in: path required: true schema: { type: string } responses: "200": description: Exercício encontrado content: application/json: schema: { $ref: "#/components/schemas/Exercicio" } "404": $ref: "#/components/responses/NotFoundError" "401": $ref: "#/components/responses/UnauthorizedError" patch: tags: [Exercícios] summary: Atualiza um exercício security: - bearerAuth: [] parameters: - name: id in: path required: true schema: { type: string } requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/AtualizarExercicioRequest" } responses: "200": description: Exercício atualizado content: application/json: schema: { $ref: "#/components/schemas/Exercicio" } "401": $ref: "#/components/responses/UnauthorizedError" "404": $ref: "#/components/responses/NotFoundError" delete: tags: [Exercícios] summary: Exclui (soft delete) um exercício security: - bearerAuth: [] parameters: - name: id in: path required: true schema: { type: string } responses: "200": description: Exercício excluído logicamente content: application/json: schema: type: object properties: id: { type: string, example: "ex1" } deletedAt: { type: string, format: date-time } "401": $ref: "#/components/responses/UnauthorizedError" "404": $ref: "#/components/responses/NotFoundError" ######################################## # TREINOS # ######################################## /treinos: get: tags: [Treinos] summary: Lista treinos security: - bearerAuth: [] parameters: - name: usuarioId in: query schema: { type: string } description: Filtra por usuário - name: concluido in: query schema: { type: boolean } - name: page in: query schema: { type: integer, minimum: 1, default: 1 } - name: limit in: query schema: { type: integer, minimum: 1, default: 20 } responses: "200": description: Lista paginada de treinos content: application/json: schema: allOf: - $ref: "#/components/schemas/Paginacao" - type: object properties: items: type: array items: { $ref: "#/components/schemas/Treino" } "401": $ref: "#/components/responses/UnauthorizedError" post: tags: [Treinos] summary: Cria um treino security: - bearerAuth: [] requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/CriarTreinoRequest" } examples: criarTreino: value: usuarioId: "clxUser01" nome: "Treino Base" descricao: "Full body iniciante" duracao: 60 criadoPor: "clxPersonal01" exercicios: - exercicioId: "ex1" series: 4 repeticoes: 10 descansoSeg: 90 ordem: 1 - exercicioId: "ex2" series: 3 repeticoes: 12 descansoSeg: 75 ordem: 2 responses: "201": description: Treino criado content: application/json: schema: { $ref: "#/components/schemas/Treino" } "400": $ref: "#/components/responses/BadRequestError" "401": $ref: "#/components/responses/UnauthorizedError" /treinos/{id}: get: tags: [Treinos] summary: Busca um treino por ID (com exercícios) security: - bearerAuth: [] parameters: - name: id in: path required: true schema: { type: string } responses: "200": description: Treino encontrado content: application/json: schema: { $ref: "#/components/schemas/Treino" } "404": $ref: "#/components/responses/NotFoundError" "401": $ref: "#/components/responses/UnauthorizedError" patch: tags: [Treinos] summary: Atualiza um treino security: - bearerAuth: [] parameters: - name: id in: path required: true schema: { type: string } requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/AtualizarTreinoRequest" } responses: "200": description: Treino atualizado content: application/json: schema: { $ref: "#/components/schemas/Treino" } "401": $ref: "#/components/responses/UnauthorizedError" "404": $ref: "#/components/responses/NotFoundError" delete: tags: [Treinos] summary: Exclui (soft delete) um treino security: - bearerAuth: [] parameters: - name: id in: path required: true schema: { type: string } responses: "200": description: Treino excluído logicamente content: application/json: schema: type: object properties: id: { type: string, example: "tr1" } deletedAt: { type: string, format: date-time } "401": $ref: "#/components/responses/UnauthorizedError" "404": $ref: "#/components/responses/NotFoundError" /treinos/hoje: get: tags: [Treinos] summary: Lista treinos de hoje (não concluídos) do usuário security: - bearerAuth: [] parameters: - name: usuarioId in: query required: true schema: { type: string } responses: "200": description: Treinos do dia content: application/json: schema: allOf: - $ref: "#/components/schemas/Paginacao" - type: object properties: items: type: array items: { $ref: "#/components/schemas/Treino" } "401": $ref: "#/components/responses/UnauthorizedError" ######################################## # NUTRIÇÃO # ######################################## /nutricao/planos: get: tags: [Nutrição] summary: Lista planos alimentares security: - bearerAuth: [] parameters: - name: usuarioId in: query schema: { type: string } - name: page in: query schema: { type: integer, default: 1 } - name: limit in: query schema: { type: integer, default: 20 } responses: "200": description: Lista paginada de planos alimentares content: application/json: schema: allOf: - $ref: "#/components/schemas/Paginacao" - type: object properties: items: type: array items: { $ref: "#/components/schemas/PlanoAlimentar" } "401": $ref: "#/components/responses/UnauthorizedError" post: tags: [Nutrição] summary: Cria um plano alimentar security: - bearerAuth: [] requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/CriarPlanoRequest" } examples: criarPlano: value: usuarioId: "clxUser01" titulo: "Hipertrofia — 2.400 kcal" caloriasTotais: 2400 proteinaTotal: 160 carboidratoTotal: 260 gorduraTotal: 80 refeicoes: - nome: "Café da manhã" horario: "08:00" calorias: 600 proteina: 30 carboidrato: 70 gordura: 20 itens: - nome: "Ovos mexidos" calorias: 200 proteina: 15 carboidrato: 2 gordura: 14 - nome: "Pão integral" calorias: 150 proteina: 6 carboidrato: 28 gordura: 2 responses: "201": description: Plano criado content: application/json: schema: { $ref: "#/components/schemas/PlanoAlimentar" } "400": $ref: "#/components/responses/BadRequestError" "401": $ref: "#/components/responses/UnauthorizedError" /nutricao/planos/{id}: get: tags: [Nutrição] summary: Busca um plano alimentar por ID (com refeições e itens) security: - bearerAuth: [] parameters: - name: id in: path required: true schema: { type: string } responses: "200": description: Plano encontrado content: application/json: schema: { $ref: "#/components/schemas/PlanoAlimentar" } "404": $ref: "#/components/responses/NotFoundError" "401": $ref: "#/components/responses/UnauthorizedError" patch: tags: [Nutrição] summary: Atualiza um plano alimentar security: - bearerAuth: [] parameters: - name: id in: path required: true schema: { type: string } requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/AtualizarPlanoRequest" } responses: "200": description: Plano atualizado content: application/json: schema: { $ref: "#/components/schemas/PlanoAlimentar" } "401": $ref: "#/components/responses/UnauthorizedError" "404": $ref: "#/components/responses/NotFoundError" delete: tags: [Nutrição] summary: Exclui (soft delete) um plano alimentar security: - bearerAuth: [] parameters: - name: id in: path required: true schema: { type: string } responses: "200": description: Plano excluído logicamente content: application/json: schema: type: object properties: id: { type: string, example: "pl1" } deletedAt: { type: string, format: date-time } "401": $ref: "#/components/responses/UnauthorizedError" "404": $ref: "#/components/responses/NotFoundError" ######################################## # AGENDA # ######################################## /agenda: get: tags: [Agenda] summary: Lista eventos agendados security: - bearerAuth: [] parameters: - name: usuarioId in: query required: true schema: { type: string } - name: from in: query schema: { type: string, format: date-time, example: "2025-10-23T00:00:00Z" } - name: to in: query schema: { type: string, format: date-time, example: "2025-10-30T23:59:59Z" } responses: "200": description: Eventos no intervalo solicitado content: application/json: schema: type: array items: { $ref: "#/components/schemas/EventoAgendado" } "401": $ref: "#/components/responses/UnauthorizedError" post: tags: [Agenda] summary: Cria um evento na agenda security: - bearerAuth: [] requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/CriarEventoRequest" } examples: criarEvento: value: usuarioId: "clxUser01" titulo: "Treino A" tipo: "treino" dataHora: "2025-10-24T14:00:00Z" duracaoMin: 60 local: "Academia Fit Top" comProfissional: true isOnline: false responses: "201": description: Evento criado content: application/json: schema: { $ref: "#/components/schemas/EventoAgendado" } "400": $ref: "#/components/responses/BadRequestError" "401": $ref: "#/components/responses/UnauthorizedError" /agenda/{id}/status: patch: tags: [Agenda] summary: Atualiza o status de um evento (agendado/concluido/cancelado) security: - bearerAuth: [] parameters: - name: id in: path required: true schema: { type: string } requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/AtualizarStatusEventoRequest" } examples: concluir: value: { status: "concluido" } cancelar: value: { status: "cancelado" } responses: "200": description: Status atualizado content: application/json: schema: { $ref: "#/components/schemas/EventoAgendado" } "401": $ref: "#/components/responses/UnauthorizedError" "404": $ref: "#/components/responses/NotFoundError" /agenda/{id}: delete: tags: [Agenda] summary: Exclui (soft delete) um evento da agenda security: - bearerAuth: [] parameters: - name: id in: path required: true schema: { type: string } responses: "200": description: Evento excluído logicamente content: application/json: schema: type: object properties: id: { type: string, example: "ev1" } deletedAt: { type: string, format: date-time } "401": $ref: "#/components/responses/UnauthorizedError" "404": $ref: "#/components/responses/NotFoundError" ######################################## # GEMINI # ######################################## /gemini/gerar: post: tags: [Gemini] summary: Gera resposta (placeholder) description: | **Placeholder** para futura integração com Google Gemini. Atualmente retorna `"Recurso em desenvolvimento"`. requestBody: required: true content: application/json: schema: type: object properties: prompt: { type: string, example: "Monte um plano semanal de treinos" } responses: "200": description: Resposta gerada (stub) content: application/json: schema: type: object properties: resposta: { type: string, example: "Recurso em desenvolvimento" }