refactor(*):Address PR comments

This commit is contained in:
Josh Creek
2025-07-26 19:42:04 +01:00
parent bc9ce84615
commit fa38fa69ca
22 changed files with 749 additions and 412 deletions
+17 -16
View File
@@ -1,8 +1,8 @@
import mongoose, { Schema, Document, Types } from 'mongoose';
export interface CatchRecord extends Document {
// Supabase-based CatchRecord interface
export interface CatchRecord {
_id: string; // Maps to Supabase 'id' field for frontend compatibility
userId: string;
pokedexEntryId: Types.ObjectId;
pokedexEntryId: string; // String representation of the foreign key
haveToEvolve: boolean;
caught: boolean;
inHome: boolean;
@@ -10,15 +10,16 @@ export interface CatchRecord extends Document {
personalNotes: string;
}
const catchRecordSchema = new Schema<CatchRecord>({
userId: String,
pokedexEntryId: { type: Schema.Types.ObjectId, ref: 'PokedexEntry', required: true },
haveToEvolve: { type: Boolean, default: false },
caught: { type: Boolean, default: false },
inHome: { type: Boolean, default: false },
hasGigantamaxed: { type: Boolean, default: false },
personalNotes: String
});
const CatchRecordModel = mongoose.model<CatchRecord>('CatchRecord', catchRecordSchema);
export default CatchRecordModel;
// Database record type for Supabase
export interface CatchRecordDB {
id: string;
userId: string;
pokedexEntryId: number; // Numeric foreign key in database
haveToEvolve: boolean;
caught: boolean;
inHome: boolean;
hasGigantamaxed: boolean;
personalNotes: string;
createdAt: string;
updatedAt: string;
}