From c036d042c37a592eeb6c9ce4a2a406642ddc8a0f Mon Sep 17 00:00:00 2001 From: Elia el Lazkani Date: Tue, 24 Dec 2024 01:31:25 +0100 Subject: [PATCH] fix(): Adds the pointer to the session before proceeding --- shortenit/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shortenit/main.py b/shortenit/main.py index 6a9a7f6..b3258a1 100644 --- a/shortenit/main.py +++ b/shortenit/main.py @@ -65,9 +65,9 @@ def shorten_it(config: dict, session: Session, data: str, ttl: int): _link = Link(data=data, pointers=[]) _pointer = Pointer(data=identifier, link_id=_link.id, link=_link, ttl=ttl) + session.add(_pointer) _link.pointers.append(_pointer) session.add(_link) - session.add(_pointer) session.commit() return _pointer.data return None