Add true up review status history, add migration for persisting history, add store to create, get, and update true up review history entries, cleanup errors, etc.

Этот коммит содержится в:
Conor Macpherson
2022-12-22 14:59:05 -05:00
родитель 91bc4b3c80
Коммит 88090ea40b
19 изменённых файлов: 488 добавлений и 17 удалений

Просмотреть файл

@@ -16,6 +16,7 @@ import (
"os"
"path/filepath"
"strconv"
"time"
"github.com/mattermost/mattermost-server/v6/model"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
@@ -34,6 +35,9 @@ hwIDAQAB
var LicenseValidator LicenseValidatorIface
const TrueUpReviewDueDay = 15
const BusinessQuaterStep = 3
func init() {
if LicenseValidator == nil {
LicenseValidator = &LicenseValidatorImpl{}
@@ -224,3 +228,21 @@ func GetSanitizedClientLicense(l map[string]string) map[string]string {
return sanitizedLicense
}
func GetNextTrueUpReviewDueDate() string {
now := time.Now().UTC()
quaterEndMonths := []time.Month{time.March, time.June, time.September, time.December}
var nextQuaterEndMonth time.Month = time.March
for _, month := range quaterEndMonths {
if now.Month() <= month && now.Day() <= TrueUpReviewDueDay {
nextQuaterEndMonth = month
break
} else if now.Month() <= month && now.Day() > TrueUpReviewDueDay {
nextQuaterEndMonth = month + BusinessQuaterStep
break
}
}
return time.Date(now.Year(), nextQuaterEndMonth, TrueUpReviewDueDay, 0, 0, 0, 0, now.Location()).Format("2006-01-02")
}