From 344544da5202f1fda2f545620027a037af5aa28b Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi <256895@studenti.unimore.it> Date: Thu, 29 Apr 2021 04:35:51 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20serializer=20to=20Condition?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/backend/nest_backend/database/tables/Condition.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/code/backend/nest_backend/database/tables/Condition.py b/code/backend/nest_backend/database/tables/Condition.py index 46e6ee4..cb16d3f 100644 --- a/code/backend/nest_backend/database/tables/Condition.py +++ b/code/backend/nest_backend/database/tables/Condition.py @@ -15,3 +15,10 @@ class Condition(Base.Model): used = Base.relationship("Uses", back_populates="condition") tweets = Base.relationship("Contains", back_populates="condition") operations = Base.relationship("BoolOperation", back_populates="condition") + + def to_json(self): + return { + "id": self.id, + "type": self.type, + "content": self.content, + }