major updates to theming, creation of showcase view and polish of existing systems including tagging editting.

This commit is contained in:
Bryan Van Deusen
2026-01-18 11:32:21 -05:00
parent 5f568f43bc
commit 46144ccc76
21 changed files with 1787 additions and 557 deletions
+2 -22
View File
@@ -1,7 +1,4 @@
from . import db
from flask_login import UserMixin
from . import login_manager
from datetime import datetime
# tag to object relationship table
image_tags = db.Table(
@@ -19,13 +16,6 @@ image_tags = db.Table(
db.UniqueConstraint("image_id", "tag_id", name="uq_image_tag"),
)
class User(UserMixin, db.Model):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(64), unique=True, nullable=False)
email = db.Column(db.String(120), unique=True, nullable=False)
password_hash = db.Column(db.String(256), nullable=False)
is_admin = db.Column(db.Boolean, default=False)
class ImageRecord(db.Model):
__tablename__ = "image_record"
id = db.Column(db.Integer, primary_key=True)
@@ -34,7 +24,6 @@ class ImageRecord(db.Model):
thumb_path = db.Column(db.String(512))
hash = db.Column(db.String(64), unique=True, nullable=False) # SHA256
perceptual_hash = db.Column(db.String(16), nullable=True) # hex of 64-bit hash
# artist = db.Column(db.String(255), nullable=True)
file_size = db.Column(db.Integer, nullable=True)
width = db.Column(db.Integer, nullable=True)
height = db.Column(db.Integer, nullable=True)
@@ -47,11 +36,10 @@ class ImageRecord(db.Model):
"Tag",
secondary=image_tags,
back_populates="images",
passive_deletes=True, # <-- let DB handle deletes
passive_deletes=True,
)
class Tag(db.Model):
# __tablename__ = "tag" (implicit)
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(255), unique=True, nullable=False)
kind = db.Column(db.String(64), nullable=True)
@@ -69,18 +57,10 @@ class ArchiveRecord(db.Model):
"""
__tablename__ = "archive_record"
id = db.Column(db.Integer, primary_key=True)
filename = db.Column(db.String(512), nullable=False) # full path or logical name
filename = db.Column(db.String(512), nullable=False)
file_size = db.Column(db.BigInteger, nullable=False)
hash = db.Column(db.String(64), unique=True, nullable=False) # SHA256 of the archive file
imported_at = db.Column(db.DateTime, default=db.func.now())
# optional: where this archive lived in the source tree (e.g., artist dir)
artist = db.Column(db.String(255), nullable=True)
# Link to the tag we created for this archive so we can reuse it if the same archive returns
tag_id = db.Column(db.Integer, db.ForeignKey("tag.id", ondelete="SET NULL"), nullable=True)
tag = db.relationship("Tag")
@login_manager.user_loader
def load_user(user_id):
return User.query.get(int(user_id))