HEX
Server: Apache
System: Linux srv4.garantili.com.tr 4.18.0-477.21.1.lve.1.el8.x86_64 #1 SMP Tue Sep 5 23:08:35 UTC 2023 x86_64
User: ekspardev (1006)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/ekspardev/tubisad-backend/src/app/locations/controller/locations.controller.js
const Locations = require("../model/locations.model");

exports.getAllLocations = async (req, res) => {
    const locations = await Locations.findAll();

    return res.status(200).json({ success: true, status: true, data: locations });
};

exports.createLocation = async (req, res) => {
    const {
        name,
        lat,
        lng,
        category,
        address,
        city,
        state,
        address2
    } = req.body;

    if (name && lat && lng) {
        const location = await Locations.create({
            name: name,
            lat: lat,
            lng: lng,
            category: category,
            address: address,
            city: city,
            state: state,
            address2: address2
        });

        return res.status(201).json({ success: true, status: true, message: 'Created!' });
    } else {
        return res.status(400).json({ success: true, status: false, message: 'Not Created!' });
    }
};