code refactor and add unit tests

This commit is contained in:
MaysWind
2024-08-13 00:13:24 +08:00
parent d648226d13
commit c2757f68a6
7 changed files with 364 additions and 21 deletions
+4 -3
View File
@@ -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)
},