const express = require('express');
const { sequelize } = require('../models');
const { QueryTypes } = require('sequelize');

const router = express.Router();

// Получить все залы
router.get('/', async (req, res) => {
  try {
    const halls = await sequelize.query(`
      SELECT * FROM halls WHERE is_active = true
    `, {
      type: QueryTypes.SELECT
    });
    res.json(halls);
  } catch (error) {
    res.status(500).send(error.message);
  }
});

module.exports = router;