Fix issue #10: Add map support
This commit is contained in:
23
backend/src/models/Map.js
Normal file
23
backend/src/models/Map.js
Normal 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);
|
||||
Reference in New Issue
Block a user