Select Git revision
item.go 19.08 KiB
package items
import (
"context"
"fmt"
"time"
"git.perx.ru/perxis/perxis-go/pkg/data"
"git.perx.ru/perxis/perxis-go/pkg/errors"
"git.perx.ru/perxis/perxis-go/pkg/locales"
"git.perx.ru/perxis/perxis-go/pkg/schema"
"git.perx.ru/perxis/perxis-go/pkg/schema/field"
"git.perx.ru/perxis/perxis-go/pkg/schema/localizer"
pb "git.perx.ru/perxis/perxis-go/proto/items"
"google.golang.org/protobuf/types/known/structpb"
"google.golang.org/protobuf/types/known/timestamppb"
)
var (
ErrNotSystemField = errors.New("not a system field")
ErrIncorrectValue = errors.New("incorrect value")
ErrIncorrectField = errors.New("incorrect field")
ErrReservedField = errors.New("cannot use reserved field name")
)
type State int
func (s State) String() string {
switch s {
case StateDraft:
return "Draft"
case StateArchived:
return "Archived"
case StateChanged:
return "Changed"
case StatePublished:
return "Published"
}
return "Unknown"
}
const (
StateDraft State = iota
StatePublished
StateChanged
StateArchived
StateMax = StateArchived
SoftDeleteSeparator = "___"
)
var PermissionsAllowAny = &Permissions{
Edit: true,
Archive: true,
Publish: true,
SoftDelete: true,
HardDelete: true,
}
// SystemFields - системные поля Item
var SystemFields = []string{
"id",
"space_id",
"env_id",
"collection_id",
"state",
"created_rev_at",
"created_by",
"created_at",