mirror of
https://github.com/jcreek/LivingDexTracker.git
synced 2026-07-13 02:53:45 +00:00
feat(*): Update pokedex entry data structure and re-add error handling
This commit is contained in:
@@ -43,14 +43,33 @@
|
||||
{/if}
|
||||
|
||||
<div class="bg-white text-black rounded-lg p-4">
|
||||
<p><strong>Box:</strong> {pokedexEntry.boxPlacement.box}</p>
|
||||
<p><strong>Row:</strong> {pokedexEntry.boxPlacement.row}</p>
|
||||
<p><strong>Column:</strong> {pokedexEntry.boxPlacement.column}</p>
|
||||
{#if showForms}
|
||||
<p><strong>Box:</strong> {pokedexEntry.boxPlacementForms.box}</p>
|
||||
<p><strong>Row:</strong> {pokedexEntry.boxPlacementForms.row}</p>
|
||||
<p><strong>Column:</strong> {pokedexEntry.boxPlacementForms.column}</p>
|
||||
<p><strong>Can Gigantamax:</strong> {pokedexEntry.canGigantamax ? 'Yes' : 'No'}</p>
|
||||
{:else}
|
||||
<p><strong>Box:</strong> {pokedexEntry.boxPlacement.box}</p>
|
||||
<p><strong>Row:</strong> {pokedexEntry.boxPlacement.row}</p>
|
||||
<p><strong>Column:</strong> {pokedexEntry.boxPlacement.column}</p>
|
||||
{/if}
|
||||
{#if pokedexEntry.notes}
|
||||
<p><strong>Notes:</strong> {pokedexEntry.notes}</p>
|
||||
|
||||
{#if pokedexEntry.evolutionInformation}
|
||||
<p><strong>Evolution Info:</strong> {pokedexEntry.evolutionInformation}</p>
|
||||
{/if}
|
||||
{#if pokedexEntry.catchInformation.length > 0}
|
||||
<p><strong>Catch Info:</strong></p>
|
||||
<ul class="list-disc list-inside">
|
||||
{#each pokedexEntry.catchInformation as info}
|
||||
<li>
|
||||
<ul>
|
||||
<li><strong>Location:</strong> {info.game}</li>
|
||||
<li><strong>Method:</strong> {info.location}</li>
|
||||
<li><strong>Level:</strong> {info.notes}</li>
|
||||
</ul>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+9730
-1390
File diff suppressed because it is too large
Load Diff
@@ -3,13 +3,21 @@ import mongoose, { Schema, Document } from 'mongoose';
|
||||
export interface PokedexEntry extends Document {
|
||||
pokedexNumber: number;
|
||||
boxPlacement: { box: number; row: number; column: number };
|
||||
boxPlacementForms: { box: number; row: number; column: number };
|
||||
pokemon: string;
|
||||
form: string;
|
||||
canGigantamax: boolean;
|
||||
regionToCatchIn: string;
|
||||
gamesToCatchIn: string[];
|
||||
regionToEvolveIn: string;
|
||||
notes: string;
|
||||
evolutionInformation: string;
|
||||
catchInformation: [
|
||||
{
|
||||
game: string;
|
||||
location: string;
|
||||
notes: string;
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
const pokedexEntrySchema = new Schema<PokedexEntry>({
|
||||
@@ -19,13 +27,25 @@ const pokedexEntrySchema = new Schema<PokedexEntry>({
|
||||
row: Number,
|
||||
column: Number
|
||||
},
|
||||
boxPlacementForms: {
|
||||
box: Number,
|
||||
row: Number,
|
||||
column: Number
|
||||
},
|
||||
pokemon: String,
|
||||
form: String,
|
||||
canGigantamax: Boolean,
|
||||
regionToCatchIn: String,
|
||||
gamesToCatchIn: Array<string>,
|
||||
regionToEvolveIn: String,
|
||||
notes: String
|
||||
evolutionInformation: String,
|
||||
catchInformation: [
|
||||
{
|
||||
game: String,
|
||||
location: String,
|
||||
notes: String
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
export default mongoose.model<PokedexEntry>('PokedexEntry', pokedexEntrySchema);
|
||||
|
||||
@@ -22,16 +22,19 @@ class CombinedDataRepository {
|
||||
},
|
||||
{
|
||||
$sort: {
|
||||
'boxPlacement.box': 1,
|
||||
'boxPlacement.row': 1,
|
||||
'boxPlacement.column': 1
|
||||
'boxPlacementForms.box': 1,
|
||||
'boxPlacementForms.row': 1,
|
||||
'boxPlacementForms.column': 1
|
||||
}
|
||||
},
|
||||
{ $skip: skip },
|
||||
{ $limit: limit }
|
||||
]).exec();
|
||||
|
||||
return combinedData.map((data) => ({
|
||||
// Filter out entries with no catch records
|
||||
const filteredData = combinedData.filter((data) => data.catchRecord);
|
||||
|
||||
return filteredData.map((data) => ({
|
||||
pokedexEntry: data as PokedexEntry,
|
||||
catchRecord: data.catchRecord as CatchRecord
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user