commentmodel

package
v0.0.1-test Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2022 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ObjectTypeOrg is reserved for future use for per-org comments.
	ObjectTypeOrg = "org"
	// ObjectTypeDashboard used for dashboard-wide comments.
	ObjectTypeDashboard = "dashboard"
	// ObjectTypeAnnotation used for annotation comments.
	ObjectTypeAnnotation = "annotation"
)

Variables

View Source
var RegisteredObjectTypes = map[string]struct{}{
	ObjectTypeOrg:        {},
	ObjectTypeDashboard:  {},
	ObjectTypeAnnotation: {},
}

Functions

This section is empty.

Types

type Comment

type Comment struct {
	Id      int64
	GroupId int64
	UserId  int64
	Content string

	Created int64
	Updated int64
}

func (Comment) TableName

func (i Comment) TableName() string

func (Comment) ToDTO

func (i Comment) ToDTO(user *CommentUser) *CommentDto

type CommentDto

type CommentDto struct {
	Id      int64        `json:"id"`
	UserId  int64        `json:"userId"`
	Content string       `json:"content"`
	Created int64        `json:"created"`
	User    *CommentUser `json:"user,omitempty"`
}

type CommentGroup

type CommentGroup struct {
	Id         int64
	OrgId      int64
	ObjectType string
	ObjectId   string
	Settings   Settings

	Created int64
	Updated int64
}

func (CommentGroup) TableName

func (i CommentGroup) TableName() string

type CommentUser

type CommentUser struct {
	Id        int64  `json:"id"`
	Name      string `json:"name"`
	Login     string `json:"login"`
	Email     string `json:"email"`
	AvatarUrl string `json:"avatarUrl"`
}

type Event

type Event struct {
	Event          EventType   `json:"event"`
	CommentCreated *CommentDto `json:"commentCreated"`
}

Event represents comment event structure.

type EventType

type EventType string
const (
	EventCommentCreated EventType = "commentCreated"
)

type PermissionChecker

type PermissionChecker struct {
	// contains filtered or unexported fields
}

func NewPermissionChecker

func NewPermissionChecker(sqlStore *sqlstore.SQLStore, features featuremgmt.FeatureToggles,
	accessControl accesscontrol.AccessControl, dashboardService dashboards.DashboardService,
	annotationsRepo annotations.Repository,
) *PermissionChecker

func (*PermissionChecker) CheckReadPermissions

func (c *PermissionChecker) CheckReadPermissions(ctx context.Context, orgId int64, signedInUser *user.SignedInUser, objectType string, objectID string) (bool, error)

func (*PermissionChecker) CheckWritePermissions

func (c *PermissionChecker) CheckWritePermissions(ctx context.Context, orgId int64, signedInUser *user.SignedInUser, objectType string, objectID string) (bool, error)

type Settings

type Settings struct {
}

func (*Settings) Scan

func (s *Settings) Scan(value interface{}) error

func (Settings) Value

func (s Settings) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL