-
Notifications
You must be signed in to change notification settings - Fork 4
956 - Move from Generic Sensor to specific pH, Salinity, and Hydrophone sensor data #1004
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
matthewcflam
wants to merge
7
commits into
main
Choose a base branch
from
956-move-from-generic-sensors-to-specific-sensors
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
fe115be
Move from Generic Sensor to specific pH, Salinity, and Hydrophone
matthewcflam 06ead90
Merge branch 'main' into 956-move-from-generic-sensors-to-specific-se…
raghumanimehta 2ea3b9f
Merge branch 'main' into 956-move-from-generic-sensors-to-specific-se…
raghumanimehta 8bf9aac
Remove All Generic Sensor Mentions
matthewcflam f907849
Merge branch 'main' into 956-move-from-generic-sensors-to-specific-se…
matthewcflam 06cb698
Merge branch 'main' into 956-move-from-generic-sensors-to-specific-se…
matthewcflam eff40d6
Merge branch 'main' into 956-move-from-generic-sensors-to-specific-se…
raghumanimehta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,22 @@ | ||
| import { NextResponse } from 'next/server'; | ||
| import ConnectMongoDB from '@/lib/mongodb'; | ||
| import PhSensors from '@/models/PhSensors'; | ||
|
|
||
| export async function GET() { | ||
| try { | ||
| await ConnectMongoDB(); | ||
|
|
||
| const phSensors = await PhSensors.find({}).select({ | ||
| 'phSensors._id': 0, | ||
| _id: 0, | ||
| __v: 0, | ||
| }); | ||
|
|
||
| return NextResponse.json({ success: true, data: phSensors }); | ||
| } catch (error) { | ||
| return NextResponse.json( | ||
| { success: false, message: (error as Error).message }, | ||
| { status: 400 }, | ||
| ); | ||
| } | ||
| } |
This file contains hidden or 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,22 @@ | ||
| import { NextResponse } from 'next/server'; | ||
| import ConnectMongoDB from '@/lib/mongodb'; | ||
| import SalinitySensors from '@/models/SalinitySensors'; | ||
|
|
||
| export async function GET() { | ||
| try { | ||
| await ConnectMongoDB(); | ||
|
|
||
| const salinitySensors = await SalinitySensors.find({}).select({ | ||
| 'salinitySensors._id': 0, | ||
| _id: 0, | ||
| __v: 0, | ||
| }); | ||
|
|
||
| return NextResponse.json({ success: true, data: salinitySensors }); | ||
| } catch (error) { | ||
| return NextResponse.json( | ||
| { success: false, message: (error as Error).message }, | ||
| { status: 400 }, | ||
| ); | ||
| } | ||
| } |
This file contains hidden or 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,22 @@ | ||
| import { NextResponse } from 'next/server'; | ||
| import ConnectMongoDB from '@/lib/mongodb'; | ||
| import TempSensors from '@/models/TempSensors'; | ||
|
|
||
| export async function GET() { | ||
| try { | ||
| await ConnectMongoDB(); | ||
|
|
||
| const tempSensors = await TempSensors.find({}).select({ | ||
| 'tempSensors._id': 0, | ||
| _id: 0, | ||
| __v: 0, | ||
| }); | ||
|
|
||
| return NextResponse.json({ success: true, data: tempSensors }); | ||
| } catch (error) { | ||
| return NextResponse.json( | ||
| { success: false, message: (error as Error).message }, | ||
| { status: 400 }, | ||
| ); | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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,30 @@ | ||
| import mongoose from 'mongoose'; | ||
|
|
||
| interface PhSensor extends mongoose.Document { | ||
| ph: number; | ||
| } | ||
|
|
||
| export interface PhSensors extends mongoose.Document { | ||
| phSensors: PhSensor[]; | ||
| timestamp: string; | ||
| } | ||
|
|
||
| const PhSensorsSchema = new mongoose.Schema<PhSensors>({ | ||
| phSensors: { | ||
| type: [ | ||
| { | ||
| ph: Number, | ||
| }, | ||
| ], | ||
| required: [true, 'Missing array of objects in PhSensors interface'], | ||
| }, | ||
| timestamp: { | ||
| type: String, | ||
| default: () => new Date().toISOString(), | ||
| }, | ||
| }); | ||
|
|
||
| export default (mongoose.models['PhSensors'] as | ||
| | mongoose.Model<PhSensors> | ||
| | undefined) ?? | ||
| mongoose.model<PhSensors>('PhSensors', PhSensorsSchema, 'ph_sensors'); |
This file contains hidden or 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,34 @@ | ||
| import mongoose from 'mongoose'; | ||
|
|
||
| interface SalinitySensor extends mongoose.Document { | ||
| salinity: number; | ||
| } | ||
|
|
||
| export interface SalinitySensors extends mongoose.Document { | ||
| salinitySensors: SalinitySensor[]; | ||
| timestamp: string; | ||
| } | ||
|
|
||
| const SalinitySensorsSchema = new mongoose.Schema<SalinitySensors>({ | ||
| salinitySensors: { | ||
| type: [ | ||
| { | ||
| salinity: Number, | ||
| }, | ||
| ], | ||
| required: [true, 'Missing array of objects in SalinitySensors interface'], | ||
| }, | ||
| timestamp: { | ||
| type: String, | ||
| default: () => new Date().toISOString(), | ||
| }, | ||
| }); | ||
|
|
||
| export default (mongoose.models['SalinitySensors'] as | ||
| | mongoose.Model<SalinitySensors> | ||
| | undefined) ?? | ||
| mongoose.model<SalinitySensors>( | ||
| 'SalinitySensors', | ||
| SalinitySensorsSchema, | ||
| 'salinity_sensors', | ||
| ); |
This file contains hidden or 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,30 @@ | ||
| import mongoose from 'mongoose'; | ||
|
|
||
| interface TempSensor extends mongoose.Document { | ||
| temperature: number; | ||
| } | ||
|
|
||
| export interface TempSensors extends mongoose.Document { | ||
| tempSensors: TempSensor[]; | ||
| timestamp: string; | ||
| } | ||
|
|
||
| const TempSensorsSchema = new mongoose.Schema<TempSensors>({ | ||
| tempSensors: { | ||
| type: [ | ||
| { | ||
| temperature: Number, | ||
| }, | ||
| ], | ||
| required: [true, 'Missing array of objects in TempSensors interface'], | ||
| }, | ||
| timestamp: { | ||
| type: String, | ||
| default: () => new Date().toISOString(), | ||
| }, | ||
| }); | ||
|
|
||
| export default (mongoose.models['TempSensors'] as | ||
| | mongoose.Model<TempSensors> | ||
| | undefined) ?? | ||
| mongoose.model<TempSensors>('TempSensors', TempSensorsSchema, 'temp_sensors'); |
This file contains hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR is titled move from Generic Sensors, but GenericSensors is only removed from the datasets route and the download UI — the store, saga, reducer, model, and
/api/generic-sensorsroute all remain. SinceforkSagas()starts every saga,genericSensorsstill polls/api/generic-sensorson every interval and dispatches into a reducer nothing reads anymore (dead polling + dead state).Either fully remove GenericSensors (store dir, model, route, the
endpoints.ts/interfaces.ts/given.tsentries, therootReducer+rootSagaregistrations, andgenericsensors.feature), or if it's intentionally kept during the transition, please note that in the PR description.