zonedata get api
This commit is contained in:
@@ -7,6 +7,7 @@ const router = express.Router();
|
||||
router.post('/setZone',zone.setZone)
|
||||
router.delete('/deleteZone',zone.deleteZone)
|
||||
router.get('/findZones/:organization',zone.getZones)
|
||||
router.get('/A_zone/:zoneID/:organization',zone.ZoneData)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -71,4 +71,18 @@ export class zone {
|
||||
res.status(500).json({ message: 'Zone not found', error })
|
||||
}
|
||||
}
|
||||
|
||||
static async ZoneData(req: Request, res: Response): Promise<any> {
|
||||
try {
|
||||
const organization = req.params.organization;
|
||||
const zoneID = req.params.zoneID;
|
||||
const findZone = await zoneModel(organization)
|
||||
.findOne({ zoneId: zoneID })
|
||||
// .select("zoneName");
|
||||
console.log("findZone: ", findZone);
|
||||
if (findZone) return res.status(200).json(findZone);
|
||||
} catch (error: any) {
|
||||
return res.status(500).send(error.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ const MainModel = <T>(
|
||||
authSource: process.env.MONGO_AUTH_DB || 'admin', // Default to 'admin' if not provided
|
||||
maxPoolSize: 50,
|
||||
};
|
||||
console.log('authOptions: ', authOptions);
|
||||
|
||||
// Check if the connection already exists
|
||||
if (connections[db]) {
|
||||
return connections[db].model<T>(modelName, schema, collectionName);
|
||||
|
||||
Reference in New Issue
Block a user