Documentation ¶
Index ¶
- Constants
- Variables
- func AuthorizedAsAgent(user *models.User) bool
- func AuthorizedAsSpecifiedUser(user *models.User, id bson.ObjectId) bool
- func AuthorizedLogged(user *models.User) bool
- func ChangeSetM(setM map[string]interface{}) helpers.M
- func CheckAuthorizedAsAgent(c *echo.Context) *models.User
- func CheckAuthorizedLogged(c *echo.Context) *models.User
- func CheckValidation(v *validation.Validation)
- func CurrentUser(h echo.HandlerFunc) echo.HandlerFunc
- func ErrorInvaidArgsWithMsg(msg string) error
- func ErrorInvalidArgType(name, typeName string) error
- func ErrorInvalidRequestBodyWithError(err error) error
- func GetCurrentBrand() *models.Brand
- func GetCurrentUser(c *echo.Context) *models.User
- func GetCurrentUserFromContext(c *echo.Context) (*models.User, error)
- func GetJsonArgsFromContext(c *echo.Context, args interface{})
- func GetLogger(c *echo.Context) *xlogger.XLogger
- func GetMapArgsFromContext(c *echo.Context) map[string]interface{}
- func NowUnix() int64
- func OutputJson(data interface{}, c *echo.Context) error
- func RegisterBaseModule(cfg *config.Config, mux *echo.Group)
- func RegisterBrandModule(cfg *config.Config, mux *echo.Group)
- func RegisterFileModule(cfg *config.Config, mux *echo.Group) error
- func RegisterFocusModule(cfg *config.Config, mux *echo.Group)
- func RegisterProfileModule(cfg *config.Config, mux *echo.Group)
- func RegisterTicketsModule(cfg *config.Config, mux *echo.Group)
- func RegisterUserModule(cfg *config.Config, mux *echo.Group)
- type BaseModule
- type BrandInitArgs
- type BrandModule
- type BrandUpdateArgs
- type CommentAddArgs
- type FileStorager
- type FocusAddArgs
- type FocusModule
- type InternalFileModule
- type InternalLocalStorager
- type ListArgs
- type ListResult
- type ProfileModule
- type ProfileUpdateArgs
- type SigninArgs
- type TicketAddArgs
- type TicketModule
- type UserModule
Constants ¶
View Source
const ( ListLimitMin = 5 ListLimitDefault = 30 ListLimitMax = 100 )
View Source
const ( StatusCodeOK = http.StatusOK StatusCodeInternalError = 579 ErrCodeInvalidRequestBody = 990101 ErrCodeInvalidArgs = 990102 ErrCodeInvalidJsonObjectType = 990105 )
Variables ¶
View Source
var ( ErrInternalError = jsonutils.NewAPIError(StatusCodeInternalError, 990103, "internal error") ErrInvalidId = jsonutils.NewAPIError(http.StatusBadRequest, 990104, "invalid id") ErrUnlogged = jsonutils.NewAPIError(http.StatusForbidden, 990202, "unlogged") ErrAgentOnly = jsonutils.NewAPIError(http.StatusForbidden, 990203, "for agent only") ErrBrandAlreadyInitialized = jsonutils.NewAPIError(http.StatusForbidden, 110101, "brand already initialized") ErrBrandNotFound = jsonutils.NewAPIError(http.StatusBadRequest, 110102, "brand not found") ErrAgentNotFound = jsonutils.NewAPIError(http.StatusBadRequest, 110201, "agent not found") ErrAgentPasswordNotMatch = jsonutils.NewAPIError(http.StatusForbidden, 110202, "passwod not match") ErrTicketDuplicate = jsonutils.NewAPIError(http.StatusBadRequest, 110301, "ticket with duplicate channel") ErrTicketNotFound = jsonutils.NewAPIError(http.StatusNotFound, 110302, "ticket not found") ErrCommentNotFound = jsonutils.NewAPIError(http.StatusNotFound, 110401, "comment not found") ErrCommentUnchangeable = jsonutils.NewAPIError(http.StatusForbidden, 110402, "comment unchangeable") ErrUserNotFound = jsonutils.NewAPIError(http.StatusNotFound, 110501, "user not found") ErrFocusNotFound = jsonutils.NewAPIError(http.StatusNotFound, 110601, "focus not found") ErrFocusAlreadyHandled = jsonutils.NewAPIError(http.StatusBadRequest, 110602, "focus already handled") ErrResourceNotFound = jsonutils.NewAPIError(http.StatusNotFound, 110701, "resource not found") ErrFileInternalInvalidToken = jsonutils.NewAPIError(http.StatusForbidden, 110801, "invalid file token") ErrFileInternalInvalidRequest = jsonutils.NewAPIError(http.StatusBadRequest, 110802, "invalid request uploading file") ErrFileInternalFileNotFound = jsonutils.NewAPIError(http.StatusBadRequest, 110803, "uploading file not found") )
View Source
var (
ErrExpectingOSFile = fmt.Errorf("expected an *os.File")
)
Functions ¶
func AuthorizedAsAgent ¶
func AuthorizedLogged ¶
func ChangeSetM ¶
func CheckValidation ¶
func CheckValidation(v *validation.Validation)
func CurrentUser ¶
func CurrentUser(h echo.HandlerFunc) echo.HandlerFunc
func ErrorInvaidArgsWithMsg ¶
func ErrorInvalidArgType ¶
func GetCurrentBrand ¶
func GetJsonArgsFromContext ¶
func GetMapArgsFromContext ¶
func OutputJson ¶
Types ¶
type BaseModule ¶
type BaseModule struct {
// contains filtered or unexported fields
}
type BrandInitArgs ¶
type BrandModule ¶
type BrandModule struct {
// contains filtered or unexported fields
}
type BrandUpdateArgs ¶
type BrandUpdateArgs struct {
Base models.BrandBaseInfo `json:"base"`
}
brand
type CommentAddArgs ¶
type CommentAddArgs struct { Type string `json:"type"` Content string `json:"content"` Attachments []*models.File `json:"attachments"` }
comment
type FileStorager ¶
type FileStorager interface {
Store(*multipart.FileHeader) (*models.File, error)
}
type FocusAddArgs ¶
type FocusAddArgs struct { Priority models.TypePriority `json:"priority"` Message string `json:"message"` ResourceType string `json:"resourceType"` ResourceId bson.ObjectId `json:"resourceId"` Duration int64 `json:"duration"` }
focus
type FocusModule ¶
type FocusModule struct {
// contains filtered or unexported fields
}
type InternalFileModule ¶
type InternalFileModule struct {
// contains filtered or unexported fields
}
type InternalLocalStorager ¶
type InternalLocalStorager struct {
// contains filtered or unexported fields
}
func (*InternalLocalStorager) Store ¶
func (this *InternalLocalStorager) Store(header *multipart.FileHeader) (*models.File, error)
type ListArgs ¶
type ListArgs struct { Limit int `json:"limit"` Sort string `json:"sort"` LastId bson.ObjectId `json:"lastId"` }
func GetListArgsFromRequest ¶
type ListResult ¶
type ListResult struct { Count int `json:"count"` Items interface{} `json:"items"` }
func ListResultNew ¶
func ListResultNew(count int, items interface{}) *ListResult
type ProfileModule ¶
type ProfileModule struct {
// contains filtered or unexported fields
}
type ProfileUpdateArgs ¶
type ProfileUpdateArgs struct {
Base models.UserBaseInfo `json:"base"`
}
profile
type TicketAddArgs ¶
type TicketAddArgs struct { Email string `json:"email"` Channel string `json:"channel` Subject string `json:"subject"` Content string `json:"content"` Status string `json:"status"` IsPublic bool `json:"isPublic,omitempty"` Attachments []*models.File `json:"attachments"` Extend map[string]string `json:"extend"` }
ticket
type TicketModule ¶
type TicketModule struct {
// contains filtered or unexported fields
}
type UserModule ¶
type UserModule struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.