code refactor and add unit tests
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
package cron
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/mayswind/ezbookkeeping/pkg/services"
|
||||
)
|
||||
|
||||
// RemoveExpiredTokensJob represents the cron job which periodically remove expired user tokens from the database
|
||||
var RemoveExpiredTokensJob = &CronJob{
|
||||
Name: "RemoveExpiredTokens",
|
||||
Description: "Periodically remove expired user tokens from the database.",
|
||||
Interval: 24 * time.Hour,
|
||||
Period: CronJobFixedHourPeriod{
|
||||
Hour: 0,
|
||||
},
|
||||
Run: func() error {
|
||||
return services.Tokens.DeleteAllExpiredTokens(nil)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user