Cleanup gang

This commit is contained in:
2025-04-17 14:28:25 +02:00
parent 7755a150e4
commit aa90134fb4
5 changed files with 21 additions and 2 deletions

View File

@@ -4,9 +4,11 @@ from wtforms.validators import DataRequired
from flask_wtf.file import FileField, FileAllowed # type: ignore
# Form for service on dashboard, connected to database through ORM
class ServiceForm(FlaskForm):
name = StringField("Service name:", validators=[DataRequired()])
url = URLField("Service URL:", validators=[DataRequired()])
# File field that only allows jpg, jpeg or png
image = FileField(
"Icon:",
validators=[

View File

@@ -1,14 +1,17 @@
from application import db
# Service class for dashboard
class Service(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String, nullable=False)
url = db.Column(db.String, nullable=False)
icon = db.Column(db.String, default="google.png")
# Foreign key to connect to User table
user_id = db.Column(db.Integer, db.ForeignKey("user.id"), nullable=False)
# Initialize the service (prevents ugly red lines)
def __init__(
self, name: str, url: str, user_id: int, icon: str = "google.png"
):