-
Notifications
You must be signed in to change notification settings - Fork 0
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
LL-317 #92
Conversation
@KevinLemon112 A lot of the work looks good to me. If you want to separate your routes into a single location in the project, I would follow this guide: |
… publish/subscribe.ts updated, routes/server.ts updated
…llers & routes Signed-off-by: Aaron Levitt <[email protected]>
…outes stay. routes.ts deprecated and server.ts updated.
Signed-off-by: pogi7 <[email protected]>
docker-compose.yaml
Outdated
- "1883:1883" | ||
env_file: ".env" | ||
|
||
# server: |
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.
@KevinLemon112 There was a 404 error in all of the user routes because they were not run on the docker compose server. You will need to either uncomment this service or make a new user service to get the user routes to work.
- "8.8.8.8" | ||
networks: | ||
- backend | ||
publish: |
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.
@KevinLemon112 The publish routes weren't working on port 4000, but they work now. You can test by using Postman or a local browser and going to http://localhost:4000/publish/all
You should see something like this:
{
"id": "all",
"message": "From Publish Service"
}
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.
i only had trouble with making a POST request for registering a user with linked devices (returned a 500 error--see attached screenshot). I used the following code to test but everything else lgtm!
"email": "[email protected]",
"name": "John Doe",
"creationDate": "2023-08-28T05:33:57.702Z",
"deletionDate": "2023-08-29T05:33:57.702Z", // Optional, can be omitted if not needed
"lastUpdated": "2023-08-30T05:33:57.702Z",
"devicesLinked": [
{
"uuid": "device1_uuid",
"lastUpdated": "2023-08-28T05:33:57.702Z",
"powered": true, // Optional, can be omitted if not needed
"poweredTimestamp": "2023-08-28T05:33:57.702Z", // Optional, can be omitted if not needed
"connected": true, // Optional, can be omitted if not needed
"connectedTimestamp": "2023-08-28T05:33:57.702Z", // Optional, can be omitted if not needed
"color": "#FFFFFF", // Optional, can be omitted if not needed
"colorTimestamp": "2023-08-28T05:33:57.702Z", // Optional, can be omitted if not needed
"brightness": 50, // Optional, can be omitted if not needed
"brightnessTimestamp": "2023-08-28T05:33:57.702Z" // Optional, can be omitted if not needed
}
]
}
@pogi7 Fixed 500 internal server error when making POST request to register user with linked devices
|
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.
lgtm!
Description
In this new PR/Ticket, routes and controllers have been added to the routes and controllers folders via various files for the ActiveMQ notification service. This enables different URL's to lead to different results for the service such as viewing user accounts, creating them, deleting them, etc.
Subsequent # (issue): LL-317
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Steps (For Local Host):
User Routes
Register User
URL: http://localhost:4000/users/register
Method: POST
Body: raw - JSON
JSON (copy and paste this into Postman in the raw - JSON section):
{
"email": "[email protected]",
"name": "John Doe",
"creationDate": "2023-08-28T05:33:57.702Z",
"deletionDate": "2023-08-29T05:33:57.702Z", // Optional, can be omitted if not needed
"lastUpdated": "2023-08-30T05:33:57.702Z",
"devicesLinked": []
}
OR (if you want to test linking a device)
{
"email": "[email protected]",
"name": "John Doe",
"creationDate": "2023-08-28T05:33:57.702Z",
"deletionDate": "2023-08-29T05:33:57.702Z", // Optional, can be omitted if not needed
"lastUpdated": "2023-08-30T05:33:57.702Z",
"devicesLinked": [
{
"uuid": "device1_uuid",
"lastUpdated": "2023-08-28T05:33:57.702Z",
"powered": true, // Optional, can be omitted if not needed
"poweredTimestamp": "2023-08-28T05:33:57.702Z", // Optional, can be omitted if not needed
"connected": true, // Optional, can be omitted if not needed
"connectedTimestamp": "2023-08-28T05:33:57.702Z", // Optional, can be omitted if not needed
"color": "#FFFFFF", // Optional, can be omitted if not needed
"colorTimestamp": "2023-08-28T05:33:57.702Z", // Optional, can be omitted if not needed
"brightness": 50, // Optional, can be omitted if not needed
"brightnessTimestamp": "2023-08-28T05:33:57.702Z" // Optional, can be omitted if not needed
}
]
}
Get All Users
URL: http://localhost:4000/users/all
Method: GET
Get User by ID
Get User by ID
URL: http://localhost:4000/users/:id
Method: GET
(replace ":id" with actual MongoDB account ID)
Delete User by ID
URL: http://localhost:4000/users/:id/delete
Method: DELETE
(replace ":id" with actual MongoDB account ID)
Publish/Subscribe Routes
Publish Message
URL: http://localhost:6000/publish/:id
Method: GET
(replace ":id" with any ID)
Subscribe Status
URL: http://localhost:7000/subscribe/status
Method: GET
Checklist (when relevant):
TypeScript
Python
Schema