// ── Public · Clans ──────────────────────────────────────────────────────── // // Mounted at `/api/v1/public/clans`. The module's own surface for the things // core calls Teams — the list and one clan's roster, in this game's vocabulary, // served from this module's tables. // // ── Why the prefix is `/clans` and could not be `/teams` ────────────────── // // **Core mounts `/api/v1/public/teams` itself.** Teams are a core primitive, so // core answers the platform-level questions about them; what this module adds is // the same clans in its own words, with the fields core has no schema for. The // loader would refuse `/teams` outright at registration — a prefix collision it // CAN see, unlike the tier-root routes `world.router.js` warns about — so the // failure here is loud, immediate, and a boot that never happens. // // Which raises the question worth answering before you copy this: **does your // module need this router at all?** Core already serves `/public/teams` and // `/public/teams/:slug/roster`, projected through your `projectRoster`. A module // wants its own only when it has something core does not model — here the game's // rank labels and who is online, which are this game's ideas and not Teams. If // what you would serve is what core already serves, do not. const core = require('../../core') const express = core.express const clans = require('./clans.controller') const { siteMode } = core.middleware const clansRouter = express.Router() clansRouter.get( '/', // #swagger.tags = ['Public · Example Game'] // #swagger.summary = 'Every clan the game has reported' // #swagger.description = 'The clans this deployment knows about, in the game’s own vocabulary. Core calls these Teams and serves its own view of them at `/public/teams`; this route adds what core has no schema for. Answers with an empty list rather than failing when the game is unreachable — the list is a page, not a sync.' /* #swagger.responses[200] = { description: 'The clans', content: { "application/json": { schema: { $ref: "#/components/schemas/ExamplegameClanList" } } } } */ siteMode, clans.list, ) clansRouter.get( '/:externalId', // #swagger.tags = ['Public · Example Game'] // #swagger.summary = 'One clan and its roster' // #swagger.description = 'A clan by the game’s own id, with the roster as the game reported it. This is the module’s unprojected view of its OWN data and it deliberately withholds the member key and any linked account id — the roster core serves at `/public/teams/{slug}/roster` is the one that runs through `projectRoster`, and a module route that published more than core’s would route around its own visibility rules.' /* #swagger.responses[200] = { description: 'The clan', content: { "application/json": { schema: { $ref: "#/components/schemas/ExamplegameClan" } } } } */ /* #swagger.responses[404] = { description: 'No such clan', content: { "application/json": { schema: { $ref: "#/components/schemas/Error" } } } } */ siteMode, clans.detail, ) module.exports = clansRouter