Mongo-Zugriff passt jetzt
Adresse wird richtig geholt Daten werden in prop_flux gespeichert
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { ObjectId } from 'mongodb';
|
||||
import { MongoAPIError, ObjectId } from 'mongodb';
|
||||
import bcrypt from 'bcrypt';
|
||||
import { getCollections } from '../db/mongo.js';
|
||||
import { getCollections, update_pflux } from '../db/mongo.js';
|
||||
|
||||
export function registerApiRoutes(app, requireLogin) {
|
||||
const { entriesCollection, usersCollection } = getCollections();
|
||||
@@ -25,14 +25,12 @@ export function registerApiRoutes(app, requireLogin) {
|
||||
sensorNumber = parseInt(sensorNumber, 10);
|
||||
try {
|
||||
const doc = {
|
||||
espId,
|
||||
sensorNumber,
|
||||
id: espId,
|
||||
name: name || '',
|
||||
description: description || '',
|
||||
address: address || '',
|
||||
createdAt: new Date()
|
||||
};
|
||||
await entriesCollection.insertOne(doc);
|
||||
await update_pflux(sensorNumber, doc)
|
||||
res.json({ success: true });
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
|
||||
Reference in New Issue
Block a user