kc token public key/token issue, path root set to 1

This commit is contained in:
h z
2024-12-06 10:04:03 +00:00
parent 4b9c1ba727
commit 48dd59f8e4
9 changed files with 139 additions and 82 deletions

View File

@@ -1,5 +1,5 @@
#db/models/Path.py
from sqlalchemy import Column, Text, LargeBinary, String, Integer, ForeignKey, UniqueConstraint
from sqlalchemy import Column, String, Integer, ForeignKey, UniqueConstraint
from db.models import Base
@@ -7,7 +7,7 @@ class Path(Base):
__tablename__ = "path"
id = Column(Integer, primary_key=True, autoincrement=True)
name = Column(String(50), nullable=False)
parent_id = Column(Integer, ForeignKey("path.id"))
parent_id = Column(Integer, ForeignKey("path.id"), nullable=True)
__table_args__ = (UniqueConstraint("parent_id", "name", name="unique_parent_id_name"), )
def to_dict(self):
return {

View File

@@ -2,6 +2,6 @@
from db import get_db
def insert_log(log_entry):
with get_db() as db:
db.add(log_entry)
db.commit()
with get_db() as session:
session.add(log_entry)
session.commit()