feat(*): Update seeding logic to handle new fields and record the last modified date

This commit is contained in:
Josh Creek
2024-07-12 14:16:30 +01:00
parent 212f674b44
commit 6aac4c5985
6 changed files with 27213 additions and 20951 deletions
@@ -0,0 +1,16 @@
import { json } from '@sveltejs/kit';
import { dbConnect, dbDisconnect } from '$lib/utils/db';
import PokedexMetadataModel from '$lib/models/PokedexMetadata';
export const GET = async () => {
await dbConnect();
const metadata = await PokedexMetadataModel.findOne();
await dbDisconnect();
if (metadata) {
return json({ lastModified: metadata.lastModified });
} else {
return json({ message: 'Metadata not found' }, { status: 404 });
}
};