-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Biweekly Feedback Meeting Changes (#206)
* pruning deprecated data and refining the overall system. failedmeasurements recording system added. formdownload system fixed to handle undefined filtermodel implementation * fixing completion modal system. * export modal completed. merging in. * table structures, triggers, and stored procedures updated to automatically track changes in the measurementssummary table. editing the measurementssummary table will now automatically update host tables and then reset the measurementssummary table, calling the refresh procedure. * re-incorporating row edit functionality into the view data interface. will continue to expand this to make it more intuitive * CRUD system reimplemented for msv. editing modal that moves through the system added. * Updating stored procedures: adding handling for duplicate primary key errors appearing sometimes in view reload * adding duration formatting to moment in proj * upload interface simplified. Basic animation visual introduced to demonstrate runstate and ETC timer completed * export modal updated and added to isolated datagrid baseline. tested to confirm function * msv editing modal simplified to loading bar. * minor correction in export modal -- msv * adding accessibility tools and baseline accessibility updates. Saving changes here and beginning attempt to lift application to v15 of next * windows formatting changes * lift progress: eslint has been (temporarily) successfully lifted to v9 and runs via npx eslint. testing remains to determine if this can be extended to nextjs * saving changes. The lift to v15 seems to be temporarily stable. eslint v9 seems to be working as well, and deprecated packages have either been replaced with similar compatible modules or rewritten to work with the new versions. * monaco-editor library removed and replaced with codemirror. Package has been removed from system in its entirety. Upgrade to v15/etc looks stable * removing deprecated files.
- Loading branch information
1 parent
214cc6e
commit 1e660f5
Showing
84 changed files
with
9,710 additions
and
7,851 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
frontend/app/api/batchedupload/[schema]/[[...slugs]]/route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { NextRequest, NextResponse } from 'next/server'; | ||
import { HTTPResponses } from '@/config/macros'; | ||
import { FailedMeasurementsRDS } from '@/config/sqlrdsdefinitions/core'; | ||
import connectionmanager from '@/config/connectionmanager'; | ||
import { format } from 'mysql2/promise'; | ||
|
||
export async function POST(request: NextRequest, props: { params: Promise<{ schema: string; slugs?: string[] }> }) { | ||
const params = await props.params; | ||
let errorRows: FailedMeasurementsRDS[] = await request.json(); | ||
const schema = params.schema; | ||
const slugs = params.slugs; | ||
if (!errorRows || errorRows.length === 0 || !schema || !slugs || slugs.length !== 2) { | ||
return new NextResponse(JSON.stringify({ message: 'Missing requirements!' }), { status: HTTPResponses.INVALID_REQUEST }); | ||
} | ||
const [plotID, censusID] = slugs.map(Number); | ||
if (isNaN(plotID) || isNaN(censusID)) { | ||
return new NextResponse(JSON.stringify({ message: 'Invalid plotID or censusID!' }), { status: HTTPResponses.INVALID_REQUEST }); | ||
} | ||
|
||
// Add plotID and censusID to each row | ||
errorRows = errorRows.map(row => ({ | ||
...row, | ||
plotID, | ||
censusID | ||
})); | ||
|
||
const connectionManager = connectionmanager.getInstance(); | ||
const columns = Object.keys(errorRows[0]).filter(col => col !== 'id' && col !== 'failedMeasurementID'); | ||
const values = errorRows.map(row => columns.map(col => row[col as keyof FailedMeasurementsRDS])); | ||
|
||
const insertQuery = format(`INSERT INTO ?? (${columns.map(() => '??').join(', ')}) VALUES ?`, [`${schema}.failedmeasurements`, ...columns, values]); | ||
|
||
try { | ||
await connectionManager.executeQuery(insertQuery); | ||
return new NextResponse(JSON.stringify({ message: 'Insert to SQL successful' }), { status: HTTPResponses.OK }); | ||
} catch (error: any) { | ||
console.error('Database Error:', error); | ||
return new NextResponse(JSON.stringify({ message: 'Database error', error: error.message }), { status: HTTPResponses.INTERNAL_SERVER_ERROR }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { NextRequest, NextResponse } from 'next/server'; | ||
import { HTTPResponses } from '@/config/macros'; | ||
import ConnectionManager from '@/config/connectionmanager'; | ||
|
||
export async function GET(request: NextRequest) { | ||
const schema = request.nextUrl.searchParams.get('schema'); | ||
const censusIDParam = request.nextUrl.searchParams.get('censusID'); | ||
if (!schema || !censusIDParam) { | ||
return new NextResponse('Missing required parameters', { status: HTTPResponses.SERVICE_UNAVAILABLE }); | ||
} | ||
const censusID = parseInt(censusIDParam); | ||
const connectionManager = ConnectionManager.getInstance(); | ||
const transactionID = await connectionManager.beginTransaction(); | ||
try { | ||
let query = `DELETE FROM ${schema}.cmverrors WHERE CoreMeasurementID IN (SELECT CoreMeasurementID FROM ${schema}.coremeasurements WHERE CensusID = ${censusID});`; | ||
await connectionManager.executeQuery(query); | ||
query = `DELETE FROM ${schema}.cmattributes WHERE CoreMeasurementID IN (SELECT CoreMeasurementID FROM ${schema}.coremeasurements WHERE CensusID = ${censusID});`; | ||
await connectionManager.executeQuery(query); | ||
query = `DELETE FROM ${schema}.coremeasurements WHERE CensusID = ${censusID};`; | ||
await connectionManager.executeQuery(query); | ||
query = `DELETE FROM ${schema}.quadratpersonnel WHERE PersonnelID IN (SELECT PersonnelID FROM ${schema}.personnel WHERE CensusID = ${censusID});`; | ||
await connectionManager.executeQuery(query); | ||
query = `DELETE FROM ${schema}.personnel WHERE CensusID = ${censusID};`; | ||
await connectionManager.executeQuery(query); | ||
query = `DELETE FROM ${schema}.specieslimits WHERE CensusID = ${censusID};`; | ||
await connectionManager.executeQuery(query); | ||
query = `DELETE FROM ${schema}.censusquadrat WHERE CensusID = ${censusID};`; | ||
await connectionManager.executeQuery(query); | ||
query = `DELETE FROM ${schema}.quadrats WHERE QuadratID IN (SELECT QuadratID FROM ${schema}.censusquadrat WHERE CensusID = ${censusID});`; | ||
await connectionManager.executeQuery(query); | ||
query = `DELETE FROM ${schema}.census WHERE CensusID = ${censusID};`; | ||
await connectionManager.executeQuery(query); | ||
query = `ALTER TABLE ${schema}.cmverrors AUTO_INCREMENT = 1;`; | ||
await connectionManager.executeQuery(query); | ||
query = `ALTER TABLE ${schema}.cmattributes AUTO_INCREMENT = 1;`; | ||
await connectionManager.executeQuery(query); | ||
query = `ALTER TABLE ${schema}.coremeasurements AUTO_INCREMENT = 1;`; | ||
await connectionManager.executeQuery(query); | ||
query = `ALTER TABLE ${schema}.quadratpersonnel AUTO_INCREMENT = 1;`; | ||
await connectionManager.executeQuery(query); | ||
query = `ALTER TABLE ${schema}.personnel AUTO_INCREMENT = 1;`; | ||
await connectionManager.executeQuery(query); | ||
query = `ALTER TABLE ${schema}.specieslimits AUTO_INCREMENT = 1;`; | ||
await connectionManager.executeQuery(query); | ||
query = `ALTER TABLE ${schema}.censusquadrat AUTO_INCREMENT = 1;`; | ||
await connectionManager.executeQuery(query); | ||
query = `ALTER TABLE ${schema}.quadrats AUTO_INCREMENT = 1;`; | ||
await connectionManager.executeQuery(query); | ||
query = `ALTER TABLE ${schema}.census AUTO_INCREMENT = 1;`; | ||
await connectionManager.executeQuery(query); | ||
await connectionManager.commitTransaction(transactionID); | ||
return NextResponse.json({ message: 'Census cleared successfully' }, { status: HTTPResponses.OK }); | ||
} catch (e: any) { | ||
await connectionManager.rollbackTransaction(transactionID); | ||
return new NextResponse(e.message, { status: HTTPResponses.SERVICE_UNAVAILABLE }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.