2020-10-14 06:48:48 -04:00
|
|
|
package models
|
|
|
|
|
|
|
|
|
|
import (
|
2020-11-09 18:08:16 +01:00
|
|
|
"time"
|
2022-06-15 15:11:36 +02:00
|
|
|
|
|
|
|
|
"github.com/grafana/grafana/pkg/util/errutil"
|
2020-10-14 06:48:48 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var (
|
2022-06-15 15:11:36 +02:00
|
|
|
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")
|
2020-10-14 06:48:48 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type ShortUrl struct {
|
|
|
|
|
Id int64
|
|
|
|
|
OrgId int64
|
|
|
|
|
Uid string
|
|
|
|
|
Path string
|
|
|
|
|
CreatedBy int64
|
|
|
|
|
CreatedAt int64
|
|
|
|
|
LastSeenAt int64
|
|
|
|
|
}
|
2020-11-09 18:08:16 +01:00
|
|
|
|
|
|
|
|
type DeleteShortUrlCommand struct {
|
|
|
|
|
OlderThan time.Time
|
|
|
|
|
|
|
|
|
|
NumDeleted int64
|
|
|
|
|
}
|