-
Notifications
You must be signed in to change notification settings - Fork 13
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
Added functionality to auto-wipe inactive records #91
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Kartikey S. Chauhan <[email protected]>
Someone is attempting to deploy a commit to a Personal Account owned by @anirudhb on Vercel. @anirudhb first needs to authorize it. |
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.
Thanks!
record.uid_salt = "empty" | ||
record.uid_hash = "empty hash"; |
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.
Alternatively, using all zeros would be okay too
record.uid_salt = "empty" | |
record.uid_hash = "empty hash"; | |
record.uid_salt = "" | |
// hashUser("", "") | |
record.uid_hash = "d72c87d0f077c7766f2985dfab30e8955c373a13a1e93d315203939f542ff86e73ee37c31f4c4b571f4719fa8e3589f12db8dcb57ea9f56764bb7d58f64cf705"; |
const now = new Date(); | ||
const weekAgo = now.setDate(now.getDate() - 7) / 1000; | ||
const old_published_ts = record.published_ts; | ||
if (!old_published_ts) { |
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.
It would be better to check if the confession was rejected
record: Confession, | ||
): Promise<boolean> { | ||
const now = new Date(); | ||
const weekAgo = now.setDate(now.getDate() - 7) / 1000; |
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.
Would be better to compare with a constant (for example 7*24*60*60*1000
)
const now = new Date(); | ||
const weekAgo = now.setDate(now.getDate() - 7) / 1000; | ||
recordsFetched = await repository.find({ | ||
where: [ |
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.
May also be a good idea to filter out confessions that already have an empty hash/salt set
Integrates: Entries should be wiped from the confessions DB one week after the last reply from OP
Make sure to META_CHANNEL_ID and API_SECRET before merging
Feel free to request a review if you believe there are better names for new variables or if you have suggestions for improving the implementation logic.