fix: tasks now refresh after add/update/delete
Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled
Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled
This commit is contained in:
9
.env.example
Normal file
9
.env.example
Normal 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
52
docker-compose.yml
Normal 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:
|
||||||
@@ -15,8 +15,8 @@ server {
|
|||||||
proxy_cache_bypass $http_upgrade;
|
proxy_cache_bypass $http_upgrade;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Proxy direct backend endpoints (projects, tenants, etc.)
|
# Proxy direct backend endpoints (projects, tenants, tasks, etc.)
|
||||||
location ~ ^/(projects|tenants) {
|
location ~ ^/(projects|tenants|tasks) {
|
||||||
proxy_pass http://backend:3000;
|
proxy_pass http://backend:3000;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ const ProjectDetailPanel: React.FC<ProjectDetailPanelProps> = ({ projectId, onCl
|
|||||||
});
|
});
|
||||||
setNewTaskTitle('');
|
setNewTaskTitle('');
|
||||||
message.success('Task added');
|
message.success('Task added');
|
||||||
|
await fetchTasks(project.id); // Refresh the task list
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!project) {
|
if (!project) {
|
||||||
@@ -195,14 +196,25 @@ const ProjectDetailPanel: React.FC<ProjectDetailPanelProps> = ({ projectId, onCl
|
|||||||
renderItem={(task) => (
|
renderItem={(task) => (
|
||||||
<List.Item
|
<List.Item
|
||||||
actions={[
|
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
|
<List.Item.Meta
|
||||||
avatar={
|
avatar={
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={task.status === 'done'}
|
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={
|
title={
|
||||||
|
|||||||
Reference in New Issue
Block a user