feat: Initial commit of backend services and AGENTS.md
This commit is contained in:
37
backend/models/Street.js
Normal file
37
backend/models/Street.js
Normal file
@@ -0,0 +1,37 @@
|
||||
const mongoose = require("mongoose");
|
||||
|
||||
const StreetSchema = new mongoose.Schema(
|
||||
{
|
||||
name: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
location: {
|
||||
type: {
|
||||
type: String,
|
||||
enum: ["Point"],
|
||||
required: true,
|
||||
},
|
||||
coordinates: {
|
||||
type: [Number],
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
adoptedBy: {
|
||||
type: mongoose.Schema.Types.ObjectId,
|
||||
ref: "User",
|
||||
},
|
||||
status: {
|
||||
type: String,
|
||||
enum: ["available", "adopted"],
|
||||
default: "available",
|
||||
},
|
||||
},
|
||||
{
|
||||
timestamps: true,
|
||||
},
|
||||
);
|
||||
|
||||
StreetSchema.index({ location: "2dsphere" });
|
||||
|
||||
module.exports = mongoose.model("Street", StreetSchema);
|
||||
Reference in New Issue
Block a user