Commit aea28c71 authored by Sonja Happ's avatar Sonja Happ
Browse files

add APIHost parameter to IC data model #35

parent 1fa7444c
......@@ -120,6 +120,8 @@ type InfrastructureComponent struct {
Name string `json:"name" gorm:"default:''"`
// Host if the IC
Host string `json:"host" gorm:"default:''"`
// Host of API for IC
APIHost string `json:"apihost" gorm:"default:''"`
// Category of IC (simulator, gateway, database, etc.)
Category string `json:"category" gorm:"default:''"`
// Type of IC (RTDS, VILLASnode, RTDS, etc.)
......
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at
// 2020-06-26 09:42:08.437454207 +0200 CEST m=+0.080918529
// 2020-06-26 09:52:23.901926224 +0200 CEST m=+0.077245770
package docs
......@@ -3058,6 +3058,10 @@ var doc = `{
"database.InfrastructureComponent": {
"type": "object",
"properties": {
"apihost": {
"description": "Host of API for IC",
"type": "string"
},
"category": {
"description": "Category of IC (simulator, gateway, database, etc.)",
"type": "string"
......@@ -3452,6 +3456,9 @@ var doc = `{
"UUID"
],
"properties": {
"APIHost": {
"type": "string"
},
"Category": {
"type": "string"
},
......@@ -3478,6 +3485,9 @@ var doc = `{
"infrastructure_component.validUpdatedIC": {
"type": "object",
"properties": {
"APIHost": {
"type": "string"
},
"Category": {
"type": "string"
},
......
......@@ -3041,6 +3041,10 @@
"database.InfrastructureComponent": {
"type": "object",
"properties": {
"apihost": {
"description": "Host of API for IC",
"type": "string"
},
"category": {
"description": "Category of IC (simulator, gateway, database, etc.)",
"type": "string"
......@@ -3435,6 +3439,9 @@
"UUID"
],
"properties": {
"APIHost": {
"type": "string"
},
"Category": {
"type": "string"
},
......@@ -3461,6 +3468,9 @@
"infrastructure_component.validUpdatedIC": {
"type": "object",
"properties": {
"APIHost": {
"type": "string"
},
"Category": {
"type": "string"
},
......
......@@ -142,6 +142,9 @@ definitions:
type: object
database.InfrastructureComponent:
properties:
apihost:
description: Host of API for IC
type: string
category:
description: Category of IC (simulator, gateway, database, etc.)
type: string
......@@ -408,6 +411,8 @@ definitions:
type: object
infrastructure_component.validNewIC:
properties:
APIHost:
type: string
Category:
type: string
Host:
......@@ -431,6 +436,8 @@ definitions:
type: object
infrastructure_component.validUpdatedIC:
properties:
APIHost:
type: string
Category:
type: string
Host:
......
......@@ -41,6 +41,7 @@ var router *gin.Engine
type ICRequest struct {
UUID string `json:"uuid,omitempty"`
Host string `json:"host,omitempty"`
APIHost string `json:"apihost,omitempty"`
Type string `json:"type,omitempty"`
Name string `json:"name,omitempty"`
Category string `json:"category,omitempty"`
......
......@@ -33,6 +33,7 @@ var validate *validator.Validate
type validNewIC struct {
UUID string `form:"UUID" validate:"required"`
Host string `form:"Host" validate:"required"`
APIHost string `form:"APIHost" validate:"omitempty"`
Type string `form:"Type" validate:"required"`
Name string `form:"Name" validate:"required"`
Category string `form:"Category" validate:"required"`
......@@ -43,6 +44,7 @@ type validNewIC struct {
type validUpdatedIC struct {
UUID string `form:"UUID" validate:"omitempty"`
Host string `form:"Host" validate:"omitempty"`
APIHost string `form:"APIHost" validate:"omitempty"`
Type string `form:"Type" validate:"omitempty"`
Name string `form:"Name" validate:"omitempty"`
Category string `form:"Category" validate:"omitempty"`
......@@ -75,6 +77,7 @@ func (r *addICRequest) createIC() InfrastructureComponent {
s.UUID = r.InfrastructureComponent.UUID
s.Host = r.InfrastructureComponent.Host
s.APIHost = r.InfrastructureComponent.APIHost
s.Type = r.InfrastructureComponent.Type
s.Name = r.InfrastructureComponent.Name
s.Category = r.InfrastructureComponent.Category
......@@ -97,6 +100,10 @@ func (r *updateICRequest) updatedIC(oldIC InfrastructureComponent) Infrastructur
s.Host = r.InfrastructureComponent.Host
}
if r.InfrastructureComponent.APIHost != "" {
s.APIHost = r.InfrastructureComponent.APIHost
}
if r.InfrastructureComponent.Type != "" {
s.Type = r.InfrastructureComponent.Type
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment