mirror of
https://github.com/OHV-IT/collabrix.git
synced 2025-12-15 16:48:36 +01:00
- Complete chat application similar to Microsoft Teams - Code snippet library with syntax highlighting - Real-time messaging with WebSockets - File upload with Office integration - Department-based permissions - Dark/Light theme support - Production deployment with SSL/Reverse Proxy - Docker containerization - PostgreSQL database with SQLModel ORM
131 lines
3.2 KiB
Markdown
131 lines
3.2 KiB
Markdown
# Team Chat - Schnellstart-Anleitung
|
|
|
|
## Schnellstart mit Docker
|
|
|
|
```bash
|
|
# Im Projektverzeichnis
|
|
docker-compose up -d
|
|
|
|
# Warten bis Services bereit sind (ca. 30 Sekunden)
|
|
docker-compose logs -f
|
|
|
|
# Zugriff:
|
|
# Frontend: http://localhost:5173
|
|
# Backend API: http://localhost:8000/docs
|
|
```
|
|
|
|
## Erste Schritte
|
|
|
|
1. **Registrieren:** http://localhost:5173/register
|
|
- Username: admin
|
|
- Email: admin@example.com
|
|
- Password: Admin123!
|
|
|
|
2. **Abteilung & Kanal erstellen** (via API oder später im UI):
|
|
```bash
|
|
# Login Token holen
|
|
TOKEN=$(curl -X POST http://localhost:8000/auth/login \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"username":"admin","password":"Admin123!"}' \
|
|
| jq -r .access_token)
|
|
|
|
# Abteilung erstellen
|
|
curl -X POST http://localhost:8000/departments/ \
|
|
-H "Authorization: Bearer $TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"name":"IT","description":"IT Department"}'
|
|
|
|
# User zu Abteilung hinzufügen (User-ID 1, Dept-ID 1)
|
|
curl -X POST http://localhost:8000/departments/1/users/1 \
|
|
-H "Authorization: Bearer $TOKEN"
|
|
|
|
# Kanal erstellen
|
|
curl -X POST http://localhost:8000/channels/ \
|
|
-H "Authorization: Bearer $TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"name":"general","department_id":1}'
|
|
```
|
|
|
|
3. **Im Frontend:** Login → Chat ansehen → Snippet erstellen
|
|
|
|
## Manueller Start (ohne Docker)
|
|
|
|
**Backend:**
|
|
```bash
|
|
cd backend
|
|
python -m venv venv
|
|
source venv/bin/activate
|
|
pip install -r requirements.txt
|
|
cp .env.example .env
|
|
# PostgreSQL-DB "teamchat" muss existieren
|
|
uvicorn app.main:app --reload
|
|
```
|
|
|
|
**Frontend:**
|
|
```bash
|
|
cd frontend
|
|
npm install
|
|
npm run dev
|
|
```
|
|
|
|
## Tests ausführen
|
|
|
|
```bash
|
|
cd backend
|
|
pytest -v
|
|
```
|
|
|
|
## Demo-Daten Script
|
|
|
|
```python
|
|
# scripts/create_demo_data.py
|
|
import requests
|
|
|
|
BASE_URL = "http://localhost:8000"
|
|
|
|
# Register users
|
|
users = [
|
|
{"username": "alice", "email": "alice@example.com", "password": "pass123", "full_name": "Alice Smith"},
|
|
{"username": "bob", "email": "bob@example.com", "password": "pass123", "full_name": "Bob Jones"},
|
|
]
|
|
|
|
for user in users:
|
|
requests.post(f"{BASE_URL}/auth/register", json=user)
|
|
|
|
# Login als alice
|
|
response = requests.post(f"{BASE_URL}/auth/login", json={"username": "alice", "password": "pass123"})
|
|
token = response.json()["access_token"]
|
|
headers = {"Authorization": f"Bearer {token}"}
|
|
|
|
# Departments erstellen
|
|
depts = [
|
|
{"name": "Engineering", "description": "Engineering Team"},
|
|
{"name": "Marketing", "description": "Marketing Team"},
|
|
]
|
|
|
|
for dept in depts:
|
|
requests.post(f"{BASE_URL}/departments/", json=dept, headers=headers)
|
|
|
|
# User zu Department hinzufügen
|
|
requests.post(f"{BASE_URL}/departments/1/users/1", headers=headers) # Alice zu Engineering
|
|
|
|
# Channels erstellen
|
|
requests.post(f"{BASE_URL}/channels/", json={"name": "general", "department_id": 1}, headers=headers)
|
|
|
|
# Snippet erstellen
|
|
requests.post(f"{BASE_URL}/snippets/", json={
|
|
"title": "FastAPI Hello World",
|
|
"language": "python",
|
|
"content": "from fastapi import FastAPI\n\napp = FastAPI()\n\n@app.get('/')\ndef read_root():\n return {'Hello': 'World'}",
|
|
"tags": "fastapi, python",
|
|
"visibility": "organization"
|
|
}, headers=headers)
|
|
|
|
print("✅ Demo-Daten erstellt!")
|
|
```
|
|
|
|
Ausführen:
|
|
```bash
|
|
python scripts/create_demo_data.py
|
|
```
|