diff --git a/public/Artefacts.csv b/public/Artefacts.csv index 8532919..3770bf9 100644 --- a/public/Artefacts.csv +++ b/public/Artefacts.csv @@ -4,14 +4,14 @@ Silvershade Ash,Ash,ShelvingAreaD,Fine light-grey volcanic ash collected near a Strata Core,Soil,LoggingArea,Soil core with visible stratification showing evidence of liquefaction.,ET-6.9-Brazil-00046,30,no,no,StrataCore.PNG Opal Clast,Tephra,ShelvingAreaM,Pumice clast with sharp edges and clear layering.,EV-8.3-Iceland-00127,65,no,no,OpalClast.PNG Magnetite Ash,Ash,PalletDeliveryArea,Bagged black ash sample with high magnetic content.,EV-5.3-Myanmar-00088,28,yes,no,MagnetiteAsh.PNG -Ropeform Fragment,Lava,ShelvingAreaR,Ropey pahoehoe lava fragment with preserved ripples.,EV-6.9-Ethiopia-00012,85,no,no,NoImageFound.PNG +Ropeform Fragment,Lava,ShelvingAreaR,Ropey pahoehoe lava fragment with preserved ripples.,EV-6.9-Ethiopia-00012,85,no,no,RopeformFragment.PNG Glassy Bed,Soil,ShelvingAreaB,Sandy soil deposit with glassy volcanic spherules visible under microscope.,EV-7.8-USA-00167,48,no,no,NoImageFound.PNG -Groundwater Shard,Tephra,ShelvingAreaJ,Layered tephra shard showing interaction with groundwater.,EV-4.9-Chile-00083,49,no,no,NoImageFound.PNG +Groundwater Shard,Tephra,ShelvingAreaJ,Layered tephra shard showing interaction with groundwater.,EV-4.9-Chile-00083,49,no,no,GroundwaterShard.PNG Sulfur Ghost,Ash,ShelvingAreaG,Grey volcanic ash particle with very high sulfur content.,EV-6.4-Armenia-00219,38,no,no,NoImageFound.PNG -Obsidian Pillar,Lava,ShelvingAreaC,Dense basalt sample with well-developed columnar structure.,EV-7.7-Jordan-00037,100,yes,no,NoImageFound.PNG -Peat Nest,Soil,ShelvingAreaP,Peaty soil from earthquake liquefaction area with organic inclusions.,ET-5.1-New Zealand-00032,52,no,no,NoImageFound.PNG +Obsidian Pillar,Lava,ShelvingAreaC,Dense basalt sample with well-developed columnar structure.,EV-7.7-Jordan-00037,100,yes,no,ObsidianPillar.PNG +Peat Nest,Soil,ShelvingAreaP,Peaty soil from earthquake liquefaction area with organic inclusions.,ET-5.1-New Zealand-00032,52,no,no,PeatNest.PNG Biotite Veil,Ash,PalletDeliveryArea,Ash with visible biotite flakes: lightly compacted.,EV-3.1-USA-00101,32,no,no,NoImageFound.PNG -Foamcore Pumice,Lava,ShelvingAreaF,High-porosity pumice formed during an explosive event.,EV-8.4-Barbados-00071,77,no,no,NoImageFound.PNG +Foamcore Pumice,Lava,ShelvingAreaF,High-porosity pumice formed during an explosive event.,EV-8.4-Barbados-00071,77,no,no,FoamcorePumice.PNG Redslide Soil,Soil,ShelvingAreaQ,Aggregated red clay soil collected from a collapsed hillside.,EC-7.5-Nicaragua-00078,26,no,no,NoImageFound.PNG Spectrum Clast,Tephra,LoggingArea,Multi-coloured tephra clast showing mixed eruption sources.,EV-8.3-Antarctica-00030,54,no,no,NoImageFound.PNG Olivine Stone,Lava,ShelvingAreaH,Dense polished lava with visible olivine inclusions.,EV-9.0-Russia-00171,132,no,no,NoImageFound.PNG diff --git a/src/databases/Users.csv b/public/Users.csv similarity index 100% rename from src/databases/Users.csv rename to public/Users.csv diff --git a/public/artefactImages/FoamcorePumice.PNG b/public/artefactImages/FoamcorePumice.PNG new file mode 100644 index 0000000..2229b81 Binary files /dev/null and b/public/artefactImages/FoamcorePumice.PNG differ diff --git a/public/artefactImages/GroundwaterShard.PNG b/public/artefactImages/GroundwaterShard.PNG new file mode 100644 index 0000000..a90ce20 Binary files /dev/null and b/public/artefactImages/GroundwaterShard.PNG differ diff --git a/public/artefactImages/ObsidianPillar.PNG b/public/artefactImages/ObsidianPillar.PNG new file mode 100644 index 0000000..ae3dabf Binary files /dev/null and b/public/artefactImages/ObsidianPillar.PNG differ diff --git a/public/artefactImages/PeatNest.PNG b/public/artefactImages/PeatNest.PNG new file mode 100644 index 0000000..fa55051 Binary files /dev/null and b/public/artefactImages/PeatNest.PNG differ diff --git a/public/artefactImages/RopeformFragment.PNG b/public/artefactImages/RopeformFragment.PNG new file mode 100644 index 0000000..8c56aa0 Binary files /dev/null and b/public/artefactImages/RopeformFragment.PNG differ diff --git a/src/app/api/import-earthquakes/route.ts b/src/app/api/import-earthquakes/route.ts index cc9b564..d090de6 100644 --- a/src/app/api/import-earthquakes/route.ts +++ b/src/app/api/import-earthquakes/route.ts @@ -20,8 +20,20 @@ type CsvRow = { Depth: string; }; + + + export async function POST() { try { + // Get a random user ID + const randomUserArr: Array<{ id: number }> = await prisma.$queryRaw` + SELECT TOP 1 id FROM [user] ORDER BY NEWID() + `; + if (!randomUserArr.length) { + return NextResponse.json({ error: 'No users found.' }, { status: 404 }); + } + const userId = randomUserArr[0].id; + // 1. Read the CSV file const fileContent = await fs.readFile(csvFilePath, "utf8"); // 2. Parse the CSV @@ -40,7 +52,7 @@ export async function POST() { location: row.Location, depth: row.Depth, // store as received // todo add random selection for creatorId - creatorId: null, + creatorId: userId, })); // 4. Bulk create earthquakes in database: await prisma.earthquake.createMany({