Skip to content

Commit

Permalink
fix: remove SyncAllDayEvents field and add filters to the config file
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Huck committed Sep 20, 2023
1 parent 0f56847 commit 42a71d5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
22 changes: 14 additions & 8 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
)

type File struct {
Path string
Auth AuthStorage
Source Source `yaml:"source"`
Sink Sink `yaml:"sink"`
// TODO: filters for source events
Path string
Auth AuthStorage
Source Source `yaml:"source"`
Sink Sink `yaml:"sink"`
Filters []Filter `yaml:"filters,omitempty"`
Transformations []Transformer `yaml:"transformations,omitempty"`
Sync Sync `yaml:"sync"`
UpdateConcurrency int `yaml:"updateConcurrency,omitempty"`
Expand Down Expand Up @@ -77,11 +77,17 @@ type Transformer struct {
Config CustomMap `yaml:"config"`
}

type Filter struct {
// Name of the filter
Name string `yaml:"name"`
// Any kind of parameter which can be passed to a filter.
Config CustomMap `yaml:"config"`
}

// Sync configuration
type Sync struct {
StartTime SyncTime `yaml:"start"`
EndTime SyncTime `yaml:"end"`
SyncDeclinedEvents bool `yaml:"sync_declined_events"`
StartTime SyncTime `yaml:"start"`
EndTime SyncTime `yaml:"end"`
}

type SyncTime struct {
Expand Down
14 changes: 7 additions & 7 deletions internal/sync/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ type Controller struct {
}

// NewController constructs a new Controller.
func NewController(logger *log.Logger, source Source, sink Sink, SyncDeclinedEvents bool, transformer ...Transformer) Controller {
func NewController(logger *log.Logger, source Source, sink Sink, transformer []Transformer, filters []Filter) Controller {
return Controller{
concurrency: 1,
source: source,
transformers: transformer,
sink: sink,
logger: logger,
SyncDeclinedEvents: SyncDeclinedEvents,
concurrency: 1,
source: source,
transformers: transformer,
filters: filters,
sink: sink,
logger: logger,
}
}

Expand Down

0 comments on commit 42a71d5

Please sign in to comment.