Documentation
¶
Overview ¶
Package ticketattributerelations provides management of ticket attribute relationships. These relationships allow filtering of attribute options based on other attribute values.
Index ¶
- type Option
- type Service
- func (s *Service) ClearCache()
- func (s *Service) Create(ctx context.Context, relation *models.TicketAttributeRelation, userID int64) (int64, error)
- func (s *Service) Delete(ctx context.Context, id int64) error
- func (s *Service) EvaluateRelations(ctx context.Context, attr1 string, attr1Value string) (map[string][]string, error)
- func (s *Service) FilenameExists(ctx context.Context, filename string) (bool, error)
- func (s *Service) GetAll(ctx context.Context) ([]*models.TicketAttributeRelation, error)
- func (s *Service) GetByFilename(ctx context.Context, filename string) (*models.TicketAttributeRelation, error)
- func (s *Service) GetByID(ctx context.Context, id int64) (*models.TicketAttributeRelation, error)
- func (s *Service) GetNextPriority(ctx context.Context) (int64, error)
- func (s *Service) GetPriorityOptions(ctx context.Context) ([]int64, error)
- func (s *Service) GetRawDataForDownload(relation *models.TicketAttributeRelation) ([]byte, error)
- func (s *Service) ParseUploadedFile(filename string, data []byte) (attr1, attr2 string, pairs []models.AttributeRelationPair, err error)
- func (s *Service) PrepareDataForStorage(filename string, data []byte) string
- func (s *Service) RefreshCache(ctx context.Context) error
- func (s *Service) ReorderPriorities(ctx context.Context, orderedIDs []int64, userID int64) error
- func (s *Service) Update(ctx context.Context, id int64, updates map[string]interface{}, userID int64) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service manages ticket attribute relations.
func NewService ¶
NewService creates a new ticket attribute relations service.
func (*Service) Create ¶
func (s *Service) Create(ctx context.Context, relation *models.TicketAttributeRelation, userID int64) (int64, error)
Create creates a new ticket attribute relation.
func (*Service) EvaluateRelations ¶
func (s *Service) EvaluateRelations(ctx context.Context, attr1 string, attr1Value string) (map[string][]string, error)
EvaluateRelations returns allowed values for Attribute2 based on current Attribute1 value. This is used for filtering ticket form options.
func (*Service) FilenameExists ¶
FilenameExists checks if a filename is already in use.
func (*Service) GetByFilename ¶
func (s *Service) GetByFilename(ctx context.Context, filename string) (*models.TicketAttributeRelation, error)
GetByFilename returns a ticket attribute relation by filename.
func (*Service) GetNextPriority ¶
GetNextPriority returns the next available priority value.
func (*Service) GetPriorityOptions ¶
GetPriorityOptions returns priority options for the dropdown.
func (*Service) GetRawDataForDownload ¶
func (s *Service) GetRawDataForDownload(relation *models.TicketAttributeRelation) ([]byte, error)
GetRawDataForDownload returns the raw file data for download.
func (*Service) ParseUploadedFile ¶
func (s *Service) ParseUploadedFile(filename string, data []byte) (attr1, attr2 string, pairs []models.AttributeRelationPair, err error)
ParseUploadedFile parses an uploaded CSV or Excel file and returns the relation data.
func (*Service) PrepareDataForStorage ¶
PrepareDataForStorage prepares file data for database storage. CSV files are stored as-is, Excel files are base64 encoded.
func (*Service) RefreshCache ¶
RefreshCache reloads all relations from the database.
func (*Service) ReorderPriorities ¶
ReorderPriorities updates priorities based on a new ordering of relation IDs. The orderedIDs slice contains relation IDs in the desired priority order (first = priority 1).