Skip to content

Commit

Permalink
update: repository
Browse files Browse the repository at this point in the history
  • Loading branch information
amirhnajafiz committed Aug 12, 2023
1 parent b659845 commit 2d3ed07
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions internal/http/handler/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,23 @@ def __create_url_for_object__(self, bucket: str, key: str, limit: int) -> str:
bucket, key, expires=timedelta(days=limit),
)

def __create_object__(self, url: URL):
"""create a new object in database
:param url: url object
"""
# get a new cursor
cursor = self.database.get_cursor()

cursor.execute(
"INSERT INTO `urls` (bucket, object_key, url, created_at, address, status) VALUES (%s,%s,%s,%s,%s,%s);",
url.write()
)

self.database.commit()

cursor.close()

def register_object(self, bucket: str, key: str, limit: int):
"""register an object into our system
Expand Down

0 comments on commit 2d3ed07

Please sign in to comment.