Skip to content

Commit

Permalink
feat(Models): add ids in System and Event field in models
Browse files Browse the repository at this point in the history
  • Loading branch information
Djangss committed Dec 9, 2024
1 parent 3082b1f commit 444d2e7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions server/internal/controllers/about.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions server/internal/models/about.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down

0 comments on commit 444d2e7

Please sign in to comment.