Skip to content

docs: JSDoc and comments for schema, core services and middleware#187

Closed
saggacce wants to merge 1 commit into
developfrom
docs/codebase-documentation
Closed

docs: JSDoc and comments for schema, core services and middleware#187
saggacce wants to merge 1 commit into
developfrom
docs/codebase-documentation

Conversation

@saggacce
Copy link
Copy Markdown
Owner

Qué se hizo

Primera pasada de documentación — ficheros de mayor impacto para un desarrollador nuevo.

Ficheros documentados

Schema (workers/data-sync/prisma/schema.prisma)

  • Los 23 modelos con descripción de propósito, semántica de campos y gotchas
  • Enum values explicados
  • Warning de hypertables TimescaleDB
  • Shapes de campos JSON descritos (inventoryItems, perks, goldEarnedAtInterval, etc.)

Servicios

  • match-service.ts — @fileoverview, todas las interfaces documentadas, JSDoc con @param/@returns/@throws

Middleware (5 ficheros)

  • require-auth.ts — flujo de auth, SessionUser shape, nombre de cookie
  • error-handler.ts — estrategia de 3 niveles, ejemplo de AppError
  • require-role.ts — orden de resolución de teamId, bypass de PLATFORM_ADMIN
  • require-platform-admin.ts — patrón de uso, lógica de rol
  • auth-rate-limit.ts — estrategia WSL fallback, config de rate limit

Worker

  • workers/data-sync/src/client.ts — rationale del rate limit, User-Agent actualizado

Pendiente — Issue #186 para Codex

Resto de ficheros: services (sync, team, analyst, player...), routes (16 ficheros), frontend hooks, components y pages.

Schema (schema.prisma):
- All 23 models documented with purpose, field semantics and gotchas
- Enum values explained
- Event stream hypertable warning noted
- JSON field shapes described

Services:
- match-service.ts: file overview, all interfaces documented,
  function JSDoc with @param/@returns/@throws

Middleware:
- require-auth.ts: auth flow, SessionUser shape, cookie name
- error-handler.ts: three-tier error strategy, AppError usage example
- require-role.ts: teamId resolution order, PLATFORM_ADMIN bypass
- require-platform-admin.ts: usage pattern, role check
- auth-rate-limit.ts: WSL fallback strategy, rate limit config

Worker:
- client.ts: rate limit rationale, User-Agent updated to RiftLine/1.0

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 91d61b698c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

/// here — it is hardcoded to full access in the permissions service.
/// Shape: { PLATFORM_ADMIN: { "teams.own.view": true, ... }, MANAGER: {...}, ... }
/// See permissions-service.ts for the full PermissionKey union type.
model PermissionsConfig {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add a migration for the permissions table

This adds a new Prisma model, but the commit does not include a corresponding workers/data-sync/prisma/migrations/.../migration.sql entry. In environments that deploy with Prisma migrations, migrate deploy will apply only the checked-in SQL migrations and will not create the PermissionsConfig table, so any generated client or follow-up code that uses db.permissionsConfig will fail against the deployed database. Please either add the migration for this model or remove the schema change from this docs-only commit.

Useful? React with 👍 / 👎.

@saggacce saggacce deleted the branch develop May 19, 2026 21:28
@saggacce saggacce closed this May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant