app

package
v0.0.0-...-d0a596a Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnonymousName = "Anonymous"
)
View Source
const (
	ErrLookupNameReq = "Lookup name is required"
)
View Source
const (
	ErrStatusNameReq = "Status name is required"
)

Variables

View Source
var (
	AppDatabaseError            = errors.NewInternalError("app.process_api.database.perform_query.error", "database error occurred")
	AppResponseNormalizingError = errors.NewInternalError("app.process_api.response.normalize.error", "error occurred while normalizing response")
	AppMapParsingError          = errors.NewInternalError("app.process_api.map_parsing.error", "error occurred while parsing map")
	AppForbiddenError           = errors.NewForbiddenError("app.process_api.response.access.error", "unable access resource")
	AppInternalError            = errors.NewInternalError("app.process_api.execution.error", "error occurred while processing request")
)
View Source
var CaseCommentMetadata = model.NewObjectMetadata(caseCommentsObjScope, caseObjScope, []*model.Field{
	{Name: "id", Default: false},
	{Name: "etag", Default: true},
	{Name: "ver", Default: false},
	{Name: "created_at", Default: true},
	{Name: "created_by", Default: true},
	{Name: "updated_at", Default: true},
	{Name: "updated_by", Default: false},
	{Name: "text", Default: true},
	{Name: "edited", Default: true},
	{Name: "can_edit", Default: true},
	{Name: "author", Default: true},
})
View Source
var CaseCommunicationMetadata = model.NewObjectMetadata("", caseObjScope, []*model.Field{
	{Name: "etag", Default: true},
	{Name: "ver", Default: false},
	{"id", true},
	{"communication_type", true},
	{"communication_id", true},
})
View Source
var CaseFileMetadata = model.NewObjectMetadata("", caseObjScope, []*model.Field{
	{Name: "id", Default: true},
	{Name: "size", Default: true},
	{Name: "mime", Default: true},
	{Name: "name", Default: true},
	{Name: "created_at", Default: true},
	{Name: "created_by", Default: true},

	{Name: "author", Default: true},
})
View Source
var CaseLinkMetadata = model.NewObjectMetadata("", caseObjScope, []*model.Field{
	{"etag", true},
	{"id", false},
	{"ver", false},
	{"created_by", true},
	{"created_at", true},
	{"updated_by", false},
	{"updated_at", false},
	{"author", true},
	{"name", true},
	{"url", true},
	{"case_id", false},
})
View Source
var (
	CaseMetadata = model.NewObjectMetadata(caseObjScope, "", []*model.Field{
		{Name: "etag", Default: true},
		{Name: "id", Default: true},
		{Name: "ver", Default: false},
		{Name: "created_by", Default: true},
		{Name: "created_at", Default: true},
		{Name: "updated_by", Default: false},
		{Name: "updated_at", Default: false},
		{Name: "assignee", Default: true},
		{Name: "reporter", Default: true},
		{Name: "name", Default: true},
		{Name: "subject", Default: true},
		{Name: "description", Default: true},
		{Name: "source", Default: true},
		{Name: "priority", Default: true},
		{Name: "impacted", Default: true},
		{Name: "author", Default: true},
		{Name: "planned_reaction_at", Default: true},
		{Name: "planned_resolve_at", Default: true},
		{Name: "status", Default: true},
		{Name: "close_reason_group", Default: true},
		{Name: "group", Default: true},
		{Name: "close", Default: true},
		{Name: "rate", Default: true},
		{Name: "sla_condition", Default: true},
		{Name: "service", Default: true},
		{Name: "status_condition", Default: true},
		{Name: "sla", Default: true},
		{Name: "comments", Default: false},
		{Name: "links", Default: false},
		{Name: "files", Default: false},
		{Name: "related", Default: false},
		{Name: "timing", Default: true},
		{Name: "contact_info", Default: true},
	}, CaseCommentMetadata, CaseLinkMetadata, RelatedCaseMetadata)
)
View Source
var CaseTimelineMetadata = model.NewObjectMetadata("", caseObjScope, []*model.Field{
	{cases.CaseTimelineEventType_call.String(), true},
	{cases.CaseTimelineEventType_chat.String(), true},
	{cases.CaseTimelineEventType_email.String(), true},
})
View Source
var ErrUnknownType = errors.New("unknown type")
View Source
var PriorityMetadata = model.NewObjectMetadata(model.ScopeDictionary, "", []*model.Field{
	{"id", true},
	{"created_by", false},
	{"created_at", false},
	{"updated_by", false},
	{"updated_at", false},
	{"name", true},
	{"description", true},
	{"color", true},
})
View Source
var RelatedCaseMetadata = model.NewObjectMetadata("", caseObjScope, []*model.Field{
	{Name: "id", Default: true},
	{Name: "ver", Default: true},
	{Name: "created_at", Default: true},
	{Name: "created_by", Default: true},
	{Name: "updated_at", Default: false},
	{Name: "updated_by", Default: false},
	{Name: "related_case", Default: true},
	{Name: "primary_case", Default: true},
	{Name: "relation", Default: true},
})

Functions

func BuildDatabase

func BuildDatabase(config *conf.DatabaseConfig) store.Store

func NormalizeCommentsResponse

func NormalizeCommentsResponse(res interface{}, opts model.Fielder) error

func NormalizeResponseCommunications

func NormalizeResponseCommunications(res []*cases.CaseCommunication, requestedFields []string) error
func NormalizeResponseLink(res *cases.CaseLink, opts model.Fielder) error
func NormalizeResponseLinks(res *cases.CaseLinkList, requestedFields []string) error

func RegisterServices

func RegisterServices(grpcServer *grpc.Server, appInstance *App)

RegisterServices initializes and registers all necessary gRPC services.

func ValidateCaseCommunicationsCreate

func ValidateCaseCommunicationsCreate(input ...*cases.InputCaseCommunication) error

Types

type AMQPBroker

type AMQPBroker interface {
	QueueDeclare(queueName string, opts ...rabbit.QueueDeclareOption) (string, cerr.AppError)
	ExchangeDeclare(exchangeName string, kind string, opts ...rabbit.ExchangeDeclareOption) cerr.AppError
	QueueBind(exchangeName string, queueName string, routingKey string, noWait bool, args map[string]any) cerr.AppError
	Publish(exchange string, routingKey string, body []byte, userId string, t time.Time) cerr.AppError
}

type App

type App struct {
	Store store.Store
	// contains filtered or unexported fields
}

func New

func New(config *conf.AppConfig, shutdown func(ctx context.Context) error) (*App, error)

func (*App) AuthorizeFromContext

func (a *App) AuthorizeFromContext(ctx context.Context) (*user_auth.UserAuthSession, error)

func (*App) Start

func (a *App) Start() error

func (*App) Stop

func (a *App) Stop() error

type CaseAMQPObserver

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

func NewCaseAMQPObserver

func NewCaseAMQPObserver(amqpBroker AMQPBroker, config *model.WatcherConfig) (*CaseAMQPObserver, error)

func (*CaseAMQPObserver) GetId

func (cao *CaseAMQPObserver) GetId() string

func (*CaseAMQPObserver) Update

func (cao *CaseAMQPObserver) Update(et EventType, data []byte) error

type CaseCommentService

type CaseCommentService struct {
	cases.UnimplementedCaseCommentsServer
	// contains filtered or unexported fields
}

func NewCaseCommentService

func NewCaseCommentService(app *App) (*CaseCommentService, cerror.AppError)

func (*CaseCommentService) DeleteComment

func (*CaseCommentService) ListComments

func (*CaseCommentService) LocateComment

func (*CaseCommentService) PublishComment

func (*CaseCommentService) UpdateComment

type CaseCommunicationService

type CaseCommunicationService struct {
	cases.UnimplementedCaseCommunicationsServer
	// contains filtered or unexported fields
}

func NewCaseCommunicationService

func NewCaseCommunicationService(app *App) (*CaseCommunicationService, errors.AppError)

func (*CaseCommunicationService) LinkCommunication

func (*CaseCommunicationService) ListCommunications

func (*CaseCommunicationService) UnlinkCommunication

type CaseFileService

type CaseFileService struct {
	cases.UnimplementedCaseFilesServer
	// contains filtered or unexported fields
}

func NewCaseFileService

func NewCaseFileService(app *App) (*CaseFileService, cerror.AppError)

func (*CaseFileService) DeleteFile

func (c *CaseFileService) DeleteFile(ctx context.Context, req *cases.DeleteFileRequest) (*cases.File, error)

func (*CaseFileService) ListFiles

type CaseLinkService

type CaseLinkService struct {
	cases.UnimplementedCaseLinksServer
	// contains filtered or unexported fields
}

func NewCaseLinkService

func NewCaseLinkService(app *App) (*CaseLinkService, cerror.AppError)

type CaseService

type CaseService struct {
	cases.UnimplementedCasesServer
	// contains filtered or unexported fields
}

func NewCaseService

func NewCaseService(app *App) (*CaseService, cerror.AppError)

func (*CaseService) CreateCase

func (c *CaseService) CreateCase(ctx context.Context, req *cases.CreateCaseRequest) (*cases.Case, error)

func (*CaseService) DeleteCase

func (c *CaseService) DeleteCase(ctx context.Context, req *cases.DeleteCaseRequest) (*cases.Case, error)

func (*CaseService) LocateCase

func (c *CaseService) LocateCase(ctx context.Context, req *cases.LocateCaseRequest) (*cases.Case, error)

func (*CaseService) NormalizeResponseCase

func (c *CaseService) NormalizeResponseCase(re *cases.Case, opts model.Fielder) error

NormalizeResponseCase validates and normalizes the response cases.Case to the front-end side.

func (*CaseService) NormalizeResponseCases

func (c *CaseService) NormalizeResponseCases(res *cases.CaseList, mainOpts model.Fielder, subOpts map[string]model.Fielder) error

NormalizeResponseCases validates and normalizes the response cases.CaseList to the front-end side.

func (*CaseService) SearchCases

func (c *CaseService) SearchCases(ctx context.Context, req *cases.SearchCasesRequest) (*cases.CaseList, error)

func (*CaseService) UpdateCase

func (c *CaseService) UpdateCase(ctx context.Context, req *cases.UpdateCaseRequest) (*cases.Case, error)

func (*CaseService) ValidateCreateInput

func (c *CaseService) ValidateCreateInput(input *cases.InputCreateCase) cerror.AppError

func (*CaseService) ValidateUpdateInput

func (c *CaseService) ValidateUpdateInput(
	input *cases.InputCase,
	xJsonMask []string,
) cerror.AppError

type CaseTimelineService

type CaseTimelineService struct {
	cases.UnimplementedCaseTimelineServer
	// contains filtered or unexported fields
}

func NewCaseTimelineService

func NewCaseTimelineService(app *App) (*CaseTimelineService, errors.AppError)

func (CaseTimelineService) GetTimeline

func (CaseTimelineService) GetTimelineCounter

type CatalogService

type CatalogService struct {
	cases.UnimplementedCatalogsServer
	// contains filtered or unexported fields
}

func NewCatalogService

func NewCatalogService(app *App) (*CatalogService, cerror.AppError)

NewCatalogService creates a new CatalogService.

func (*CatalogService) CreateCatalog

func (s *CatalogService) CreateCatalog(ctx context.Context, req *cases.CreateCatalogRequest) (*cases.Catalog, error)

CreateCatalog implements cases.CatalogsServer.

func (*CatalogService) DeleteCatalog

DeleteCatalog implements cases.CatalogsServer.

func (*CatalogService) ListCatalogs

func (s *CatalogService) ListCatalogs(
	ctx context.Context,
	req *cases.ListCatalogRequest,
) (*cases.CatalogList, error)

ListCatalogs implements cases.CatalogsServer.

func (*CatalogService) LocateCatalog

LocateCatalog implements cases.CatalogsServer.

func (*CatalogService) UpdateCatalog

func (s *CatalogService) UpdateCatalog(ctx context.Context, req *cases.UpdateCatalogRequest) (*cases.Catalog, error)

UpdateCatalog implements cases.CatalogsServer.

type CloseReasonGroupService

type CloseReasonGroupService struct {
	_go.UnimplementedCloseReasonGroupsServer
	// contains filtered or unexported fields
}

func NewCloseReasonGroupsService

func NewCloseReasonGroupsService(app *App) (*CloseReasonGroupService, cerror.AppError)

func (CloseReasonGroupService) CreateCloseReasonGroup

func (CloseReasonGroupService) DeleteCloseReasonGroup

func (CloseReasonGroupService) ListCloseReasonGroups

func (CloseReasonGroupService) LocateCloseReasonGroup

func (CloseReasonGroupService) UpdateCloseReasonGroup

type CloseReasonService

type CloseReasonService struct {
	_go.UnimplementedCloseReasonsServer
	// contains filtered or unexported fields
}

func NewCloseReasonService

func NewCloseReasonService(app *App) (*CloseReasonService, cerror.AppError)

func (*CloseReasonService) CreateCloseReason

func (s *CloseReasonService) CreateCloseReason(ctx context.Context, req *_go.CreateCloseReasonRequest) (*_go.CloseReason, error)

CreateCloseReason implements api.CloseReasonsServer.

func (*CloseReasonService) DeleteCloseReason

func (s *CloseReasonService) DeleteCloseReason(ctx context.Context, req *_go.DeleteCloseReasonRequest) (*_go.CloseReason, error)

DeleteCloseReason implements api.CloseReasonsServer.

func (*CloseReasonService) ListCloseReasons

ListCloseReasons implements api.CloseReasonsServer.

func (*CloseReasonService) LocateCloseReason

LocateCloseReason implements api.CloseReasonsServer.

func (*CloseReasonService) UpdateCloseReason

func (s *CloseReasonService) UpdateCloseReason(ctx context.Context, req *_go.UpdateCloseReasonRequest) (*_go.CloseReason, error)

UpdateCloseReason implements api.CloseReasonsServer.

type DefaultWatcher

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

func NewDefaultWatcher

func NewDefaultWatcher() *DefaultWatcher

func (*DefaultWatcher) Attach

func (dw *DefaultWatcher) Attach(et EventType, o Observer)

func (*DefaultWatcher) Detach

func (dw *DefaultWatcher) Detach(et EventType, o Observer)

func (*DefaultWatcher) Notify

func (dw *DefaultWatcher) Notify(et EventType, entity WatchMarshaller) error

func (*DefaultWatcher) OnCreate

func (dw *DefaultWatcher) OnCreate(entity WatchMarshaller) error

func (*DefaultWatcher) OnDelete

func (dw *DefaultWatcher) OnDelete(entity WatchMarshaller) error

func (*DefaultWatcher) OnEvent

func (dw *DefaultWatcher) OnEvent(et EventType, entity WatchMarshaller) error

func (*DefaultWatcher) OnUpdate

func (dw *DefaultWatcher) OnUpdate(entity WatchMarshaller) error

type EventType

type EventType string
const (
	EventTypeCreate EventType = "create"
	EventTypeDelete EventType = "remove"
	EventTypeUpdate EventType = "update"
)

type Observer

type Observer interface {
	Update(EventType, []byte) error
	GetId() string
}

type PriorityService

type PriorityService struct {
	api.UnimplementedPrioritiesServer
	// contains filtered or unexported fields
}

func NewPriorityService

func NewPriorityService(app *App) (*PriorityService, cerror.AppError)

func (*PriorityService) CreatePriority

func (p *PriorityService) CreatePriority(ctx context.Context, req *api.CreatePriorityRequest) (*api.Priority, error)

CreatePriority implements api.PrioritiesServer.

func (*PriorityService) DeletePriority

func (p *PriorityService) DeletePriority(ctx context.Context, req *api.DeletePriorityRequest) (*api.Priority, error)

DeletePriority implements api.PrioritiesServer.

func (*PriorityService) ListPriorities

func (p *PriorityService) ListPriorities(ctx context.Context, req *api.ListPriorityRequest) (*api.PriorityList, error)

ListPriorities implements api.PrioritiesServer.

func (*PriorityService) LocatePriority

LocatePriority implements api.PrioritiesServer.

func (*PriorityService) UpdatePriority

func (p *PriorityService) UpdatePriority(ctx context.Context, req *api.UpdatePriorityRequest) (*api.Priority, error)

UpdatePriority implements api.PrioritiesServer.

type RelatedCaseService

type RelatedCaseService struct {
	cases.UnimplementedRelatedCasesServer
	// contains filtered or unexported fields
}

func NewRelatedCaseService

func NewRelatedCaseService(app *App) (*RelatedCaseService, cerror.AppError)

func (*RelatedCaseService) CreateRelatedCase

func (*RelatedCaseService) DeleteRelatedCase

func (*RelatedCaseService) ListRelatedCases

func (*RelatedCaseService) LocateRelatedCase

func (*RelatedCaseService) UpdateRelatedCase

type SLAConditionService

type SLAConditionService struct {
	cases.UnimplementedSLAConditionsServer
	// contains filtered or unexported fields
}

func NewSLAConditionService

func NewSLAConditionService(app *App) (*SLAConditionService, cerror.AppError)

func (*SLAConditionService) CreateSLACondition

CreateSLACondition implements cases.SLAConditionsServer.

func (*SLAConditionService) DeleteSLACondition

DeleteSLACondition implements cases.SLAConditionsServer.

func (*SLAConditionService) ListSLAConditions

ListSLAConditions implements cases.SLAConditionsServer.

func (*SLAConditionService) LocateSLACondition

LocateSLACondition implements cases.SLAConditionsServer.

func (*SLAConditionService) UpdateSLACondition

UpdateSLACondition implements cases.SLAConditionsServer.

type SLAService

type SLAService struct {
	cases.UnimplementedSLAsServer
	// contains filtered or unexported fields
}

func NewSLAService

func NewSLAService(app *App) (*SLAService, cerror.AppError)

func (*SLAService) CreateSLA

func (s *SLAService) CreateSLA(ctx context.Context, req *cases.CreateSLARequest) (*cases.SLA, error)

CreateSLA implements cases.SLAsServer.

func (*SLAService) DeleteSLA

func (s *SLAService) DeleteSLA(ctx context.Context, req *cases.DeleteSLARequest) (*cases.SLA, error)

DeleteSLA implements cases.SLAsServer.

func (*SLAService) ListSLAs

func (s *SLAService) ListSLAs(ctx context.Context, req *cases.ListSLARequest) (*cases.SLAList, error)

ListSLAs implements cases.SLAsServer.

func (*SLAService) LocateSLA

LocateSLA implements cases.SLAsServer.

func (*SLAService) UpdateSLA

func (s *SLAService) UpdateSLA(ctx context.Context, req *cases.UpdateSLARequest) (*cases.SLA, error)

UpdateSLA implements cases.SLAsServer.

type ServiceService

type ServiceService struct {
	api.UnimplementedServicesServer
	// contains filtered or unexported fields
}

func NewServiceService

func NewServiceService(app *App) (*ServiceService, cerror.AppError)

NewServiceService creates a new ServiceService.

func (*ServiceService) CreateService

func (s *ServiceService) CreateService(ctx context.Context, req *api.CreateServiceRequest) (*api.Service, error)

CreateService implements cases.ServicesServer.

func (*ServiceService) DeleteService

func (s *ServiceService) DeleteService(ctx context.Context, req *api.DeleteServiceRequest) (*api.ServiceList, error)

DeleteService implements cases.ServicesServer.

func (*ServiceService) ListServices

func (s *ServiceService) ListServices(ctx context.Context, req *api.ListServiceRequest) (*api.ServiceList, error)

ListServices implements cases.ServicesServer.

func (*ServiceService) LocateService

LocateService implements cases.ServicesServer.

func (*ServiceService) UpdateService

func (s *ServiceService) UpdateService(ctx context.Context, req *api.UpdateServiceRequest) (*api.Service, error)

UpdateService implements cases.ServicesServer.

type SourceService

type SourceService struct {
	_go.UnimplementedSourcesServer
	// contains filtered or unexported fields
}

func NewSourceService

func NewSourceService(app *App) (*SourceService, cerror.AppError)

func (SourceService) CreateSource

func (s SourceService) CreateSource(ctx context.Context, req *_go.CreateSourceRequest) (*_go.Source, error)

func (SourceService) DeleteSource

func (s SourceService) DeleteSource(ctx context.Context, req *_go.DeleteSourceRequest) (*_go.Source, error)

func (SourceService) ListSources

func (s SourceService) ListSources(ctx context.Context, req *_go.ListSourceRequest) (*_go.SourceList, error)

func (SourceService) LocateSource

func (SourceService) UpdateSource

func (s SourceService) UpdateSource(ctx context.Context, req *_go.UpdateSourceRequest) (*_go.Source, error)

type StatusConditionService

type StatusConditionService struct {
	_go.UnimplementedStatusConditionsServer
	// contains filtered or unexported fields
}

func NewStatusConditionService

func NewStatusConditionService(app *App) (*StatusConditionService, cerror.AppError)

func (StatusConditionService) CreateStatusCondition

CreateStatusCondition implements api.StatusConditionsServer.

func (StatusConditionService) DeleteStatusCondition

DeleteStatusCondition implements api.StatusConditionsServer.

func (StatusConditionService) ListStatusConditions

ListStatusConditions implements api.StatusConditionsServer.

func (StatusConditionService) LocateStatusCondition

LocateStatusCondition implements api.StatusConditionsServer.

func (StatusConditionService) UpdateStatusCondition

UpdateStatusCondition implements api.StatusConditionsServer.

type StatusService

type StatusService struct {
	_go.UnimplementedStatusesServer
	// contains filtered or unexported fields
}

func NewStatusService

func NewStatusService(app *App) (*StatusService, cerror.AppError)

func (StatusService) CreateStatus

func (s StatusService) CreateStatus(ctx context.Context, req *_go.CreateStatusRequest) (*_go.Status, error)

CreateStatus implements api.StatusesServer.

func (StatusService) DeleteStatus

func (s StatusService) DeleteStatus(ctx context.Context, req *_go.DeleteStatusRequest) (*_go.Status, error)

DeleteStatus implements api.StatusesServer.

func (StatusService) ListStatuses

func (s StatusService) ListStatuses(ctx context.Context, req *_go.ListStatusRequest) (*_go.StatusList, error)

ListStatuses implements api.StatusesServer.

func (StatusService) LocateStatus

LocateStatus implements api.StatusesServer.

func (StatusService) UpdateStatus

func (s StatusService) UpdateStatus(ctx context.Context, req *_go.UpdateStatusRequest) (*_go.Status, error)

UpdateStatus implements api.StatusesServer.

type WatchMarshaller

type WatchMarshaller interface {
	Marshal() ([]byte, error)
}

type Watcher

type Watcher interface {
	Attach(EventType, Observer)
	Detach(EventType, Observer)
	OnEvent(et EventType, entity WatchMarshaller) error
}

type WatcherData

type WatcherData struct {
	CaseString string `json:"case"`
	DomainId   int64  `json:"domain_id"`
	// contains filtered or unexported fields
}

func NewWatcherData

func NewWatcherData(case_ *cases.Case, domainID int64) *WatcherData

func (*WatcherData) Marshal

func (wd *WatcherData) Marshal() ([]byte, error)

Jump to

Keyboard shortcuts

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