-
Notifications
You must be signed in to change notification settings - Fork 20
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
Fix #92 , Added /Sensor route for GET , POST request to list all sensors . #102
base: main
Are you sure you want to change the base?
Conversation
Fixed honeynet#96 Some changes in handler.go file in publishHandler function intersepted msg []byte object decode it , made changes as per requirnments .
…ckend Removed .split ('-')[0] from front end code and already added this logic in backend
I have made changes as per discussion please review .
Added some file for /sensor route.
Added /Sensor route as GET request to list all sensors stored by owner id . POST request for adding sensor under current user id as owner id .
Added /sensor route .
backend/handlers.go
Outdated
|
||
userId := userIDFromCtx(r.Context()) | ||
events, err := cs.sensorRepo.GetSensorsByOwnerId(userId) | ||
|
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.
No newline here needed as the error handling is directly related to the repo call
backend/repos/sensors.go
Outdated
|
||
} | ||
|
||
func (r *SensorRepo) AddSensors(sensor entities.Sensor, userId string) error { |
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.
only pass the sensor entity, assign the user_id in the handler
func TestGetSesors(t *testing.T) { | ||
|
||
} |
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.
implement tests
/sensor
GET request for returning all sensors stored under current user Owner id ,/sensor
POST request for adding new sensor under current user Owner id .Please verify my approch and let me know the inputs .
Thanks