app

package
v0.0.0-...-e2086a9 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 52 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnonymousName = "Anonymous"
)

Variables

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: true},
		{Name: "updated_at", Default: true},
		{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_reason", Default: true},
		{Name: "close_result", Default: true},
		{Name: "rating", Default: true},
		{Name: "rating_comment", 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: "resolved_at", Default: true},
		{Name: "reacted_at", Default: true},
		{Name: "difference_in_reaction", Default: true},
		{Name: "difference_in_resolve", Default: true},
		{Name: "contact_info", Default: true},
		{Name: "role_ids", Default: false},
		{Name: "dc", Default: false},
		{Name: "diff", Default: true},
	}, grpc.CaseCommentMetadata, grpc.CaseLinkMetadata, RelatedCaseMetadata)
)
View Source
var CatalogMetadata = model.NewObjectMetadata(model.ScopeDictionary, "", []*model.Field{
	{Name: "id", Default: true},
	{Name: "root_id", Default: true},
	{Name: "name", Default: true},
	{Name: "description", Default: true},
	{Name: "prefix", Default: true},
	{Name: "code", Default: true},
	{Name: "state", Default: true},
	{Name: "sla", Default: true},
	{Name: "status", Default: true},
	{Name: "close_reason_group", Default: true},
	{Name: "default_priority", Default: true},
	{Name: "teams", Default: true},
	{Name: "skills", Default: true},
	{Name: "created_at", Default: true},
	{Name: "created_by", Default: true},
	{Name: "updated_at", Default: false},
	{Name: "updated_by", Default: false},
	{Name: "services", Default: 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 BuildCaseDiff

func BuildCaseDiff(original, updated *cases.Case) []*cases.FieldChange

func BuildDatabase

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

func RegisterServices

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

RegisterServices initializes and registers all necessary gRPC services.

func StartBroker

func StartBroker(config *conf.AppConfig) (*rabbit.Connection, error)

Types

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 (a *App) CreateCaseLink(creator options.Creator, input *model.CaseLink) (*model.CaseLink, error)

func (*App) CreateCloseReason

func (s *App) CreateCloseReason(
	creator options.Creator,
	input *model.CloseReason,
) (*model.CloseReason, error)

CreateCloseReason creates a new close reason in the store.

func (*App) CreateCloseReasonGroup

func (s *App) CreateCloseReasonGroup(
	rpc options.Creator,
	input *model.CloseReasonGroup,
) (*model.CloseReasonGroup, error)

func (*App) CreatePriority

func (s *App) CreatePriority(
	creator options.Creator,
	input *model.Priority,
) (*model.Priority, error)

CreatePriority creates a new priority in the store.

func (*App) CreateSLA

func (s *App) CreateSLA(
	creator options.Creator,
	input *model.SLA,
) (*model.SLA, error)

CreateSLA implements cases.SLAsServer.

func (*App) CreateSLACondition

func (s *App) CreateSLACondition(opts options.Creator, req *model.SLACondition) (*model.SLACondition, error)

CreateSLACondition implements cases.SLAConditionsServer.

func (*App) CreateService

func (s *App) CreateService(opts options.Creator, item *model.Service) (*model.Service, error)

CreateService implements cases.ServicesServer.

func (*App) CreateSource

func (s *App) CreateSource(
	opts options.Creator,
	input *model.Source,
) (*model.Source, error)

CreateSource implements api.SourcesServer.

func (*App) CreateStatus

func (s *App) CreateStatus(opts options.Creator, req *model.Status) (*model.Status, error)

CreateStatus implements api.StatusesServer.

func (*App) CreateStatusCondition

func (s *App) CreateStatusCondition(opts options.Creator, req *model.StatusCondition) (*model.StatusCondition, error)

CreateStatusCondition implements api.StatusConditionsServer.

func (*App) DeleteCaseComment

func (s *App) DeleteCaseComment(deleter options.Deleter) (*model.CaseComment, error)

DeleteCaseComment deletes a case comment from the store.

func (*App) DeleteCaseFile

func (a *App) DeleteCaseFile(rpc options.Deleter) (*model.CaseFile, error)
func (a *App) DeleteCaseLink(deleter options.Deleter) (*model.CaseLink, error)

func (*App) DeleteCloseReason

func (s *App) DeleteCloseReason(
	deleter options.Deleter,
) (*model.CloseReason, error)

DeleteCloseReason deletes a close reason from the store.

func (*App) DeleteCloseReasonGroup

func (s *App) DeleteCloseReasonGroup(
	rpc options.Deleter,
) (*model.CloseReasonGroup, error)

func (*App) DeletePriority

func (s *App) DeletePriority(
	deleter options.Deleter,
) (*model.Priority, error)

DeletePriority deletes a priority from the store.

func (*App) DeleteSLA

func (s *App) DeleteSLA(
	deleter options.Deleter,
) (*model.SLA, error)

DeleteSLA implements cases.SLAsServer.

func (*App) DeleteSLACondition

func (s *App) DeleteSLACondition(opts options.Deleter) (*model.SLACondition, error)

DeleteSLACondition implements cases.SLAConditionsServer.

func (*App) DeleteService

func (s *App) DeleteService(opts options.Deleter) (*model.Service, error)

DeleteService implements cases.ServicesServer.

func (*App) DeleteSource

func (s *App) DeleteSource(
	opts options.Deleter,
) (*model.Source, error)

DeleteSource implements api.SourcesServer.

func (*App) DeleteStatus

func (s *App) DeleteStatus(opts options.Deleter) (*model.Status, error)

DeleteStatus implements api.StatusesServer.

func (*App) DeleteStatusCondition

func (s *App) DeleteStatusCondition(opts options.Deleter) (*model.StatusCondition, error)

DeleteStatusCondition implements api.StatusConditionsServer.

func (*App) GetTimeline

func (s *App) GetTimeline(searcher options.Searcher) (*model.CaseTimeline, error)

GetTimeline retrieves the timeline for a case

func (*App) GetTimelineCounter

func (s *App) GetTimelineCounter(searcher options.Searcher) (*model.TimelineCounterResponse, error)

GetTimelineCounter retrieves the counter for a case timeline

func (*App) LinkCommunication

func (c *App) LinkCommunication(createOpts options.Creator, input []*model.CaseCommunication) ([]*model.CaseCommunication, error)

func (*App) ListCaseComments

func (s *App) ListCaseComments(searcher options.Searcher) ([]*model.CaseComment, error)

ListCaseComments lists case comments with filters and pagination.

func (*App) ListCaseFiles

func (a *App) ListCaseFiles(rpc options.Searcher) ([]*model.CaseFile, error)
func (a *App) ListCaseLinks(searcher options.Searcher) ([]*model.CaseLink, error)

func (*App) ListCloseReasonGroup

func (s *App) ListCloseReasonGroup(
	rpc options.Searcher,
) ([]*model.CloseReasonGroup, error)

func (*App) ListCloseReasons

func (s *App) ListCloseReasons(
	searcher options.Searcher,
	closeReasonGroupId int64,
) ([]*model.CloseReason, error)

ListCloseReasons lists close reasons for a group.

func (*App) ListCommunications

func (c *App) ListCommunications(searcher options.Searcher) ([]*model.CaseCommunication, error)

func (*App) ListPriorities

func (s *App) ListPriorities(
	searcher options.Searcher,
	notInSla int64,
	inSla int64,
) ([]*model.Priority, error)

ListPriorities lists priorities with optional SLA filters.

func (*App) ListSLAConditions

func (s *App) ListSLAConditions(opts options.Searcher) ([]*model.SLACondition, error)

ListSLAConditions implements cases.SLAConditionsServer.

func (*App) ListSLAs

func (s *App) ListSLAs(
	searcher options.Searcher,
) ([]*model.SLA, error)

ListSLAs implements cases.SLAsServer.

func (*App) ListServices

func (s *App) ListServices(opts options.Searcher) ([]*model.Service, error)

ListServices implements cases.ServicesServer.

func (*App) ListSources

func (s *App) ListSources(
	opts options.Searcher,
) ([]*model.Source, error)

ListSources implements api.SourcesServer.

func (*App) ListStatus

func (s *App) ListStatus(opts options.Searcher) ([]*model.Status, error)

ListStatuses implements api.StatusesServer.

func (*App) ListStatusConditions

func (s *App) ListStatusConditions(opts options.Searcher) ([]*model.StatusCondition, error)

ListStatusConditions implements api.StatusConditionsServer.

func (*App) LocateSLA

func (s *App) LocateSLA(
	searcher options.Searcher,
) (*model.SLA, error)

LocateSLA implements cases.SLAsServer.

func (*App) LocateStatusCondition

func (s *App) LocateStatusCondition(opts options.Searcher) (*model.StatusCondition, error)

LocateStatusCondition implements api.StatusConditionsServer.

func (*App) PublishCaseComment

func (s *App) PublishCaseComment(creator options.Creator, input *model.CaseComment) (*model.CaseComment, error)

PublishCaseComment creates a new case comment.

func (*App) Start

func (a *App) Start() error

func (*App) Stop

func (a *App) Stop() error

func (*App) UnlinkCommunication

func (c *App) UnlinkCommunication(deleteOpts options.Deleter) (int64, error)

func (*App) UpdateCaseComment

func (s *App) UpdateCaseComment(updator options.Updator, input *model.CaseComment) (*model.CaseComment, error)

UpdateCaseComment updates a case comment in the store.

func (a *App) UpdateCaseLink(updator options.Updator, input *model.CaseLink) (*model.CaseLink, error)

func (*App) UpdateCloseReason

func (s *App) UpdateCloseReason(
	updator options.Updator,
	input *model.CloseReason,
) (*model.CloseReason, error)

UpdateCloseReason updates a close reason in the store.

func (*App) UpdateCloseReasonGroup

func (s *App) UpdateCloseReasonGroup(
	rpc options.Updator,
	input *model.CloseReasonGroup,
) (*model.CloseReasonGroup, error)

func (*App) UpdatePriority

func (s *App) UpdatePriority(
	updator options.Updator,
	input *model.Priority,
) (*model.Priority, error)

UpdatePriority updates a priority in the store.

func (*App) UpdateSLA

func (s *App) UpdateSLA(
	updator options.Updator,
	input *model.SLA,
) (*model.SLA, error)

UpdateSLA implements cases.SLAsServer.

func (*App) UpdateSLACondition

func (s *App) UpdateSLACondition(opts options.Updator, req *model.SLACondition) (*model.SLACondition, error)

UpdateSLACondition implements cases.SLAConditionsServer.

func (*App) UpdateService

func (s *App) UpdateService(opts options.Updator, req *model.Service) (*model.Service, error)

UpdateService implements cases.ServicesServer.

func (*App) UpdateSource

func (s *App) UpdateSource(
	opts options.Updator,
	req *model.Source,
) (*model.Source, error)

UpdateSource implements api.SourcesServer.

func (*App) UpdateStatus

func (s *App) UpdateStatus(opts options.Updator, input *model.Status) (*model.Status, error)

UpdateStatus implements api.StatusesServer.

func (*App) UpdateStatusCondition

func (s *App) UpdateStatusCondition(opts options.Updator, input *model.StatusCondition) (*model.StatusCondition, error)

UpdateStatusCondition implements api.StatusConditionsServer.

type CaseCommentWatcherData

type CaseCommentWatcherData struct {
	Args map[string]any
	// contains filtered or unexported fields
}

func NewCaseCommentWatcherData

func NewCaseCommentWatcherData(session auth.Auther, comment *model.CaseComment, id, caseId int64, roleIds []int64) *CaseCommentWatcherData

func (*CaseCommentWatcherData) GetArgs

func (wd *CaseCommentWatcherData) GetArgs() map[string]any

func (*CaseCommentWatcherData) Marshal

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

type CaseFileWatcherData

type CaseFileWatcherData struct {
	Args map[string]any
	// contains filtered or unexported fields
}

func NewCaseFileWatcherData

func NewCaseFileWatcherData(session auth.Auther, caseFile *model.CaseFile, id, roleIds []int64) *CaseFileWatcherData

func (*CaseFileWatcherData) GetArgs

func (wd *CaseFileWatcherData) GetArgs() map[string]any

func (*CaseFileWatcherData) Marshal

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

type CaseLinkWatcherData

type CaseLinkWatcherData struct {
	Args map[string]any
	// contains filtered or unexported fields
}

func NewLinkWatcherData

func NewLinkWatcherData(session auth.Auther, link *model.CaseLink, linkId int64, dc int64) *CaseLinkWatcherData

func (*CaseLinkWatcherData) GetArgs

func (wd *CaseLinkWatcherData) GetArgs() map[string]any

type CaseService

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

func NewCaseService

func NewCaseService(app *App) (*CaseService, error)

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) ExportCases

ExportCases exports cases in the specified format (CSV or XLSX) using server-side streaming

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 shared.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 shared.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 (*CaseService) ValidateCreateInput

func (c *CaseService) ValidateCreateInput(ctx context.Context, input *cases.InputCreateCase) error

func (*CaseService) ValidateUpdateInput

func (c *CaseService) ValidateUpdateInput(
	ctx context.Context,
	input *cases.InputCase,
	xJsonMask []string,
) error

type CaseWatcherData

type CaseWatcherData struct {
	Args map[string]any
	// contains filtered or unexported fields
}

func NewCaseWatcherData

func NewCaseWatcherData(session auth.Auther, case_ *cases.Case, caseId int64, roleIds []int64) *CaseWatcherData

func (*CaseWatcherData) GetArgs

func (wd *CaseWatcherData) GetArgs() map[string]any

type CatalogService

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

func NewCatalogService

func NewCatalogService(app *App) (*CatalogService, error)

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 FullTextSearchObserver

type FullTextSearchObserver[T any, V any] struct {
	// contains filtered or unexported fields
}

func NewFullTextSearchObserver

func NewFullTextSearchObserver[T any, V any](client *fts_client.Client, objclass string, converter func(T, map[string]any) (V, error)) (*FullTextSearchObserver[T, V], error)

func (*FullTextSearchObserver[T, V]) GetId

func (l *FullTextSearchObserver[T, V]) GetId() string

func (*FullTextSearchObserver[T, V]) Update

func (l *FullTextSearchObserver[T, V]) Update(et watcher.EventType, args map[string]any) error

type LoggerObserver

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

func NewLoggerObserver

func NewLoggerObserver(logger *wlogger.Logger, objclass string, timeout time.Duration) (*LoggerObserver, error)

func (*LoggerObserver) GetId

func (l *LoggerObserver) GetId() string

func (*LoggerObserver) Update

func (l *LoggerObserver) Update(et watcher.EventType, args map[string]any) error

type Publisher

type Publisher interface {
	Publish(ctx context.Context, exchange string, routingKey string, body []byte, headers amqp091.Table) error
}

type RelatedCaseService

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

func NewRelatedCaseService

func NewRelatedCaseService(app *App) (*RelatedCaseService, error)

func (*RelatedCaseService) CreateRelatedCase

func (*RelatedCaseService) DeleteRelatedCase

func (*RelatedCaseService) ListRelatedCases

func (*RelatedCaseService) LocateRelatedCase

func (*RelatedCaseService) UpdateRelatedCase

type RelatedCaseWatcherData

type RelatedCaseWatcherData struct {
	Args map[string]any
	// contains filtered or unexported fields
}

func NewRelatedCaseWatcherData

func NewRelatedCaseWatcherData(session auth.Auther, relCase *cases.RelatedCase, relCaseID int64, dc int64) *RelatedCaseWatcherData

func (*RelatedCaseWatcherData) GetArgs

func (wd *RelatedCaseWatcherData) GetArgs() map[string]any

type TimerTask

type TimerTask[T any] struct {
	// contains filtered or unexported fields
}

func NewTimerTask

func NewTimerTask[T any](interval time.Duration, task func(T), arg T) *TimerTask[T]

func (*TimerTask[T]) Start

func (gt *TimerTask[T]) Start()

func (*TimerTask[T]) Stop

func (gt *TimerTask[T]) Stop()

type TriggerObserver

type TriggerObserver[T any, V any] struct {
	// contains filtered or unexported fields
}

func NewTriggerObserver

func NewTriggerObserver[T any, V any](amqpBroker Publisher, config *cfg.TriggerWatcherConfig, conv func(T) (V, error), log *slog.Logger) (*TriggerObserver[T, V], error)

func (*TriggerObserver[T, V]) GetId

func (cao *TriggerObserver[T, V]) GetId() string

func (*TriggerObserver[T, V]) Update

func (cao *TriggerObserver[T, V]) Update(et watcher.EventType, args map[string]any) error

Jump to

Keyboard shortcuts

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