added REACTION_UUID field to Reaction

This commit is contained in:
Thomas Rubini 2023-03-26 15:42:22 +02:00
parent 45ae1de69b
commit ef5ed73c9e
No known key found for this signature in database
GPG Key ID: C7D287C8C1CAC373

View File

@ -1,4 +1,6 @@
from sqlalchemy import Column, Integer, VARCHAR, Text, LargeBinary, ForeignKey
import uuid
from sqlalchemy import Column, Integer, VARCHAR, Text, LargeBinary, ForeignKey, UUID
from sqlalchemy.orm import relationship, declarative_base
Base = declarative_base()
@ -198,14 +200,16 @@ class Reaction(Base):
IMG = Column(LargeBinary(length=2**24), comment="Binary data of the image associated to this npc and trait")
NPC = relationship("Npc")
TRAIT = relationship("Trait")
REACTION_UUID = Column(UUID, unique=True, comment="ID of this reaction")
def __init__(self, REACTION_ID, NPC_ID, TRAIT_ID):
self.REACTION_ID = REACTION_ID
self.NPC_ID = NPC_ID
self.TRAIT_ID = TRAIT_ID
self.REACTION_UUID = uuid.uuid4()
def __str__(self) -> str:
return f"Reaction(REACTION_ID={self.REACTION_ID}, NPC_ID={self.NPC_ID}, TRAIT_ID={self.TRAIT_ID})"
return f"Reaction(REACTION_ID={self.REACTION_ID}, NPC_ID={self.NPC_ID}, TRAIT_ID={self.TRAIT_ID}, REACTION_UUID={self.REACTION_UUID})"
def __repr__(self) -> str:
return self.__str__()