grafana/pkg/models/user_group.go

58 lines
1.0 KiB
Go
Raw Normal View History

package models
import (
"errors"
"time"
)
// Typed errors
var (
ErrUserGroupNotFound = errors.New("User Group not found")
ErrUserGroupNameTaken = errors.New("User Group name is taken")
)
// UserGroup model
type UserGroup struct {
2017-04-09 18:24:16 -05:00
Id int64 `json:"id"`
OrgId int64 `json:"orgId"`
Name string `json:"name"`
2017-04-09 18:24:16 -05:00
Created time.Time `json:"created"`
Updated time.Time `json:"updated"`
}
// ---------------------
// COMMANDS
type CreateUserGroupCommand struct {
Name string `json:"name" binding:"Required"`
2017-04-09 18:24:16 -05:00
OrgId int64 `json:"-"`
Result UserGroup `json:"-"`
}
type DeleteUserGroupCommand struct {
Id int64
}
type GetUserGroupByIdQuery struct {
Id int64
Result *UserGroup
}
type SearchUserGroupsQuery struct {
Query string
Name string
Limit int
Page int
2017-04-09 18:24:16 -05:00
Result SearchUserGroupQueryResult
}
type SearchUserGroupQueryResult struct {
TotalCount int64 `json:"totalCount"`
UserGroups []*UserGroup `json:"userGroups"`
Page int `json:"page"`
PerPage int `json:"perPage"`
}