-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add filters "AllDayEvents" and "DeclinedEvents"
- Loading branch information
Alexander Huck
committed
Sep 20, 2023
1 parent
ab8b72c
commit ca5c521
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package filter | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/inovex/CalendarSync/internal/models" | ||
) | ||
|
||
type AllDayEvents struct { | ||
} | ||
|
||
func (a AllDayEvents) Name() string { | ||
return "AllDayEvents" | ||
} | ||
|
||
func (a AllDayEvents) Filter(events []models.Event) (filteredEvents []models.Event) { | ||
for _, event := range events { | ||
if !event.AllDay { | ||
filteredEvents = append(filteredEvents, event) | ||
} else { | ||
fmt.Println("Filtered!") | ||
} | ||
} | ||
return filteredEvents | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package filter | ||
|
||
import ( | ||
"github.com/inovex/CalendarSync/internal/models" | ||
) | ||
|
||
type DeclinedEvents struct{} | ||
|
||
func (d DeclinedEvents) Name() string { | ||
return "DeclinedEvents" | ||
} | ||
|
||
func (d DeclinedEvents) Filter(events []models.Event) (filteredEvents []models.Event) { | ||
for _, event := range events { | ||
if event.Accepted { | ||
filteredEvents = append(filteredEvents, event) | ||
} | ||
} | ||
return filteredEvents | ||
} |