summaryrefslogtreecommitdiffstats
path: root/cmd/web
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/web')
-rw-r--r--cmd/web/handlers.go13
-rw-r--r--cmd/web/main.go14
2 files changed, 20 insertions, 7 deletions
diff --git a/cmd/web/handlers.go b/cmd/web/handlers.go
index e27b39b..0a7be55 100644
--- a/cmd/web/handlers.go
+++ b/cmd/web/handlers.go
@@ -13,11 +13,22 @@ import (
func (app *application) listOperations(w http.ResponseWriter, r *http.Request) {
ops, err := app.operations.ListAll()
-
if err != nil {
app.serverError(w, r, err)
return
}
+
+ var esses []models.EngagementStrategy
+
+ for _, op := range ops {
+ es, err := app.engagement_strategies.GetForOperation(op.ID)
+ // TODO: Check what kind of error this is, don't just continue
+ if err != nil {
+ continue
+ }
+ esses = append(esses, es)
+ }
+
files := []string{
"./ui/html/base.tmpl.html",
"./ui/html/pages/operations/list.tmpl.html",
diff --git a/cmd/web/main.go b/cmd/web/main.go
index a8b8cb4..7e25124 100644
--- a/cmd/web/main.go
+++ b/cmd/web/main.go
@@ -12,9 +12,10 @@ import (
)
type application struct {
- logger *slog.Logger
- operations *models.OperationModel
- organisations *models.OrganisationModel
+ logger *slog.Logger
+ operations *models.OperationModel
+ organisations *models.OrganisationModel
+ engagement_strategies *models.EngagementStrategyModel
}
func main() {
@@ -34,9 +35,10 @@ func main() {
defer db.Close()
app := &application{
- logger: logger,
- operations: &models.OperationModel{DB: db},
- organisations: &models.OrganisationModel{DB: db},
+ logger: logger,
+ operations: &models.OperationModel{DB: db},
+ organisations: &models.OrganisationModel{DB: db},
+ engagement_strategies: &models.EngagementStrategyModel{DB: db},
}
// mux := http.NewServeMux()