Skip to content

Commit

Permalink
Fix build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikaal Naik committed Mar 24, 2023
1 parent 5b3f308 commit 4201f80
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 45 deletions.
22 changes: 11 additions & 11 deletions apps/frontend/src/pages/api/bathymetry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import dayjs from 'dayjs';
import { PrismaClient } from '@prisma/client'
import { fetchFromNOAA } from 'src/utils/weather/noaa';
// import { fetchFromNOAA } from 'src/utils/weather/noaa';
import fetch from 'node-fetch';
const prisma = new PrismaClient()
// const prisma = new PrismaClient()

export default async function handler(_, res) {
const waterData = await getWaterLevelData()
Expand All @@ -24,15 +24,15 @@ export default async function handler(_, res) {
}
}

const getDate = () => {
const rangeBackInTime = 20;
const endDate = dayjs().format('YYYY-MM-DD')
const startDate = dayjs().subtract(rangeBackInTime, 'day').format('YYYY-MM-DD')
return {
startDate,
endDate,
}
}
// const getDate = () => {
// const rangeBackInTime = 20;
// const endDate = dayjs().format('YYYY-MM-DD')
// const startDate = dayjs().subtract(rangeBackInTime, 'day').format('YYYY-MM-DD')
// return {
// startDate,
// endDate,
// }
// }

const getWaterLevelData = async () => {
const REPORTING_STATION = '02HC024'
Expand Down
64 changes: 32 additions & 32 deletions apps/frontend/src/pages/api/beach/backfill/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,37 +16,37 @@ export const config = {
// });
// };

export default async function handler(_: NextRequest, res: NextResponse) {

const startDate = '2016-01-01'
const endDate = '2022-12-31';

const arrayOfBeachReadings = results.reduce((accum, dailyReadings) => {
if (dailyReadings.data) {
const date = dayjs(dailyReadings.CollectionDate).toDate();
const readings = dailyReadings.data.map(reading => {
delete reading.beachName;
return {
...reading,
date: date,
}
})
return [...accum, ...readings];
} else {
return accum;
}
}, [])
console.log({ arrayOfBeachReadings });

await prisma.beachReading.createMany({
data: arrayOfBeachReadings,
skipDuplicates: true,
}).then(data => {
NextResponse.json({ inserts: data, success: true, })

}).catch(err => {
console.error('Beach Reading Create Many Error', err);
NextResponse.json({ success: false, error: true, message: err })
})
export default async function handler(_: NextRequest, __: NextResponse) {

// const startDate = '2016-01-01'
// const endDate = '2022-12-31';

// const arrayOfBeachReadings = results.reduce((accum, dailyReadings) => {
// if (dailyReadings.data) {
// const date = dayjs(dailyReadings.CollectionDate).toDate();
// const readings = dailyReadings.data.map(reading => {
// delete reading.beachName;
// return {
// ...reading,
// date: date,
// }
// })
// return [...accum, ...readings];
// } else {
// return accum;
// }
// }, [])
// console.log({ arrayOfBeachReadings });

// await prisma.beachReading.createMany({
// data: arrayOfBeachReadings,
// skipDuplicates: true,
// }).then(data => {
// NextResponse.json({ inserts: data, success: true, })

// }).catch(err => {
// console.error('Beach Reading Create Many Error', err);
// NextResponse.json({ success: false, error: true, message: err })
// })

}
2 changes: 1 addition & 1 deletion apps/frontend/src/pages/api/beach/get/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NextApiRequest, NextApiResponse } from "next";


export default async function handler(_: NextApiRequest, res: NextApiResponse) {
export default async function handler(_: NextApiRequest, __: NextApiResponse) {



Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"allowJs": true,
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"noUnusedLocals": true,
"noUnusedLocals": false,
"noUnusedParameters": true,
"removeComments": false,
"preserveConstEnums": true,
Expand Down

1 comment on commit 4201f80

@vercel
Copy link

@vercel vercel bot commented on 4201f80 Mar 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.