diff --git a/application/dash/templates/dashboard.html b/application/dash/templates/dashboard.html
index 5b79a81..c08ec70 100644
--- a/application/dash/templates/dashboard.html
+++ b/application/dash/templates/dashboard.html
@@ -5,9 +5,14 @@
{%block content%}
{% for service in services%}
-
- Name: {{service["name"]}}
- URL: {{service["url"]}}
+
+
+
+ Name: {{service["name"]}}
+ URL: {{service["url"]}}
+
{% endfor %}
diff --git a/application/dash/views.py b/application/dash/views.py
index 4455fc2..3bd06c1 100644
--- a/application/dash/views.py
+++ b/application/dash/views.py
@@ -1,5 +1,5 @@
from application import db
-from flask import Blueprint, render_template
+from flask import Blueprint, render_template, redirect, url_for
from application.dash.forms import RegisterForm, ServiceForm
from flask_login import login_required, current_user # type: ignore
from application.dash.models import Service
@@ -56,6 +56,20 @@ def admin():
return render_template("admin.html", form=register_form)
+@dash_blueprint.route("/delete_item/
", methods=["POST"])
+@login_required
+def delete_item(service_id: int):
+ service = Service.query.get_or_404(service_id)
+
+ # Check ownership
+ if service.user_id != current_user.id:
+ return redirect(url_for("dash.index"))
+
+ db.session.delete(service)
+ db.session.commit()
+ return redirect(url_for("dash.index"))
+
+
@dash_blueprint.route("/service", methods=["GET", "POST"])
@login_required
def service():
diff --git a/seed.py b/seed.py
index f85fce5..e2a8c5e 100644
--- a/seed.py
+++ b/seed.py
@@ -22,11 +22,23 @@ new_users = [
password=generate_password_hash("test123"),
is_admin=False,
),
+ User(
+ username="stef",
+ password=generate_password_hash("stef123"),
+ is_admin=False,
+ ),
]
new_services = [
Service(name="test123", url="http://google.com", user_id=1),
Service(name="Netflix", url="https://www.netflix.com", user_id=2),
+ # Stef services
+ Service(name="Plex", url="https://plex.local", user_id=3),
+ Service(name="TrueNAS", url="https://truenas.local", user_id=3),
+ Service(name="Transmission", url="https://transmission.local", user_id=3),
+ Service(name="Tautulli", url="https://tautulli.local", user_id=3),
+ Service(name="Overseerr", url="https://overseerr.local", user_id=3),
+ Service(name="Plex", url="https://plex.local", user_id=3),
]
with app.app_context():