Add json mapping for ID in client & app
This commit is contained in:
parent
c76dffdd61
commit
9d635b15a6
|
|
@ -113,7 +113,7 @@ func (s *TokenSuite) Test_CreateApplication_returnsApplicationWithID() {
|
||||||
assert.Equal(s.T(), 200, s.recorder.Code)
|
assert.Equal(s.T(), 200, s.recorder.Code)
|
||||||
bytes, _ := ioutil.ReadAll(s.recorder.Body)
|
bytes, _ := ioutil.ReadAll(s.recorder.Body)
|
||||||
|
|
||||||
assert.Equal(s.T(), `{"ID":"APorrUa5b1IIK3y","name":"custom_name","description":""}`, string(bytes))
|
assert.Equal(s.T(), `{"id":"APorrUa5b1IIK3y","name":"custom_name","description":""}`, string(bytes))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *TokenSuite) Test_CreateApplication_withExistingToken() {
|
func (s *TokenSuite) Test_CreateApplication_withExistingToken() {
|
||||||
|
|
@ -145,7 +145,7 @@ func (s *TokenSuite) Test_GetApplications() {
|
||||||
assert.Equal(s.T(), 200, s.recorder.Code)
|
assert.Equal(s.T(), 200, s.recorder.Code)
|
||||||
bytes, _ := ioutil.ReadAll(s.recorder.Body)
|
bytes, _ := ioutil.ReadAll(s.recorder.Body)
|
||||||
|
|
||||||
assert.Equal(s.T(), `[{"ID":"perfper","name":"first","description":"desc"},{"ID":"asdasd","name":"second","description":"desc2"}]`, string(bytes))
|
assert.Equal(s.T(), `[{"id":"perfper","name":"first","description":"desc"},{"id":"asdasd","name":"second","description":"desc2"}]`, string(bytes))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *TokenSuite) Test_DeleteApplication_expectNotFound() {
|
func (s *TokenSuite) Test_DeleteApplication_expectNotFound() {
|
||||||
|
|
@ -228,7 +228,7 @@ func (s *TokenSuite) Test_CreateClient_returnsClientWithID() {
|
||||||
assert.Equal(s.T(), 200, s.recorder.Code)
|
assert.Equal(s.T(), 200, s.recorder.Code)
|
||||||
bytes, _ := ioutil.ReadAll(s.recorder.Body)
|
bytes, _ := ioutil.ReadAll(s.recorder.Body)
|
||||||
|
|
||||||
assert.Equal(s.T(), `{"ID":"CPorrUa5b1IIK3y","name":"custom_name"}`, string(bytes))
|
assert.Equal(s.T(), `{"id":"CPorrUa5b1IIK3y","name":"custom_name"}`, string(bytes))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *TokenSuite) Test_CreateClient_withExistingToken() {
|
func (s *TokenSuite) Test_CreateClient_withExistingToken() {
|
||||||
|
|
@ -260,7 +260,7 @@ func (s *TokenSuite) Test_GetClients() {
|
||||||
assert.Equal(s.T(), 200, s.recorder.Code)
|
assert.Equal(s.T(), 200, s.recorder.Code)
|
||||||
bytes, _ := ioutil.ReadAll(s.recorder.Body)
|
bytes, _ := ioutil.ReadAll(s.recorder.Body)
|
||||||
|
|
||||||
assert.Equal(s.T(), `[{"ID":"perfper","name":"first"},{"ID":"asdasd","name":"second"}]`, string(bytes))
|
assert.Equal(s.T(), `[{"id":"perfper","name":"first"},{"id":"asdasd","name":"second"}]`, string(bytes))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *TokenSuite) Test_DeleteClient_expectNotFound() {
|
func (s *TokenSuite) Test_DeleteClient_expectNotFound() {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1032,13 +1032,14 @@
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"title": "Application Model",
|
"title": "Application Model",
|
||||||
"properties": {
|
"properties": {
|
||||||
"ID": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"description": {
|
"description": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"x-go-name": "Description"
|
"x-go-name": "Description"
|
||||||
},
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "string",
|
||||||
|
"x-go-name": "ID"
|
||||||
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"x-go-name": "Name"
|
"x-go-name": "Name"
|
||||||
|
|
@ -1051,8 +1052,9 @@
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"title": "Client Model",
|
"title": "Client Model",
|
||||||
"properties": {
|
"properties": {
|
||||||
"ID": {
|
"id": {
|
||||||
"type": "string"
|
"type": "string",
|
||||||
|
"x-go-name": "ID"
|
||||||
},
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ package model
|
||||||
//
|
//
|
||||||
// swagger:model Application
|
// swagger:model Application
|
||||||
type Application struct {
|
type Application struct {
|
||||||
ID string `gorm:"primary_key;unique_index"`
|
ID string `gorm:"primary_key;unique_index" json:"id"`
|
||||||
UserID uint `gorm:"index" json:"-"`
|
UserID uint `gorm:"index" json:"-"`
|
||||||
Name string `form:"name" query:"name" json:"name" binding:"required"`
|
Name string `form:"name" query:"name" json:"name" binding:"required"`
|
||||||
Description string `form:"description" query:"description" json:"description"`
|
Description string `form:"description" query:"description" json:"description"`
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ package model
|
||||||
//
|
//
|
||||||
// swagger:model Client
|
// swagger:model Client
|
||||||
type Client struct {
|
type Client struct {
|
||||||
ID string `gorm:"primary_key;unique_index"`
|
ID string `gorm:"primary_key;unique_index" json:"id"`
|
||||||
UserID uint `gorm:"index" json:"-"`
|
UserID uint `gorm:"index" json:"-"`
|
||||||
Name string `form:"name" query:"name" json:"name" binding:"required"`
|
Name string `form:"name" query:"name" json:"name" binding:"required"`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue