reportschedule

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package reportschedule provides domain models for recurring report generation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateRecipients added in v0.1.7

func ValidateRecipients(recipients []Recipient) error

ValidateRecipients validates a list of recipients.

Types

type Recipient

type Recipient struct {
	Email string `json:"email"`
	Name  string `json:"name"`
}

Recipient represents a report delivery target.

type ReportSchedule

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

ReportSchedule represents a recurring report delivery configuration.

func NewReportSchedule

func NewReportSchedule(tenantID shared.ID, name, reportType, format, cron string) (*ReportSchedule, error)

NewReportSchedule creates a new schedule.

func ReconstituteReportSchedule

func ReconstituteReportSchedule(
	id, tenantID shared.ID,
	name, reportType, format string,
	options map[string]any,
	recipients []Recipient,
	deliveryChannel string,
	integrationID *shared.ID,
	cronExpression, timezone string,
	isActive bool,
	lastRunAt, nextRunAt *time.Time,
	lastStatus string,
	runCount int,
	createdBy *shared.ID,
	createdAt, updatedAt time.Time,
) *ReportSchedule

ReconstituteReportSchedule creates from persisted data.

func (*ReportSchedule) Activate

func (s *ReportSchedule) Activate()

Activate enables the schedule.

func (*ReportSchedule) CreatedAt

func (s *ReportSchedule) CreatedAt() time.Time

func (*ReportSchedule) CreatedBy

func (s *ReportSchedule) CreatedBy() *shared.ID

func (*ReportSchedule) CronExpression

func (s *ReportSchedule) CronExpression() string

func (*ReportSchedule) Deactivate

func (s *ReportSchedule) Deactivate()

Deactivate disables the schedule.

func (*ReportSchedule) DeliveryChannel

func (s *ReportSchedule) DeliveryChannel() string

func (*ReportSchedule) Format

func (s *ReportSchedule) Format() string

func (*ReportSchedule) ID

func (s *ReportSchedule) ID() shared.ID

Getters

func (*ReportSchedule) IntegrationID

func (s *ReportSchedule) IntegrationID() *shared.ID

func (*ReportSchedule) IsActive

func (s *ReportSchedule) IsActive() bool

func (*ReportSchedule) LastRunAt

func (s *ReportSchedule) LastRunAt() *time.Time

func (*ReportSchedule) LastStatus

func (s *ReportSchedule) LastStatus() string

func (*ReportSchedule) Name

func (s *ReportSchedule) Name() string

func (*ReportSchedule) NextRunAt

func (s *ReportSchedule) NextRunAt() *time.Time

func (*ReportSchedule) Options

func (s *ReportSchedule) Options() map[string]any

func (*ReportSchedule) Recipients

func (s *ReportSchedule) Recipients() []Recipient

func (*ReportSchedule) RecordRun

func (s *ReportSchedule) RecordRun(status string, nextRunAt *time.Time)

RecordRun updates after a scheduled run.

func (*ReportSchedule) ReportType

func (s *ReportSchedule) ReportType() string

func (*ReportSchedule) RunCount

func (s *ReportSchedule) RunCount() int

func (*ReportSchedule) SetCreatedBy

func (s *ReportSchedule) SetCreatedBy(userID shared.ID)

SetCreatedBy sets the creator.

func (*ReportSchedule) SetDelivery

func (s *ReportSchedule) SetDelivery(channel string, integrationID *shared.ID)

SetDelivery sets delivery configuration.

func (*ReportSchedule) SetOptions

func (s *ReportSchedule) SetOptions(options map[string]any)

SetOptions sets report generation options.

func (*ReportSchedule) SetRecipients

func (s *ReportSchedule) SetRecipients(recipients []Recipient)

SetRecipients sets delivery recipients.

func (*ReportSchedule) TenantID

func (s *ReportSchedule) TenantID() shared.ID

func (*ReportSchedule) Timezone

func (s *ReportSchedule) Timezone() string

func (*ReportSchedule) Update

func (s *ReportSchedule) Update(name, reportType, format, cron, timezone string)

Update sets mutable fields.

func (*ReportSchedule) UpdatedAt

func (s *ReportSchedule) UpdatedAt() time.Time

type Repository

type Repository interface {
	Create(ctx context.Context, schedule *ReportSchedule) error
	GetByID(ctx context.Context, tenantID, id shared.ID) (*ReportSchedule, error)
	Update(ctx context.Context, schedule *ReportSchedule) error
	Delete(ctx context.Context, tenantID, id shared.ID) error
	List(ctx context.Context, filter ScheduleFilter, page pagination.Pagination) (pagination.Result[*ReportSchedule], error)
	ListDue(ctx context.Context, now time.Time) ([]*ReportSchedule, error)
}

Repository defines persistence for report schedules.

type ScheduleFilter

type ScheduleFilter struct {
	TenantID *shared.ID
	IsActive *bool
}

ScheduleFilter defines criteria for listing schedules.

Jump to

Keyboard shortcuts

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