feat: Реализован полный CRUD для админ-панели и улучшена функциональность
- Portfolio CRUD: добавление, редактирование, удаление, переключение публикации - Services CRUD: полное управление услугами с возможностью активации/деактивации - Banner system: новая модель Banner с CRUD операциями и аналитикой кликов - Telegram integration: расширенные настройки бота, обнаружение чатов, отправка сообщений - Media management: улучшенная загрузка файлов с оптимизацией изображений и превью - UI improvements: обновлённые админ-панели с rich-text редактором и drag&drop загрузкой - Database: добавлена таблица banners с полями для баннеров и аналитики
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const Service = require('../models/Service');
|
||||
const { Service } = require('../models');
|
||||
|
||||
// Get all services for calculator
|
||||
router.get('/services', async (req, res) => {
|
||||
try {
|
||||
const services = await Service.find({ isActive: true })
|
||||
.select('name pricing category features estimatedTime')
|
||||
.sort({ category: 1, name: 1 });
|
||||
const services = await Service.findAll({
|
||||
where: { isActive: true },
|
||||
attributes: ['id', 'name', 'pricing', 'category', 'features', 'estimatedTime'],
|
||||
order: [['category', 'ASC'], ['name', 'ASC']]
|
||||
});
|
||||
|
||||
const servicesByCategory = services.reduce((acc, service) => {
|
||||
if (!acc[service.category]) {
|
||||
@@ -50,9 +52,11 @@ router.post('/calculate', async (req, res) => {
|
||||
}
|
||||
|
||||
// Get selected services details
|
||||
const services = await Service.find({
|
||||
_id: { $in: selectedServices },
|
||||
isActive: true
|
||||
const services = await Service.findAll({
|
||||
where: {
|
||||
id: selectedServices,
|
||||
isActive: true
|
||||
}
|
||||
});
|
||||
|
||||
if (services.length !== selectedServices.length) {
|
||||
|
||||
Reference in New Issue
Block a user