e6ea1400d6164a8a9b5bc2dc95d598f30d37b9d2
## Features Added ### Admin Login Page (public/login.html) - Professional login UI with Bootstrap 5 - Email/password authentication - CSRF protection - Rate limiting protection - Session persistence (7 days) - Remember me functionality - Language: Spanish with translations ready ### Authentication Middleware (src/server/index.ts) - Session-based authentication using SQLite - bcrypt password hashing - CSRF token endpoint for form protection - Auth check on admin.html page load - Logout endpoint ### API Client Enhancements (public/js/api.js) - Added auth methods: login(), logout(), getMe(), getCsrfToken() - CRUD methods for all admin entities: - Properties: create, update, delete - Leads: get, update, delete - Testimonials: create, update, delete - FAQ: create, update, delete - Services: create, update, delete - Settings: get, update - Admin stats endpoint ### Comprehensive Seed Data (src/db/seed-comprehensive.ts) - 36 properties of all types: - 8 urban lands - 10 agricultural plots - 8 houses/villas - 10 apartments - Real Tenerife locations with coordinates - Spanish and Russian translations - 8 testimonials from international clients - 8 FAQ items (buying process, taxes, etc.) - 6 services offered - Admin user: admin@tenerifeprop.com / admin123 - Stock photos from Unsplash ### Tests (tests/auth.test.ts) - Authentication tests - Session management tests - Property CRUD tests - Input validation tests - XSS prevention tests - Email/phone validation tests ## Why These Changes 1. Security: Authentication protects admin routes from unauthorized access 2. Data: Seed data provides realistic content for testing and demo 3. UX: Professional login page improves user experience 4. Testing: Tests ensure reliability and catch regressions ## Breaking Changes None - all changes are additive ## Related Issues - Closes #28 (Admin Login Page) - Closes #29 (Seed Data Generation) - Closes #30 (Tests Implementation) ## Milestone Administrative Section Implementation (#51)
refactor: extract CSS into separate files (issue #5)\n\n- Create public/css/base.css with reset and typography\n- Create public/css/components.css with shared UI components\n- Create public/css/pages/home.css for homepage styles\n- Create public/css/pages/property.css for property page styles\n- Create public/css/pages/admin.css for admin panel styles\n- Add CSS variables for badges and text colors\n- Remove inline styles from HTML files\n- Add link tags to HTML files\n- Add CSS extraction tests\n\nCloses #5
refactor: extract CSS into separate files (issue #5)\n\n- Create public/css/base.css with reset and typography\n- Create public/css/components.css with shared UI components\n- Create public/css/pages/home.css for homepage styles\n- Create public/css/pages/property.css for property page styles\n- Create public/css/pages/admin.css for admin panel styles\n- Add CSS variables for badges and text colors\n- Remove inline styles from HTML files\n- Add link tags to HTML files\n- Add CSS extraction tests\n\nCloses #5
refactor: extract CSS into separate files (issue #5)\n\n- Create public/css/base.css with reset and typography\n- Create public/css/components.css with shared UI components\n- Create public/css/pages/home.css for homepage styles\n- Create public/css/pages/property.css for property page styles\n- Create public/css/pages/admin.css for admin panel styles\n- Add CSS variables for badges and text colors\n- Remove inline styles from HTML files\n- Add link tags to HTML files\n- Add CSS extraction tests\n\nCloses #5
refactor: extract CSS into separate files (issue #5)\n\n- Create public/css/base.css with reset and typography\n- Create public/css/components.css with shared UI components\n- Create public/css/pages/home.css for homepage styles\n- Create public/css/pages/property.css for property page styles\n- Create public/css/pages/admin.css for admin panel styles\n- Add CSS variables for badges and text colors\n- Remove inline styles from HTML files\n- Add link tags to HTML files\n- Add CSS extraction tests\n\nCloses #5
TenerifeProp
Агентство недвижимости на острове Тенерифе (Канарские острова, Испания).
🚀 Быстрый старт с Docker
# Сборка и запуск
docker-compose up -d --build
# Приложение будет доступно на http://localhost:8080
📦 Локальная разработка
Требования
- Bun >= 1.0.0
- Node.js >= 18 (опционально)
Установка
# Установка зависимостей
bun install
# Инициализация базы данных
bun run db:init
# Заполнение тестовыми данными
bun run db:seed
# Запуск сервера разработки
bun run dev
Доступные скрипты
bun run dev # Запуск в режиме разработки
bun run start # Запуск в production режиме
bun run db:init # Инициализация БД
bun run db:seed # Заполнение тестовыми данными
bun run build # Сборка проекта
bun run test # Запуск тестов
📁 Структура проекта
TenerifeProp/
├── public/ # Статические файлы
│ ├── index.html # Главная страница
│ ├── property.html # Страница объекта
│ ├── admin.html # Админ-панель
│ ├── css/ # Стили
│ └── js/ # JavaScript
├── src/
│ ├── server/ # Backend (Bun + Hono)
│ ├── db/ # Схема БД
│ ├── types/ # TypeScript типы
│ ├── data/ # JSON данные
│ └── i18n/ # Переводы
├── docs/ # Документация
├── Dockerfile # Docker образ
├── docker-compose.yml # Docker Compose
├── package.json # Зависимости
└── tsconfig.json # TypeScript конфиг
🔧 API Endpoints
Недвижимость
| Метод | Endpoint | Описание |
|---|---|---|
GET |
/api/properties |
Список объектов |
GET |
/api/properties/:slug |
Детали объекта |
GET |
/api/properties/featured |
Рекомендуемые |
POST |
/api/properties |
Создать (admin) |
PUT |
/api/properties/:id |
Обновить (admin) |
DELETE |
/api/properties/:id |
Удалить (admin) |
Заявки
| Метод | Endpoint | Описание |
|---|---|---|
GET |
/api/leads |
Список заявок |
POST |
/api/leads |
Создать заявку |
PUT |
/api/leads/:id/status |
Изменить статус |
Контент
| Метод | Endpoint | Описание |
|---|---|---|
GET |
/api/testimonials |
Отзывы |
GET |
/api/faq |
FAQ |
GET |
/api/services |
Услуги |
GET |
/api/settings |
Настройки |
🗄️ База данных
SQLite база данных автоматически создается в ./data/tenerifeprop.db.
Основные таблицы
properties- Объекты недвижимостиleads- Заявки клиентовusers- Пользователи системыtestimonials- Отзывыfaq- Вопросы-ответыservices- Услугиsettings- Настройки сайта
🌍 Мультиязычность
Поддерживаемые языки:
- 🇪🇸 Испанский (ES) - основной
- 🇷🇺 Русский (RU)
Переключение языка через ?lang=ru или кнопку в интерфейсе.
👤 Учётные данные по умолчанию
Email: admin@tenerifeprop.com
Password: admin123
📄 Лицензия
MIT License - UniqueSoft
Description
Languages
HTML
57.8%
TypeScript
23.1%
JavaScript
11%
CSS
5.9%
Shell
1.5%
Other
0.7%