mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
add APIHost parameter to IC data model #35
This commit is contained in:
parent
1fa7444c66
commit
aea28c712e
6 changed files with 38 additions and 1 deletions
|
@ -120,6 +120,8 @@ type InfrastructureComponent struct {
|
||||||
Name string `json:"name" gorm:"default:''"`
|
Name string `json:"name" gorm:"default:''"`
|
||||||
// Host if the IC
|
// Host if the IC
|
||||||
Host string `json:"host" gorm:"default:''"`
|
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 of IC (simulator, gateway, database, etc.)
|
||||||
Category string `json:"category" gorm:"default:''"`
|
Category string `json:"category" gorm:"default:''"`
|
||||||
// Type of IC (RTDS, VILLASnode, RTDS, etc.)
|
// Type of IC (RTDS, VILLASnode, RTDS, etc.)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||||
// This file was generated by swaggo/swag at
|
// 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
|
package docs
|
||||||
|
|
||||||
|
@ -3058,6 +3058,10 @@ var doc = `{
|
||||||
"database.InfrastructureComponent": {
|
"database.InfrastructureComponent": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"apihost": {
|
||||||
|
"description": "Host of API for IC",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"category": {
|
"category": {
|
||||||
"description": "Category of IC (simulator, gateway, database, etc.)",
|
"description": "Category of IC (simulator, gateway, database, etc.)",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
@ -3452,6 +3456,9 @@ var doc = `{
|
||||||
"UUID"
|
"UUID"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"APIHost": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"Category": {
|
"Category": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
@ -3478,6 +3485,9 @@ var doc = `{
|
||||||
"infrastructure_component.validUpdatedIC": {
|
"infrastructure_component.validUpdatedIC": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"APIHost": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"Category": {
|
"Category": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
|
|
@ -3041,6 +3041,10 @@
|
||||||
"database.InfrastructureComponent": {
|
"database.InfrastructureComponent": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"apihost": {
|
||||||
|
"description": "Host of API for IC",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"category": {
|
"category": {
|
||||||
"description": "Category of IC (simulator, gateway, database, etc.)",
|
"description": "Category of IC (simulator, gateway, database, etc.)",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
@ -3435,6 +3439,9 @@
|
||||||
"UUID"
|
"UUID"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"APIHost": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"Category": {
|
"Category": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
@ -3461,6 +3468,9 @@
|
||||||
"infrastructure_component.validUpdatedIC": {
|
"infrastructure_component.validUpdatedIC": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"APIHost": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"Category": {
|
"Category": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
|
|
@ -142,6 +142,9 @@ definitions:
|
||||||
type: object
|
type: object
|
||||||
database.InfrastructureComponent:
|
database.InfrastructureComponent:
|
||||||
properties:
|
properties:
|
||||||
|
apihost:
|
||||||
|
description: Host of API for IC
|
||||||
|
type: string
|
||||||
category:
|
category:
|
||||||
description: Category of IC (simulator, gateway, database, etc.)
|
description: Category of IC (simulator, gateway, database, etc.)
|
||||||
type: string
|
type: string
|
||||||
|
@ -408,6 +411,8 @@ definitions:
|
||||||
type: object
|
type: object
|
||||||
infrastructure_component.validNewIC:
|
infrastructure_component.validNewIC:
|
||||||
properties:
|
properties:
|
||||||
|
APIHost:
|
||||||
|
type: string
|
||||||
Category:
|
Category:
|
||||||
type: string
|
type: string
|
||||||
Host:
|
Host:
|
||||||
|
@ -431,6 +436,8 @@ definitions:
|
||||||
type: object
|
type: object
|
||||||
infrastructure_component.validUpdatedIC:
|
infrastructure_component.validUpdatedIC:
|
||||||
properties:
|
properties:
|
||||||
|
APIHost:
|
||||||
|
type: string
|
||||||
Category:
|
Category:
|
||||||
type: string
|
type: string
|
||||||
Host:
|
Host:
|
||||||
|
|
|
@ -41,6 +41,7 @@ var router *gin.Engine
|
||||||
type ICRequest struct {
|
type ICRequest struct {
|
||||||
UUID string `json:"uuid,omitempty"`
|
UUID string `json:"uuid,omitempty"`
|
||||||
Host string `json:"host,omitempty"`
|
Host string `json:"host,omitempty"`
|
||||||
|
APIHost string `json:"apihost,omitempty"`
|
||||||
Type string `json:"type,omitempty"`
|
Type string `json:"type,omitempty"`
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
Category string `json:"category,omitempty"`
|
Category string `json:"category,omitempty"`
|
||||||
|
|
|
@ -33,6 +33,7 @@ var validate *validator.Validate
|
||||||
type validNewIC struct {
|
type validNewIC struct {
|
||||||
UUID string `form:"UUID" validate:"required"`
|
UUID string `form:"UUID" validate:"required"`
|
||||||
Host string `form:"Host" validate:"required"`
|
Host string `form:"Host" validate:"required"`
|
||||||
|
APIHost string `form:"APIHost" validate:"omitempty"`
|
||||||
Type string `form:"Type" validate:"required"`
|
Type string `form:"Type" validate:"required"`
|
||||||
Name string `form:"Name" validate:"required"`
|
Name string `form:"Name" validate:"required"`
|
||||||
Category string `form:"Category" validate:"required"`
|
Category string `form:"Category" validate:"required"`
|
||||||
|
@ -43,6 +44,7 @@ type validNewIC struct {
|
||||||
type validUpdatedIC struct {
|
type validUpdatedIC struct {
|
||||||
UUID string `form:"UUID" validate:"omitempty"`
|
UUID string `form:"UUID" validate:"omitempty"`
|
||||||
Host string `form:"Host" validate:"omitempty"`
|
Host string `form:"Host" validate:"omitempty"`
|
||||||
|
APIHost string `form:"APIHost" validate:"omitempty"`
|
||||||
Type string `form:"Type" validate:"omitempty"`
|
Type string `form:"Type" validate:"omitempty"`
|
||||||
Name string `form:"Name" validate:"omitempty"`
|
Name string `form:"Name" validate:"omitempty"`
|
||||||
Category string `form:"Category" validate:"omitempty"`
|
Category string `form:"Category" validate:"omitempty"`
|
||||||
|
@ -75,6 +77,7 @@ func (r *addICRequest) createIC() InfrastructureComponent {
|
||||||
|
|
||||||
s.UUID = r.InfrastructureComponent.UUID
|
s.UUID = r.InfrastructureComponent.UUID
|
||||||
s.Host = r.InfrastructureComponent.Host
|
s.Host = r.InfrastructureComponent.Host
|
||||||
|
s.APIHost = r.InfrastructureComponent.APIHost
|
||||||
s.Type = r.InfrastructureComponent.Type
|
s.Type = r.InfrastructureComponent.Type
|
||||||
s.Name = r.InfrastructureComponent.Name
|
s.Name = r.InfrastructureComponent.Name
|
||||||
s.Category = r.InfrastructureComponent.Category
|
s.Category = r.InfrastructureComponent.Category
|
||||||
|
@ -97,6 +100,10 @@ func (r *updateICRequest) updatedIC(oldIC InfrastructureComponent) Infrastructur
|
||||||
s.Host = r.InfrastructureComponent.Host
|
s.Host = r.InfrastructureComponent.Host
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if r.InfrastructureComponent.APIHost != "" {
|
||||||
|
s.APIHost = r.InfrastructureComponent.APIHost
|
||||||
|
}
|
||||||
|
|
||||||
if r.InfrastructureComponent.Type != "" {
|
if r.InfrastructureComponent.Type != "" {
|
||||||
s.Type = r.InfrastructureComponent.Type
|
s.Type = r.InfrastructureComponent.Type
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue