14 KiB
14 KiB
Zeiterfassungstool - Projektstruktur
Backend (Go)
timetracker-backend/
├── cmd/ # Einstiegspunkte für die Anwendung
│ ├── api/ # API-Server
│ │ └── main.go
│ └── worker/ # Hintergrundprozesse (Reports, Benachrichtigungen usw.)
│ └── main.go
├── internal/ # Interner Code, nicht exportierbar
│ ├── auth/ # Authentifizierung und Autorisierung
│ │ ├── jwt.go
│ │ ├── middleware.go
│ │ ├── permissions.go
│ │ └── service.go
│ ├── tenant/ # Multi-Tenant-Funktionalität
│ │ ├── middleware.go
│ │ └── service.go
│ ├── user/ # Benutzerverwaltung
│ │ ├── model.go
│ │ ├── repository.go
│ │ └── service.go
│ ├── company/ # Unternehmensverwaltung
│ │ ├── model.go
│ │ ├── repository.go
│ │ └── service.go
│ ├── customer/ # Kundenverwaltung
│ │ ├── model.go
│ │ ├── repository.go
│ │ └── service.go
│ ├── project/ # Projektverwaltung
│ │ ├── model.go
│ │ ├── repository.go
│ │ └── service.go
│ ├── activity/ # Tätigkeitsverwaltung
│ │ ├── model.go
│ │ ├── repository.go
│ │ └── service.go
│ ├── timetracking/ # Zeiterfassung
│ │ ├── model.go
│ │ ├── repository.go
│ │ └── service.go
│ ├── billing/ # Abrechnung
│ │ ├── model.go
│ │ ├── repository.go
│ │ └── service.go
│ ├── reporting/ # Berichtswesen
│ │ ├── generator.go
│ │ ├── pdf.go
│ │ └── service.go
│ ├── notification/ # Benachrichtigungen
│ │ ├── email.go
│ │ ├── inapp.go
│ │ └── service.go
│ ├── kanban/ # Kanban-Board (Version 2)
│ │ ├── model.go
│ │ ├── repository.go
│ │ └── service.go
│ ├── task/ # Task-Management (Version 2)
│ │ ├── model.go
│ │ ├── repository.go
│ │ └── service.go
│ ├── sprint/ # Sprint-Management (Version 2)
│ │ ├── model.go
│ │ ├── repository.go
│ │ └── service.go
│ ├── config/ # Konfiguration
│ │ └── config.go
│ └── database/ # Datenbankzugriff
│ ├── migrations/
│ ├── seeds/
│ └── connection.go
├── pkg/ # Öffentliche Pakete, die exportiert werden können
│ ├── apierror/ # API-Fehlerobjekte
│ │ └── error.go
│ ├── logger/ # Logging-Funktionalität
│ │ └── logger.go
│ ├── validator/ # Validierungsfunktionen
│ │ └── validator.go
│ └── utils/ # Allgemeine Hilfsfunktionen
│ ├── dates.go
│ ├── encryption.go
│ └── helpers.go
├── api/ # API-Definitionen
│ ├── handlers/ # API-Handler
│ │ ├── auth.go
│ │ ├── user.go
│ │ ├── company.go
│ │ ├── customer.go
│ │ ├── project.go
│ │ ├── timetracking.go
│ │ ├── reporting.go
│ │ └── task.go
│ ├── middleware/ # API-Middleware
│ │ ├── auth.go
│ │ ├── tenant.go
│ │ └── logging.go
│ ├── routes/ # API-Routen
│ │ └── routes.go
│ └── swagger/ # Swagger-Dokumentation
│ └── swagger.yaml
├── test/ # Tests
│ ├── integration/
│ ├── unit/
│ └── mocks/
├── scripts/ # Skripte für Build, Deployment usw.
│ ├── build.sh
│ ├── migrate.sh
│ └── seed.sh
├── docker/ # Docker-Konfiguration
│ ├── Dockerfile
│ └── docker-compose.yml
├── go.mod
├── go.sum
├── .env.example
└── README.md
Frontend (NextJS)
timetracker-frontend/
├── public/ # Statische Dateien
│ ├── assets/
│ │ ├── images/
│ │ ├── icons/
│ │ └── fonts/
│ └── locales/ # Mehrsprachige Inhalte
│ ├── de/
│ └── en/
├── src/
│ ├── app/ # Next.js 13+ App Router
│ │ ├── api/ # API-Routen (falls nötig)
│ │ ├── (auth)/ # Authentifizierungsseiten
│ │ │ ├── login/
│ │ │ └── register/
│ │ ├── dashboard/ # Dashboard-Seiten
│ │ │ ├── page.tsx
│ │ │ └── layout.tsx
│ │ ├── time-tracking/ # Zeiterfassungsseiten
│ │ │ ├── page.tsx
│ │ │ ├── [id]/
│ │ │ └── components/
│ │ ├── projects/ # Projektseiten
│ │ │ ├── page.tsx
│ │ │ └── [id]/
│ │ ├── customers/ # Kundenseiten
│ │ │ ├── page.tsx
│ │ │ └── [id]/
│ │ ├── reports/ # Berichtsseiten
│ │ │ ├── page.tsx
│ │ │ └── [type]/
│ │ ├── admin/ # Administrationsseiten
│ │ │ ├── users/
│ │ │ ├── companies/
│ │ │ └── settings/
│ │ ├── kanban/ # Kanban-Boards (Version 2)
│ │ │ ├── page.tsx
│ │ │ └── [id]/
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── components/ # Wiederverwendbare Komponenten
│ │ ├── common/ # Allgemeine Komponenten
│ │ │ ├── Button.tsx
│ │ │ ├── Card.tsx
│ │ │ ├── Input.tsx
│ │ │ └── ...
│ │ ├── layout/ # Layout-Komponenten
│ │ │ ├── Navbar.tsx
│ │ │ ├── Sidebar.tsx
│ │ │ ├── Footer.tsx
│ │ │ └── ...
│ │ ├── dashboard/ # Dashboard-Komponenten
│ │ │ ├── ActivityChart.tsx
│ │ │ ├── RecentEntries.tsx
│ │ │ └── ...
│ │ ├── timetracker/ # Zeiterfassungskomponenten
│ │ │ ├── Timer.tsx
│ │ │ ├── EntryForm.tsx
│ │ │ └── ...
│ │ ├── reports/ # Berichtskomponenten
│ │ │ ├── ReportFilter.tsx
│ │ │ ├── Chart.tsx
│ │ │ └── ...
│ │ └── kanban/ # Kanban-Komponenten (Version 2)
│ │ ├── Board.tsx
│ │ ├── Column.tsx
│ │ ├── Card.tsx
│ │ └── ...
│ ├── hooks/ # Custom React Hooks
│ │ ├── useAuth.ts
│ │ ├── useTimeTracking.ts
│ │ ├── useProjects.ts
│ │ └── ...
│ ├── lib/ # Hilfsfunktionen und Bibliotheken
│ │ ├── api.ts # API Client
│ │ ├── auth.ts # Auth-Utilities
│ │ ├── date-utils.ts # Date-Helpers
│ │ └── ...
│ ├── types/ # TypeScript-Typdefinitionen
│ │ ├── auth.ts
│ │ ├── user.ts
│ │ ├── timeTracking.ts
│ │ ├── project.ts
│ │ └── ...
│ ├── store/ # State Management (falls benötigt)
│ │ ├── slices/
│ │ └── index.ts
│ ├── styles/ # CSS/SCSS Styles
│ │ ├── globals.css
│ │ └── theme.ts
│ └── utils/ # Allgemeine Hilfsfunktionen
│ ├── format.ts
│ ├── validation.ts
│ └── ...
├── .env.local.example
├── .eslintrc.json
├── next.config.js
├── package.json
├── tailwind.config.js
├── tsconfig.json
├── jest.config.js # Test-Konfiguration
├── postcss.config.js # PostCSS-Konfiguration
└── README.md
Datenbankschema (PostgreSQL)
-- Multi-Tenant
CREATE TABLE companies (
id UUID PRIMARY KEY,
name VARCHAR(255) NOT NULL,
address TEXT,
contact_email VARCHAR(255),
contact_phone VARCHAR(50),
logo_url TEXT,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW()
);
-- Benutzer und Rollen
CREATE TABLE roles (
id SERIAL PRIMARY KEY,
name VARCHAR(50) UNIQUE NOT NULL,
permissions JSONB
);
CREATE TABLE users (
id UUID PRIMARY KEY,
company_id UUID REFERENCES companies(id),
email VARCHAR(255) UNIQUE NOT NULL,
password_hash VARCHAR(255) NOT NULL,
first_name VARCHAR(100),
last_name VARCHAR(100),
role_id INTEGER REFERENCES roles(id),
hourly_rate DECIMAL(10, 2),
is_active BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW()
);
-- Kunden
CREATE TABLE customers (
id UUID PRIMARY KEY,
company_id UUID NOT NULL REFERENCES companies(id),
name VARCHAR(255) NOT NULL,
contact_person VARCHAR(255),
email VARCHAR(255),
phone VARCHAR(50),
address TEXT,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW()
);
-- Projekte
CREATE TABLE projects (
id UUID PRIMARY KEY,
company_id UUID NOT NULL REFERENCES companies(id),
customer_id UUID REFERENCES customers(id),
name VARCHAR(255) NOT NULL,
description TEXT,
start_date DATE,
end_date DATE,
status VARCHAR(50),
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW()
);
-- Tätigkeiten
CREATE TABLE activities (
id UUID PRIMARY KEY,
company_id UUID NOT NULL REFERENCES companies(id),
name VARCHAR(255) NOT NULL,
description TEXT,
billing_rate DECIMAL(10, 2),
is_active BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW()
);
-- Zeitbuchungen
CREATE TABLE time_entries (
id UUID PRIMARY KEY,
company_id UUID NOT NULL REFERENCES companies(id),
user_id UUID NOT NULL REFERENCES users(id),
project_id UUID NOT NULL REFERENCES projects(id),
activity_id UUID NOT NULL REFERENCES activities(id),
start_time TIMESTAMP NOT NULL,
end_time TIMESTAMP NOT NULL,
duration INTEGER NOT NULL, -- in minutes
description TEXT,
billable_percentage INTEGER NOT NULL DEFAULT 100,
billing_rate DECIMAL(10, 2),
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW()
);
-- Version 2: Sprint/Task Management
CREATE TABLE sprints (
id UUID PRIMARY KEY,
project_id UUID NOT NULL REFERENCES projects(id),
name VARCHAR(255) NOT NULL,
start_date DATE NOT NULL,
end_date DATE NOT NULL,
status VARCHAR(50),
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW()
);
CREATE TABLE task_statuses (
id SERIAL PRIMARY KEY,
company_id UUID NOT NULL REFERENCES companies(id),
name VARCHAR(100) NOT NULL,
color VARCHAR(7),
position INTEGER NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW()
);
CREATE TABLE tasks (
id UUID PRIMARY KEY,
company_id UUID NOT NULL REFERENCES companies(id),
project_id UUID NOT NULL REFERENCES projects(id),
sprint_id UUID REFERENCES sprints(id),
title VARCHAR(255) NOT NULL,
description TEXT,
assignee_id UUID REFERENCES users(id),
status_id INTEGER REFERENCES task_statuses(id),
priority VARCHAR(50),
estimate INTEGER, -- in minutes
due_date TIMESTAMP,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW()
);
CREATE TABLE kanban_boards (
id UUID PRIMARY KEY,
company_id UUID NOT NULL REFERENCES companies(id),
project_id UUID NOT NULL REFERENCES projects(id),
name VARCHAR(255) NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW()
);
CREATE TABLE kanban_columns (
id UUID PRIMARY KEY,
board_id UUID NOT NULL REFERENCES kanban_boards(id),
name VARCHAR(100) NOT NULL,
position INTEGER NOT NULL,
task_status_id INTEGER REFERENCES task_statuses(id),
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW()
);
-- Verknüpfung zwischen Zeitbuchungen und Tasks
ALTER TABLE time_entries ADD COLUMN task_id UUID REFERENCES tasks(id);
-- Indizes für Performance
CREATE INDEX idx_time_entries_user ON time_entries(user_id);
CREATE INDEX idx_time_entries_project ON time_entries(project_id);
CREATE INDEX idx_time_entries_date ON time_entries(start_time);
CREATE INDEX idx_projects_company ON projects(company_id);
CREATE INDEX idx_users_company ON users(company_id);
CREATE INDEX idx_tasks_project ON tasks(project_id);
CREATE INDEX idx_tasks_sprint ON tasks(sprint_id);