fix: tasks now refresh after add/update/delete
Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled

This commit is contained in:
gitmuhammedalbayrak
2025-11-30 21:07:28 +03:00
parent 9918a7556a
commit 80d17e9cfb
4 changed files with 77 additions and 4 deletions

9
.env.example Normal file
View File

@@ -0,0 +1,9 @@
# Database Configuration
DB_HOST=postgres
DB_PORT=5432
DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_DATABASE=evrak
# Application
NODE_ENV=development

52
docker-compose.yml Normal file
View File

@@ -0,0 +1,52 @@
services:
postgres:
image: postgres:14-alpine
container_name: evrak-postgres
environment:
POSTGRES_DB: evrak
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
interval: 5s
timeout: 5s
retries: 5
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: evrak-backend
environment:
DB_HOST: postgres
DB_PORT: 5432
DB_USERNAME: postgres
DB_PASSWORD: postgres
DB_DATABASE: evrak
NODE_ENV: development
ports:
- "3000:3000"
volumes:
- ./backend:/app
- /app/node_modules
depends_on:
postgres:
condition: service_healthy
command: npm run start:dev
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: evrak-frontend
ports:
- "8080:80"
depends_on:
- backend
volumes:
postgres_data:

View File

@@ -15,8 +15,8 @@ server {
proxy_cache_bypass $http_upgrade;
}
# Proxy direct backend endpoints (projects, tenants, etc.)
location ~ ^/(projects|tenants) {
# Proxy direct backend endpoints (projects, tenants, tasks, etc.)
location ~ ^/(projects|tenants|tasks) {
proxy_pass http://backend:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;

View File

@@ -101,6 +101,7 @@ const ProjectDetailPanel: React.FC<ProjectDetailPanelProps> = ({ projectId, onCl
});
setNewTaskTitle('');
message.success('Task added');
await fetchTasks(project.id); // Refresh the task list
};
if (!project) {
@@ -195,14 +196,25 @@ const ProjectDetailPanel: React.FC<ProjectDetailPanelProps> = ({ projectId, onCl
renderItem={(task) => (
<List.Item
actions={[
<Button type="text" danger icon={<DeleteOutlined />} onClick={() => deleteTask(task.id)} />
<Button
type="text"
danger
icon={<DeleteOutlined />}
onClick={async () => {
await deleteTask(task.id);
if (project) await fetchTasks(project.id);
}}
/>
]}
>
<List.Item.Meta
avatar={
<Checkbox
checked={task.status === 'done'}
onChange={(e) => updateTask(task.id, { status: e.target.checked ? 'done' : 'todo' })}
onChange={async (e) => {
await updateTask(task.id, { status: e.target.checked ? 'done' : 'todo' });
if (project) await fetchTasks(project.id);
}}
/>
}
title={