ifndefJOSH / usurl

GNU General Public License v3.0
1 stars 0 forks source link

Make URLs expire #7

Open ifndefJOSH opened 1 year ago

ifndefJOSH commented 1 year ago

I would like URLs to expire after 30 days. However, rather than have a separate timer or thread to do this, it would be easier to have this done whenever a user creates a URL.

You will need to write a function in order to execute a simple query on the database which checks to see if the created timestamp for all entries is 30 days old or older, and deletes entries where that is true.

You will need to use a SQL delete statement with a where clause. Please see https://www.w3schools.com/sql/sql_delete.asp

If the /report endpoint is also created by the time this issue is claimed, please also have your function called when a URL is reported. Please make sure that you pass in the SQL cursor from the parent function, as it is more efficient to reuse the same database cursor since the action occurs in the same thread.