Place
All checks were successful
Build and Deploy Nuxt / build (push) Successful in 2m1s

This commit is contained in:
2026-06-11 23:47:37 +02:00
parent 887e8c80af
commit 6e4a9ac967
15 changed files with 689 additions and 158 deletions

View File

@@ -0,0 +1,21 @@
const mongoose = require("mongoose");
const gridCellSchema = new mongoose.Schema(
{
x: { type: Number, required: true, min: 1, max: 90 },
y: { type: Number, required: true, min: 1, max: 90},
color: { type: Number, required: true },
},
{ timestamps: true }
);
gridCellSchema.index({ x: 1, y: 1 }, { unique: true });
gridCellSchema.methods.toDisplayColor = function () {
if (this.color.startsWith("#")) return this.color;
return `#${this.color}`;
};
const GridCell = mongoose.model("GridCell", gridCellSchema);
module.exports = GridCell;