LearnersGuild / idm

identity management service
MIT License
2 stars 24 forks source link

automatically expire old invite codes #154

Closed jeffreywescott closed 7 years ago

jeffreywescott commented 7 years ago

Fixes ch89.

Overview

Up until now, we've been getting around the fact that our invite codes don't expire by periodically prefixing codes that we want to expire with the string DISABLED--. This manual process is a waste of time, and error-prone.

This PR adds two flags to invite codes: active and permanent, defaulting to true and false respectively. It also adds a script to expire old invite codes without their permanent flag set to true if they haven't been used in at least two weeks.

Data Model / DB Schema Changes

Adds active and permanent flags to inviteCodes tables (via a migration) and GraphQL models.

Environment / Configuration Changes

Adds an npm script: expireInviteCodes that should be run once per day in production via Heroku's scheduler.

Notes

bundacia commented 7 years ago

I'm planning to look at this this afternoon. Need to get some time this morning to stay heads-down and focus on RXP-related stories.

bundacia commented 7 years ago

I see you renamed an old migration. The name of the migrations are stored in the database once they're applied.

rethinkdb_administration_console

This is probably not going to hurt anything since the timestamp should be used to determine if I migration has been run before, but it feels a little icky. I'm not sure the benefit of the renamed file outweighs the potential downsides of having the filename not match the entry in the _migrations table.