Skip to content

Commit

Permalink
URL
Browse files Browse the repository at this point in the history
  • Loading branch information
PsyChonek committed Mar 1, 2025
1 parent 0b213f8 commit 2768e11
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions services/api/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ fastify.post(
ip: { type: "string", format: "ipv4", description: "IP address of the sensor." },
espID: { type: "string", description: "Unique ID of the sensor." },
},
required: ["ip"],
required: ["ip", "espID"],
},
response: {
200: {
Expand All @@ -213,10 +213,10 @@ fastify.post(

console.log("Adding sensor:", newSensor);

// Check if same sensor already exists
const existingSensor = await sensors.findOne({ ip, espID });
// Check if sensor with the same espID already exists
const existingSensor = await sensors.findOne({ espID });
if (existingSensor) {
reply.code(400).send({ error: "Sensor already exists." });
reply.code(400).send({ error: "Sensor with this espID already exists." });
return;
}

Expand Down
2 changes: 1 addition & 1 deletion services/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
- action: rebuild
path: ./web-nuxt
environment:
- NUXT_PUBLIC_API_BASE_URL=http://api:3000
- NUXT_PUBLIC_API_BASE_URL=http://vazypi.local:9051
db:
build: ./db
container_name: climate-db
Expand Down

0 comments on commit 2768e11

Please sign in to comment.