Fix issue #10: Add map support

This commit is contained in:
Gitea OpenCode Agent
2026-10-14 10:25:49 +00:00
parent af76cf1050
commit bcd173d133
14 changed files with 683 additions and 31 deletions

23
backend/src/models/Map.js Normal file
View File

@@ -0,0 +1,23 @@
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const MapSchema = new Schema({
name: { type: String, required: true, trim: true },
// Uploaded image, served from /api/public/<filename>
image: { type: String, default: '' },
// Grid cell size in image pixels
gridSize: { type: Number, min: 1, default: 50 },
// Grid origin, in image pixels from the top left corner of the image
offsetX: { type: Number, default: 0 },
offsetY: { type: Number, default: 0 },
// Distance each grid cell stands for (feet, metres...)
scale: { type: Number, min: 0.01, default: 5 },
campaign: {
type: Schema.Types.ObjectId,
ref: 'Campaign',
required: true
},
date: { type: Date, default: Date.now }
});
module.exports = mongoose.model('Map', MapSchema);