Версия 0.3.1 Правки для работы в Docker.
This commit is contained in:
parent
4cf6f8034c
commit
569d10a4ba
Binary file not shown.
@ -14,7 +14,7 @@ services:
|
||||
- .:/app
|
||||
- /app/node_modules
|
||||
- ./uploads:/app/uploads
|
||||
- ./db:/app/db
|
||||
- ./db:/app/db:rw
|
||||
environment:
|
||||
- NODE_ENV=development
|
||||
- CHOKIDAR_USEPOLLING=true
|
||||
|
@ -9,7 +9,7 @@ services:
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./uploads:/app/uploads
|
||||
- ./lawn_scheduler.db:/app/lawn_scheduler.db
|
||||
- ./lawn_scheduler.db:/app/db/lawn_scheduler.db
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
networks:
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "lawn-mowing-scheduler",
|
||||
"private": true,
|
||||
"version": "0.3.0",
|
||||
"version": "0.3.1",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "concurrently \"npm run server\" \"npm run client\"",
|
||||
|
@ -6,13 +6,13 @@ echo "Starting Lawn Scheduler in Development Mode..."
|
||||
mkdir -p uploads
|
||||
|
||||
# Build and start services
|
||||
docker-compose -f docker-compose.dev.yml down
|
||||
docker-compose -f docker-compose.dev.yml build --no-cache
|
||||
docker-compose -f docker-compose.dev.yml up -d
|
||||
docker compose -f docker-compose.dev.yml down
|
||||
docker compose -f docker-compose.dev.yml build --no-cache
|
||||
docker compose -f docker-compose.dev.yml up -d
|
||||
|
||||
echo "Development environment started!"
|
||||
echo "Frontend (Vite): http://localhost:8080"
|
||||
echo "Backend API: http://localhost:3001"
|
||||
echo ""
|
||||
echo "To view logs: docker-compose -f docker-compose.dev.yml logs -f"
|
||||
echo "To stop: docker-compose -f docker-compose.dev.yml down"
|
||||
echo "To view logs: docker compose -f docker-compose.dev.yml logs -f"
|
||||
echo "To stop: docker compose -f docker-compose.dev.yml down"
|
@ -7,12 +7,12 @@ mkdir -p nginx/conf.d
|
||||
mkdir -p uploads
|
||||
|
||||
# Build and start services
|
||||
docker-compose down
|
||||
docker-compose build --no-cache
|
||||
docker-compose up -d
|
||||
docker compose down
|
||||
docker compose build --no-cache
|
||||
docker compose up -d
|
||||
|
||||
echo "Application started!"
|
||||
echo "Access the application at: http://localhost"
|
||||
echo ""
|
||||
echo "To view logs: docker-compose logs -f"
|
||||
echo "To stop: docker-compose down"
|
||||
echo "To view logs: docker compose logs -f"
|
||||
echo "To stop: docker compose down"
|
@ -641,7 +641,11 @@ app.put('/api/zones/:id', upload.single('image'), async (req, res) => {
|
||||
sql = 'UPDATE zones SET name = ?, imagePath = ?, lastMowedDate = ?, intervalDays = ?, scheduleType = ?, nextMowDate = NULL, area = ? WHERE id = ?';
|
||||
args = [name, imagePath, lastMowedDate || null, parseInt(intervalDays), scheduleType || 'interval', parseFloat(area) || 0, req.params.id];
|
||||
}
|
||||
|
||||
|
||||
console.log('Updating zone with data:', { name, intervalDays, lastMowedDate, nextMowDate, scheduleType, area });
|
||||
console.log('SQL:', sql);
|
||||
console.log('ARGS:', args);
|
||||
|
||||
await db.execute({ sql, args });
|
||||
|
||||
// Delete old image if new one was provided
|
||||
|
@ -290,7 +290,7 @@ const Dashboard: React.FC = () => {
|
||||
<div>
|
||||
<p className="text-sm font-medium text-gray-600">Актуально</p>
|
||||
<p className="text-2xl font-bold text-gray-900">{okCount}</p>
|
||||
<p className="text-xs text-gray-500">обслужено зон</p>
|
||||
<p className="text-xs text-gray-500">зон обслужено</p>
|
||||
</div>
|
||||
<CheckCircle className="h-8 w-8 text-emerald-500" />
|
||||
</div>
|
||||
|
@ -1,17 +1,17 @@
|
||||
import { Zone, ZoneFormData, MowingHistoryResponse, MowingStats, MowingFormData, Mower, MowerFormData, BulkMowingFormData } from '../types/zone';
|
||||
|
||||
const API_BASE = new URL('api', import.meta.env.VITE_API_URL).toString();
|
||||
const API_BASE = import.meta.env.VITE_API_URL;
|
||||
|
||||
export const api = {
|
||||
async getZones(): Promise<Zone[]> {
|
||||
const response = await fetch(`${API_BASE}/zones`);
|
||||
console.log(`${API_BASE}/zones`);
|
||||
const response = await fetch(`${API_BASE}/api/zones`);
|
||||
console.log(`${API_BASE}/api/zones`);
|
||||
if (!response.ok) throw new Error('Failed to fetch zones');
|
||||
return response.json();
|
||||
},
|
||||
|
||||
async getZone(id: number): Promise<Zone> {
|
||||
const response = await fetch(`${API_BASE}/zones/${id}`);
|
||||
const response = await fetch(`${API_BASE}/api/zones/${id}`);
|
||||
if (!response.ok) throw new Error('Failed to fetch zone');
|
||||
return response.json();
|
||||
},
|
||||
@ -32,7 +32,7 @@ export const api = {
|
||||
formData.append('image', data.image);
|
||||
}
|
||||
|
||||
const response = await fetch(`${API_BASE}/zones`, {
|
||||
const response = await fetch(`${API_BASE}/api/zones`, {
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
});
|
||||
@ -60,7 +60,7 @@ export const api = {
|
||||
formData.append('image', data.image);
|
||||
}
|
||||
|
||||
const response = await fetch(`${API_BASE}/zones/${id}`, {
|
||||
const response = await fetch(`${API_BASE}/api/zones/${id}`, {
|
||||
method: 'PUT',
|
||||
body: formData,
|
||||
});
|
||||
@ -70,14 +70,14 @@ export const api = {
|
||||
},
|
||||
|
||||
async deleteZone(id: number): Promise<void> {
|
||||
const response = await fetch(`${API_BASE}/zones/${id}`, {
|
||||
const response = await fetch(`${API_BASE}/api/zones/${id}`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
if (!response.ok) throw new Error('Failed to delete zone');
|
||||
},
|
||||
|
||||
async markAsMowed(id: number, data?: MowingFormData): Promise<Zone> {
|
||||
const response = await fetch(`${API_BASE}/zones/${id}/mow`, {
|
||||
const response = await fetch(`${API_BASE}/api/zones/${id}/mow`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@ -89,7 +89,7 @@ export const api = {
|
||||
},
|
||||
|
||||
async markAsTrimmed(id: number, data?: MowingFormData): Promise<void> {
|
||||
const response = await fetch(`${API_BASE}/zones/${id}/trim`, {
|
||||
const response = await fetch(`${API_BASE}/api/zones/${id}/trim`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@ -99,7 +99,7 @@ export const api = {
|
||||
if (!response.ok) throw new Error('Failed to mark as trimmed');
|
||||
},
|
||||
async bulkMarkAsMowed(data: BulkMowingFormData): Promise<void> {
|
||||
const response = await fetch(`${API_BASE}/zones/bulk-mow`, {
|
||||
const response = await fetch(`${API_BASE}/api/zones/bulk-mow`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@ -118,25 +118,25 @@ export const api = {
|
||||
params.append('zoneId', zoneId.toString());
|
||||
}
|
||||
|
||||
const response = await fetch(`${API_BASE}/history?${params}`);
|
||||
const response = await fetch(`${API_BASE}/api/history?${params}`);
|
||||
if (!response.ok) throw new Error('Failed to fetch mowing history');
|
||||
return response.json();
|
||||
},
|
||||
|
||||
async getMowingStats(period = 30): Promise<MowingStats> {
|
||||
const response = await fetch(`${API_BASE}/history/stats?period=${period}`);
|
||||
const response = await fetch(`${API_BASE}/api/history/stats?period=${period}`);
|
||||
if (!response.ok) throw new Error('Failed to fetch mowing statistics');
|
||||
return response.json();
|
||||
},
|
||||
|
||||
async getMowers(): Promise<Mower[]> {
|
||||
const response = await fetch(`${API_BASE}/mowers`);
|
||||
const response = await fetch(`${API_BASE}/api/mowers`);
|
||||
if (!response.ok) throw new Error('Failed to fetch mowers');
|
||||
return response.json();
|
||||
},
|
||||
|
||||
async createMower(data: MowerFormData): Promise<Mower> {
|
||||
const response = await fetch(`${API_BASE}/mowers`, {
|
||||
const response = await fetch(`${API_BASE}/api/mowers`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
Loading…
x
Reference in New Issue
Block a user