Initial commit: Shop Database Flask Application
Flask backend with Vue 3 frontend for shop floor machine management. Includes database schema export for MySQL shopdb_flask database. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
27
shopdb/core/models/knowledgebase.py
Normal file
27
shopdb/core/models/knowledgebase.py
Normal file
@@ -0,0 +1,27 @@
|
||||
"""Knowledge Base models."""
|
||||
|
||||
from shopdb.extensions import db
|
||||
from .base import BaseModel
|
||||
|
||||
|
||||
class KnowledgeBase(BaseModel):
|
||||
"""Knowledge Base article linking to external resources."""
|
||||
__tablename__ = 'knowledgebase'
|
||||
|
||||
linkid = db.Column(db.Integer, primary_key=True)
|
||||
appid = db.Column(db.Integer, db.ForeignKey('applications.appid'))
|
||||
shortdescription = db.Column(db.String(500), nullable=False)
|
||||
linkurl = db.Column(db.String(2000))
|
||||
keywords = db.Column(db.String(500))
|
||||
clicks = db.Column(db.Integer, default=0)
|
||||
lastupdated = db.Column(db.DateTime, default=db.func.now(), onupdate=db.func.now())
|
||||
|
||||
# Relationships
|
||||
application = db.relationship('Application', backref=db.backref('knowledgebase_articles', lazy='dynamic'))
|
||||
|
||||
def __repr__(self):
|
||||
return f"<KnowledgeBase {self.linkid}: {self.shortdescription[:50] if self.shortdescription else 'No desc'}>"
|
||||
|
||||
def increment_clicks(self):
|
||||
"""Increment click counter."""
|
||||
self.clicks = (self.clicks or 0) + 1
|
||||
Reference in New Issue
Block a user