-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Started adding API endpoints, worked on race condition issues
- Loading branch information
1 parent
d79a555
commit f1b6c88
Showing
7 changed files
with
136 additions
and
33 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
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
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 @@ | ||
package api |
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 @@ | ||
package api |
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,31 @@ | ||
package controllerservice | ||
|
||
import ( | ||
"context" | ||
"log/slog" | ||
"sprinkler-controller-service/internal/config" | ||
) | ||
|
||
type IApiHandler interface { | ||
SendSprinklerEventRequest(event *config.ScheduleItem) error | ||
} | ||
|
||
type ApiHandler struct { | ||
Ctx context.Context | ||
Logger *slog.Logger | ||
ApiUrl string | ||
} | ||
|
||
func NewApiHandler(ctx context.Context, logger *slog.Logger, apiUrl string) IApiHandler { | ||
return &ApiHandler{ | ||
Ctx: ctx, | ||
Logger: logger, | ||
ApiUrl: apiUrl, | ||
} | ||
} | ||
|
||
func (a *ApiHandler) SendSprinklerEventRequest(event *config.ScheduleItem) error { | ||
a.Logger.Info("Sending event to API", "event", event) | ||
|
||
return nil | ||
} |
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
2 changes: 1 addition & 1 deletion
2
controller/internal/api/dryrun.go → ...ller/internal/controllerservice/dryrun.go
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package api | ||
package controllerservice | ||
|
||
import ( | ||
"context" | ||
|