-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add optional expiration date to cleezy #36
base: dev
Are you sure you want to change the base?
add optional expiration date to cleezy #36
Conversation
Added expiration date column to db table (OPTIONAL PARAMETER)
modules/sqlite_helpers.py
Outdated
@@ -17,6 +17,7 @@ def maybe_create_table(sqlite_file: str) -> bool: | |||
url TEXT NOT NULL, | |||
alias TEXT NOT NULL, | |||
created_at DATETIME NOT NULL, | |||
expiration_date DATETIME DEFAULT NULL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we make this the last column, right now its second to last
done |
@@ -93,7 +104,7 @@ async def get_url(alias: str): | |||
logging.debug(f"/find called with alias: {alias}") | |||
with MetricsHandler.query_time.labels("find").time(): | |||
url_output = sqlite_helpers.get_url(DATABASE_FILE, alias) | |||
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if response is not None: | ||
MetricsHandler.url_count.inc(1) | ||
return { "url": urljson['url'], "alias": alias, "created_at": response} | ||
return { "url": urljson['url'], "alias": alias, "created_at": response, "expiration_date": expiration_date} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return { "url": urljson['url'], "alias": alias, "created_at": response, "expiration_date": expiration_date} | |
return return { | |
"url": urljson['url'], | |
"alias": alias, | |
"created_at": response, | |
"expiration_date": expiration_date, | |
} |
modules/sqlite_helpers.py
Outdated
db.commit() | ||
return True | ||
|
||
year_ago_date = current - timedelta(days=365) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
last thing, can we remove the logic to automatically delete urls that are a year old? from now on the user will have to specify an expiration date if they want it deleted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be done
…ttps://github.com/SCE-Development/cleezy into 33-add-an-optional-expiration-date-column-for-urls
Synchronized time formatting to '%Y-%m-%dT%H:%M:%S.
Added expiration date column to db table (OPTIONAL PARAMETER, SHOULD WORK EITHER WAY)
Auto delete on next URL request if expiration date is invalid
Some inconsistencies with timestamp formatting when I tested with Postman but I didn't know how to fix, small detail to clean up