Chore: Refectory of shorturl service, move models into service (#61295)

Chore: refectory of shorturl service, move models into service
This commit is contained in:
ying-jeanne
2023-01-12 17:13:47 +08:00
committed by GitHub
parent 84eb275c8d
commit 7339dbc090
11 changed files with 176 additions and 133 deletions
-31
View File
@@ -1,31 +0,0 @@
package models
import (
"time"
"github.com/grafana/grafana/pkg/util/errutil"
)
var (
ErrShortURLBadRequest = errutil.NewBase(errutil.StatusBadRequest, "shorturl.bad-request")
ErrShortURLNotFound = errutil.NewBase(errutil.StatusNotFound, "shorturl.not-found")
ErrShortURLAbsolutePath = errutil.NewBase(errutil.StatusValidationFailed, "shorturl.absolute-path", errutil.WithPublicMessage("Path should be relative"))
ErrShortURLInvalidPath = errutil.NewBase(errutil.StatusValidationFailed, "shorturl.invalid-path", errutil.WithPublicMessage("Invalid short URL path"))
ErrShortURLInternal = errutil.NewBase(errutil.StatusInternal, "shorturl.internal")
)
type ShortUrl struct {
Id int64
OrgId int64
Uid string
Path string
CreatedBy int64
CreatedAt int64
LastSeenAt int64
}
type DeleteShortUrlCommand struct {
OlderThan time.Time
NumDeleted int64
}