v0.0.1
This commit is contained in:
29
api/controllers/generator.cards.controller.js
Normal file
29
api/controllers/generator.cards.controller.js
Normal file
@@ -0,0 +1,29 @@
|
||||
const saveCards = require("../middleware/genCards");
|
||||
|
||||
class GeneratorCardsController {
|
||||
async getScreen(req, res) {
|
||||
const { lat, lng, type, wayId, zoom, id, address, number } = req.query;
|
||||
|
||||
if (req.sheepRole == "administrator" || req.moderator.can_add_territory) {
|
||||
let result = await saveCards({ center: {lat:lat,lng:lng}, wayId: wayId, zoom: zoom ?? 18, type: type, number: id, address: `${address} ${number}` });
|
||||
|
||||
console.log(result);
|
||||
|
||||
|
||||
if (result) {
|
||||
return res.status(200).send(result);
|
||||
} else {
|
||||
return res
|
||||
.status(404)
|
||||
.send({ message: 'Image creation error.' });
|
||||
}
|
||||
} else {
|
||||
return res
|
||||
.status(403)
|
||||
.send({ message: 'The user does not have enough rights.' });
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = new GeneratorCardsController();
|
||||
Reference in New Issue
Block a user