helpdesk

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusOpen           = "open"
	StatusAwaitingUser   = "awaiting_user"
	StatusActionRequired = "action_required"
	StatusClosed         = "closed"
	StatusPending        = "pending"
	StatusResolved       = "resolved"

	SourceCustomer = "customer"
	SourceAgent    = "agent"
	SourceTelegram = "telegram"
	SourceStaff    = "staff"

	AuthorUser     = "user"
	AuthorParty    = "party"
	KindCancel     = "cancel"
	KindReturn     = "return"
	ActionHandled  = "handled"
	ActionDeclined = "declined"
)

Variables

View Source
var (
	ErrNotFound       = errors.New("helpdesk: ticket not found")
	ErrCancelNotFound = errors.New("helpdesk: cancel request not found or already resolved")
	ErrInvalid        = errors.New("helpdesk: invalid input")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	DB          *sql.DB
	PartyColumn string
	RefColumn   string
	Hooks       Hooks
}

type CreateParams

type CreateParams struct {
	PartyID    int64
	Ref        string
	Subject    string
	Body       string
	Source     string
	Status     string
	AuthorKind string
}

type Hooks

type Hooks struct {
	NotifyStaff func(ticketID int64, ref string)
	NotifyParty func(ticketID int64, partyID int64, message, event string) error
	Translate   func(partyID int64, key string) string
	Activity    func(actorID int64, action, target string, meta map[string]any)
}

type Message

type Message struct {
	ID         int64
	TicketID   int64
	AuthorID   int64
	AuthorKind string
	Body       string
	Internal   bool
	CreatedAt  time.Time
}

type NotifyError

type NotifyError struct{ Err error }

func (*NotifyError) Error

func (e *NotifyError) Error() string

func (*NotifyError) Unwrap

func (e *NotifyError) Unwrap() error

type Service

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

func New

func New(c Config) (*Service, error)

func (*Service) CloseByRefs

func (s *Service) CloseByRefs(ctx context.Context, refs []string) error

func (*Service) CountPending

func (s *Service) CountPending(ctx context.Context) (int, error)

func (*Service) Create

func (s *Service) Create(ctx context.Context, p CreateParams) (int64, error)

func (*Service) CreateCancelRequest

func (s *Service) CreateCancelRequest(ctx context.Context, ref string, label string, partyID int64, kind, source, reason, state string) (int64, error)

func (*Service) FirstMessage

func (s *Service) FirstMessage(ctx context.Context, ticketID int64) string

func (*Service) Get

func (s *Service) Get(ctx context.Context, id int64) (*Ticket, error)

func (*Service) List

func (s *Service) List(ctx context.Context, status string, limit, offset int) ([]Ticket, int, error)

func (*Service) PendingCancelRequests

func (s *Service) PendingCancelRequests(ctx context.Context, limit int) ([]Ticket, error)

func (*Service) Reply

func (s *Service) Reply(ctx context.Context, ticketID, authorID int64, authorKind, body string, internal bool) error

func (*Service) ResolveCancelRequest

func (s *Service) ResolveCancelRequest(ctx context.Context, ticketID, resolverID int64, action, note string) error

func (*Service) SetStatus

func (s *Service) SetStatus(ctx context.Context, ticketID int64, status string) error

type Ticket

type Ticket struct {
	ID        int64
	PartyID   int64
	Ref       string
	Subject   string
	Status    string
	Priority  string
	Source    string
	CreatedAt time.Time
	UpdatedAt time.Time
	Messages  []Message
}

Jump to

Keyboard shortcuts

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