Fix issue #10: Add map support
This commit is contained in:
12
AGENTS.md
12
AGENTS.md
@@ -74,9 +74,9 @@ backend/src/
|
||||
├── index.js app bootstrap: dotenv, static uploads, json limits (50mb),
|
||||
│ passport init, CORS, route mounting, listen(5000)
|
||||
├── db.js connectDB() -> mongoose.connect(process.env.DB_URI)
|
||||
├── models/ User.js Campaign.js Note.js Folder.js Actor.js Item.js
|
||||
├── models/ User.js Campaign.js Note.js Folder.js Actor.js Item.js Map.js
|
||||
│ FoundryLinkRequest.js DiscordLinkRequest.js DiscordGuildLink.js
|
||||
├── routes/ user.js campaign.js note.js folder.js actor.js item.js
|
||||
├── routes/ user.js campaign.js note.js folder.js actor.js item.js map.js
|
||||
│ foundry-link.js (token sync, mounted BEFORE auth) foundry.js (bridge proxy)
|
||||
│ discord.js
|
||||
├── services/
|
||||
@@ -141,6 +141,7 @@ User ──< Campaign ──< Note ──?> Folder ──?> Folder (parentFolder
|
||||
└───────< Folder
|
||||
└───────< Actor (Foundry actors, when linked)
|
||||
└───────< Item (Foundry gear + hand-made items)
|
||||
└───────< Map (uploaded images + their grid settings)
|
||||
```
|
||||
|
||||
| Model | File | Fields |
|
||||
@@ -151,6 +152,7 @@ User ──< Campaign ──< Note ──?> Folder ──?> Folder (parentFolder
|
||||
| `Folder` | `models/Folder.js` | `name*`, `campaign*` → Campaign, `parentFolder` → Folder (null = root), `color` (hex string, sidebar entry background), `date` |
|
||||
| `Actor` | `models/Actor.js` | `name*`, `type` (`character`\|`npc`\|`creature`), `species`, `className`, `subclass`, `level`, `background`, `challengeRating`, `description`, `image`, `abilityScores{str..cha}`, `armorClass`, `speed`, `proficiencies`, `inventory[{name,quantity,weight}]` (flattened Foundry items, embedded — not `Item` docs), `traits`, `spells` (newline text), `campaign*` → Campaign, `foundryActorId` (unique per campaign), `date` |
|
||||
| `Item` | `models/Item.js` | `name*`, `category` (`weapon`\|`armor`\|`shield`\|`adventuring-gear`\|`magic-item`\|`consumable`\|`tool`\|`treasure`\|`other`), `rarity` (`common`…`artifact`), `quantity`, `weight`, `properties`, `description`, `campaign*` → Campaign, `foundryItemId` (unique per campaign), `foundryNames` (names Foundry uses for it, keeps dedup stable across a Dragonroll rename), `date` |
|
||||
| `Map` | `models/Map.js` | `name*`, `image` (filename in `src/uploads`), `gridSize` (cell size in image px), `offsetX`/`offsetY` (grid origin in image px), `scale` (distance one cell stands for), `campaign*` → Campaign, `date` |
|
||||
|
||||
`*` = required. Notes and folders are ordered by `date: -1` everywhere.
|
||||
|
||||
@@ -207,6 +209,12 @@ subfolders re-parented to null then deleted.
|
||||
`POST /api/item/update` — `{id*, name?, category?, rarity?, quantity?, weight?, properties?, description?}` — partial, ownership checked. `''` for `quantity`/`weight` is ignored, like `/item/create`.
|
||||
`POST /api/item/delete` — `{id}`
|
||||
|
||||
`GET /api/map/list?campaign=` → `{status:'ok',maps}`
|
||||
`POST /api/map/create` — multipart (`image`) or JSON `{name*,campaign*,gridSize?,offsetX?,offsetY?,scale?}` → `{status:'ok',map}`
|
||||
`POST /api/map/update` — `{id*, name?, gridSize?, offsetX?, offsetY?, scale?}`, partial, ownership checked. Send it as
|
||||
multipart with an `image` field to replace the photo (multer reads the other fields from the form; JSON works too).
|
||||
`POST /api/map/delete` — `{id}`
|
||||
|
||||
### 4.1 Foundry integration (actors, items)
|
||||
|
||||
`dragonroll-foundry/` holds the Foundry VTT module (`scripts/api.js`, loaded by `module.json`) and an
|
||||
|
||||
Reference in New Issue
Block a user