diff --git a/backend/src/Datarekisteri/CLI.hs b/backend/src/Datarekisteri/CLI.hs index a0c0d2f..361e074 100644 --- a/backend/src/Datarekisteri/CLI.hs +++ b/backend/src/Datarekisteri/CLI.hs @@ -27,6 +27,7 @@ main = do (AddUser addUserOpts) -> addUserMain addUserOpts GCEmails -> gcEmailsMain GCApplications -> gcApplicationsMain + GCAll -> gcAllMain addUserMain :: AddUserOpts -> CLIM () addUserMain AddUserOpts {..} = do @@ -62,6 +63,11 @@ gcApplicationsMain :: CLIM () gcApplicationsMain = do deleteUsersWithoutEmail +gcAllMain :: CLIM () +gcAllMain = do + gcEmailsMain + gcApplicationsMain + cliOptions :: Parser CLIOptions cliOptions = CLIOptions <$> strOption (short 'u' <> long "db-url" <> metavar "URL" <> value "postgres:///datarekisteri-backend") @@ -72,6 +78,7 @@ cliCommandParser = hsubparser $ command "add-user" (info addUserCommand (progDesc "Add a user to datarekisteri")) <> command "gc-expired-emails" (info (pure GCEmails) (progDesc "Delete emails that have not been verified in time.")) <> command "gc-applications" (info (pure GCApplications) (progDesc "Delete users without an email address")) + <> command "gc" (info (pure GCAll) (progDesc "Run all garbage collection jobs.")) addUserCommand :: Parser CLISubCommand addUserCommand = fmap AddUser $ AddUserOpts @@ -97,6 +104,7 @@ data CLIOptions = CLIOptions data CLISubCommand = AddUser AddUserOpts | GCEmails | GCApplications + | GCAll data AddUserOpts = AddUserOpts { addUserNickname :: Maybe Text