From 444d2e7f278244d19d50cf4e8ab1fb2c4252760d Mon Sep 17 00:00:00 2001 From: Mathieu Coulet Date: Mon, 9 Dec 2024 14:24:16 +0100 Subject: [PATCH] feat(Models): add ids in System and Event field in models --- server/internal/controllers/about.go | 4 ++++ server/internal/models/about.go | 3 +++ 2 files changed, 7 insertions(+) diff --git a/server/internal/controllers/about.go b/server/internal/controllers/about.go index dd8043c..586fcb2 100644 --- a/server/internal/controllers/about.go +++ b/server/internal/controllers/about.go @@ -32,12 +32,14 @@ func getServiceFromType(serviceType string, service models.Service) models.Servi if serviceType == "action" { actions = append(actions, models.Action{ + Id: event.ID, Name: event.Name, Description: event.Description, Parameters: parameters, }) } else if serviceType == "reaction" { reactions = append(reactions, models.Reaction{ + Id: event.ID, Name: event.Name, Description: event.Description, Parameters: parameters, @@ -46,6 +48,7 @@ func getServiceFromType(serviceType string, service models.Service) models.Servi } return models.ServiceList{ + Id: service.ID, Name: service.Name, Actions: actions, Reaction: reactions, @@ -65,6 +68,7 @@ func getServices() []models.ServiceList { actions := getServiceFromType("action", service) reactions := getServiceFromType("reaction", service) serviceList = append(serviceList, models.ServiceList{ + Id: service.ID, Name: service.Name, Actions: actions.Actions, Reaction: reactions.Reaction, diff --git a/server/internal/models/about.go b/server/internal/models/about.go index f5795fa..93c6e2e 100644 --- a/server/internal/models/about.go +++ b/server/internal/models/about.go @@ -7,18 +7,21 @@ type Parameter struct { } type Action struct { + Id uint `json:"id"` Name string `json:"name"` Description string `json:"description"` Parameters []Parameter `json:"parameters"` } type Reaction struct { + Id uint `json:"id"` Name string `json:"name"` Description string `json:"description"` Parameters []Parameter `json:"parameters"` } type ServiceList struct { + Id uint `json:"id"` Name string `json:"name"` Actions []Action `json:"actions"` Reaction []Reaction `json:"reactions"`