This commit is contained in:
Zeeshaun
2026-05-06 15:08:32 +00:00
parent b05a1a954b
commit 0de593c7d3
54 changed files with 4522 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
import { Model, Schema, Types, model, models } from "mongoose";
export interface GameDocument {
gameDate: Date;
activePlayerIds: Types.ObjectId[];
startingPitcherId?: Types.ObjectId | null;
notes?: string;
createdAt?: Date;
updatedAt?: Date;
}
const gameSchema = new Schema<GameDocument>(
{
gameDate: { type: Date, required: true, unique: true, index: true },
activePlayerIds: [{ type: Schema.Types.ObjectId, ref: "Player" }],
startingPitcherId: { type: Schema.Types.ObjectId, ref: "Player", default: null },
notes: { type: String, default: "" }
},
{ timestamps: true }
);
export const GameModel = (models.Game as Model<GameDocument>) || model<GameDocument>("Game", gameSchema);