Bearbeiten Button hinzugefügt
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@ FROM python:3.13-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN pip install --no-cache-dir fastapi uvicorn "psycopg[binary]" python-multipart jinja2 httpx
|
||||
RUN pip install --no-cache-dir fastapi uvicorn "psycopg[binary]" python-multipart jinja2 httpx bcrypt
|
||||
|
||||
COPY . .
|
||||
|
||||
|
||||
+942
-516
File diff suppressed because it is too large
Load Diff
@@ -30,6 +30,21 @@ a {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.edit-button {
|
||||
float: right;
|
||||
display: inline-block;
|
||||
padding: 10px 14px;
|
||||
background: #238636;
|
||||
color: #ffffff;
|
||||
border-radius: 9px;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.edit-button:hover {
|
||||
background: #2ea043;
|
||||
}
|
||||
|
||||
.concert-detail {
|
||||
background: #161b22;
|
||||
border: 1px solid #30363d;
|
||||
@@ -150,6 +165,11 @@ a {
|
||||
padding: 22px;
|
||||
}
|
||||
|
||||
.edit-button {
|
||||
float: none;
|
||||
margin: 0 0 20px;
|
||||
}
|
||||
|
||||
.flyer-container {
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,14 @@
|
||||
← Zurück zum Kalender
|
||||
</a>
|
||||
|
||||
{% if can_edit %}
|
||||
|
||||
<a href="/concerts/{{ concert.id }}/edit" class="edit-button">
|
||||
✏️ Konzert bearbeiten
|
||||
</a>
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
<article class="concert-detail">
|
||||
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{ concert.artist }} bearbeiten · Pingu Concerts</title>
|
||||
<link rel="stylesheet" href="/static/css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div class="header-inner">
|
||||
<a href="/" class="logo">🎸 Pingu <span>Concerts</span></a>
|
||||
</div>
|
||||
</header>
|
||||
<main>
|
||||
<div class="page-title">
|
||||
<h1>✏️ Konzert bearbeiten</h1>
|
||||
<p>Änderungen werden direkt beim Konzert gespeichert.</p>
|
||||
</div>
|
||||
<section class="empty">
|
||||
<form method="post" action="/concerts/{{ concert.id }}/edit" enctype="multipart/form-data">
|
||||
<p>
|
||||
<label>Künstler / Band<br>
|
||||
<input type="text" name="artist" value="{{ concert.artist }}" {% if not can_edit_title %}disabled{% endif %} required>
|
||||
</label>
|
||||
</p>
|
||||
{% if can_edit_details %}
|
||||
<p>
|
||||
<label>Veranstaltungsort<br>
|
||||
<input type="text" name="venue_name" value="{{ concert.venue.name if concert.venue.id else '' }}" placeholder="Name des Veranstaltungsorts">
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>Straße<br>
|
||||
<input type="text" name="street" value="{{ concert.venue.street or '' }}">
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>PLZ und Ort<br>
|
||||
<input type="text" name="postal_code" value="{{ concert.venue.postal_code or '' }}" placeholder="PLZ">
|
||||
<input type="text" name="city" value="{{ concert.venue.city or '' }}" placeholder="Ort">
|
||||
</label>
|
||||
</p>
|
||||
<input type="hidden" name="country" value="{{ concert.venue.country or 'Deutschland' }}">
|
||||
<input type="hidden" name="latitude" value="{{ concert.venue.latitude or '' }}">
|
||||
<input type="hidden" name="longitude" value="{{ concert.venue.longitude or '' }}">
|
||||
<p>
|
||||
<label>Beginn<br>
|
||||
<input type="datetime-local" name="start_datetime" value="{{ concert.start_local }}" required>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>Ende<br>
|
||||
<input type="datetime-local" name="end_datetime" value="{{ concert.end_local }}">
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>Beschreibung<br>
|
||||
<textarea name="description" rows="5">{{ concert.description or '' }}</textarea>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>Ticket-Link<br>
|
||||
<input type="url" name="ticket_url" value="{{ concert.ticket_url or '' }}" placeholder="https://...">
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>Ticketpreis<br>
|
||||
<input type="number" name="ticket_price" value="{{ concert.ticket_price or '' }}" step="0.01" min="0">
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>Neuen Flyer hochladen<br>
|
||||
<input type="file" name="flyer" accept="image/jpeg,image/png,image/webp">
|
||||
</label>
|
||||
<small>Ohne neue Datei bleibt der bisherige Flyer erhalten.</small>
|
||||
</p>
|
||||
{% if concert.flyer_path %}
|
||||
<p><img src="{{ concert.flyer_path }}" alt="Aktueller Flyer" style="max-width: 300px; max-height: 400px; border-radius: 10px;"></p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<div>
|
||||
<button type="submit" class="button">💾 Änderungen speichern</button>
|
||||
<a href="/concerts/{{ concert.id }}" class="button button-secondary">Abbrechen</a>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
@@ -19,8 +19,11 @@ services:
|
||||
- "8080:8000"
|
||||
environment:
|
||||
DATABASE_URL: postgresql://concerts:change-me-later@db:5432/concerts
|
||||
volumes:
|
||||
- concert_uploads:/app/static/uploads
|
||||
depends_on:
|
||||
- db
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
concert_uploads:
|
||||
|
||||
@@ -1,3 +1,30 @@
|
||||
CREATE TABLE users (
|
||||
id SERIAL PRIMARY KEY,
|
||||
username VARCHAR(50) NOT NULL UNIQUE,
|
||||
email VARCHAR(255) NOT NULL UNIQUE,
|
||||
password_hash TEXT NOT NULL,
|
||||
display_name VARCHAR(100),
|
||||
is_admin BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE registration_invites (
|
||||
id SERIAL PRIMARY KEY,
|
||||
token_hash TEXT NOT NULL UNIQUE,
|
||||
expires_at TIMESTAMP,
|
||||
used_by INTEGER REFERENCES users(id),
|
||||
used_at TIMESTAMP,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE sessions (
|
||||
id SERIAL PRIMARY KEY,
|
||||
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
token_hash TEXT NOT NULL UNIQUE,
|
||||
expires_at TIMESTAMP NOT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE venues (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
@@ -7,6 +34,8 @@ CREATE TABLE venues (
|
||||
country VARCHAR(100) DEFAULT 'Deutschland',
|
||||
latitude DOUBLE PRECISION,
|
||||
longitude DOUBLE PRECISION,
|
||||
external_id VARCHAR(255),
|
||||
source VARCHAR(50),
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
@@ -20,6 +49,23 @@ CREATE TABLE concerts (
|
||||
ticket_url TEXT,
|
||||
ticket_price NUMERIC(10,2),
|
||||
flyer_path TEXT,
|
||||
created_by INTEGER REFERENCES users(id) ON DELETE SET NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE concert_comments (
|
||||
id SERIAL PRIMARY KEY,
|
||||
concert_id INTEGER NOT NULL REFERENCES concerts(id) ON DELETE CASCADE,
|
||||
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
body TEXT NOT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE concert_photos (
|
||||
id SERIAL PRIMARY KEY,
|
||||
concert_id INTEGER NOT NULL REFERENCES concerts(id) ON DELETE CASCADE,
|
||||
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
path TEXT NOT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
@@ -28,3 +74,12 @@ CREATE INDEX idx_concerts_start_datetime
|
||||
|
||||
CREATE INDEX idx_venues_name
|
||||
ON venues(name);
|
||||
|
||||
CREATE INDEX idx_venues_external_id
|
||||
ON venues(external_id);
|
||||
|
||||
CREATE INDEX idx_concert_comments_concert
|
||||
ON concert_comments(concert_id, created_at);
|
||||
|
||||
CREATE INDEX idx_concert_photos_concert
|
||||
ON concert_photos(concert_id, created_at);
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
-- Bestehende Datenbanken nachziehen (wird auch beim App-Start ausgeführt).
|
||||
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
id SERIAL PRIMARY KEY,
|
||||
username VARCHAR(50) NOT NULL UNIQUE,
|
||||
email VARCHAR(255) NOT NULL UNIQUE,
|
||||
password_hash TEXT NOT NULL,
|
||||
display_name VARCHAR(100),
|
||||
is_admin BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
ALTER TABLE users
|
||||
ADD COLUMN IF NOT EXISTS is_admin BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS registration_invites (
|
||||
id SERIAL PRIMARY KEY,
|
||||
token_hash TEXT NOT NULL UNIQUE,
|
||||
expires_at TIMESTAMP,
|
||||
used_by INTEGER REFERENCES users(id),
|
||||
used_at TIMESTAMP,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS sessions (
|
||||
id SERIAL PRIMARY KEY,
|
||||
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
token_hash TEXT NOT NULL UNIQUE,
|
||||
expires_at TIMESTAMP NOT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
ALTER TABLE concerts
|
||||
ADD COLUMN IF NOT EXISTS created_by INTEGER REFERENCES users(id) ON DELETE SET NULL;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS concert_comments (
|
||||
id SERIAL PRIMARY KEY,
|
||||
concert_id INTEGER NOT NULL REFERENCES concerts(id) ON DELETE CASCADE,
|
||||
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
body TEXT NOT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS concert_photos (
|
||||
id SERIAL PRIMARY KEY,
|
||||
concert_id INTEGER NOT NULL REFERENCES concerts(id) ON DELETE CASCADE,
|
||||
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
path TEXT NOT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
Reference in New Issue
Block a user