Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Commit

Permalink
Merge branch 'master' into deployments-check-k8s-auth
Browse files Browse the repository at this point in the history
  • Loading branch information
ebaron authored Aug 2, 2018
2 parents fcbaf55 + 6687a95 commit d74c13e
Show file tree
Hide file tree
Showing 66 changed files with 425 additions and 423 deletions.
20 changes: 9 additions & 11 deletions controller/area.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,21 +259,19 @@ func ConvertArea(db application.DB, request *http.Request, ar area.Area, options
return i
}

// ConvertAreaSimple converts a simple area ID into a Generic Reletionship
func ConvertAreaSimple(request *http.Request, id interface{}) *app.GenericData {
// ConvertAreaSimple converts a simple area ID into a Generic Relationship
// data+links element
func ConvertAreaSimple(request *http.Request, id interface{}) (*app.GenericData, *app.GenericLinks) {
t := area.APIStringTypeAreas
i := fmt.Sprint(id)
return &app.GenericData{
Type: &t,
ID: &i,
Links: createAreaLinks(request, id),
data := &app.GenericData{
Type: &t,
ID: &i,
}
}

func createAreaLinks(request *http.Request, id interface{}) *app.GenericLinks {
relatedURL := rest.AbsoluteURL(request, app.AreaHref(id))
return &app.GenericLinks{
relatedURL := rest.AbsoluteURL(request, app.AreaHref(i))
links := &app.GenericLinks{
Self: &relatedURL,
Related: &relatedURL,
}
return data, links
}
20 changes: 9 additions & 11 deletions controller/iteration.go
Original file line number Diff line number Diff line change
Expand Up @@ -515,23 +515,21 @@ func ConvertIteration(request *http.Request, itr iteration.Iteration, additional
return i
}

// ConvertIterationSimple converts a simple Iteration ID into a Generic Reletionship
func ConvertIterationSimple(request *http.Request, id interface{}) *app.GenericData {
// ConvertIterationSimple converts a simple Iteration ID into a Generic
// Relationship data+links element
func ConvertIterationSimple(request *http.Request, id interface{}) (*app.GenericData, *app.GenericLinks) {
t := iteration.APIStringTypeIteration
i := fmt.Sprint(id)
return &app.GenericData{
Type: &t,
ID: &i,
Links: createIterationLinks(request, id),
data := &app.GenericData{
Type: &t,
ID: &i,
}
}

func createIterationLinks(request *http.Request, id interface{}) *app.GenericLinks {
relatedURL := rest.AbsoluteURL(request, app.IterationHref(id))
return &app.GenericLinks{
relatedURL := rest.AbsoluteURL(request, app.IterationHref(i))
links := &app.GenericLinks{
Self: &relatedURL,
Related: &relatedURL,
}
return data, links
}

// iterationIDMap contains a map that will hold iteration's ID as its key
Expand Down
7 changes: 4 additions & 3 deletions controller/label.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package controller

import (
"fmt"
"net/http"
"strings"

Expand Down Expand Up @@ -152,7 +153,7 @@ func ConvertLabels(appl application.Application, request *http.Request, labels [
return ls
}

// ConvertLabelsSimple converts an array of Label IDs into a Generic Reletionship List
// ConvertLabelsSimple converts an array of Label IDs into a Generic Relationship List
func ConvertLabelsSimple(request *http.Request, labelIDs []interface{}) []*app.GenericData {
ops := make([]*app.GenericData, 0, len(labelIDs))
for _, labelID := range labelIDs {
Expand All @@ -161,10 +162,10 @@ func ConvertLabelsSimple(request *http.Request, labelIDs []interface{}) []*app.G
return ops
}

// ConvertLabelSimple converts a Label ID into a Generic Reletionship
// ConvertLabelSimple converts a Label ID into a Generic Relationship
func ConvertLabelSimple(request *http.Request, labelID interface{}) *app.GenericData {
t := label.APIStringTypeLabels
i := labelID.(string)
i := fmt.Sprint(labelID)
return &app.GenericData{
Type: &t,
ID: &i,
Expand Down
17 changes: 5 additions & 12 deletions controller/test-files/event/list/ok-area.res.payload.golden.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,17 @@
"modifier": {
"data": {
"id": "00000000-0000-0000-0000-000000000002",
"links": {
"related": "http:///api/users/00000000-0000-0000-0000-000000000002"
},
"type": "identities"
"type": "users"
},
"links": {
"related": "http:///api/users/00000000-0000-0000-0000-000000000002",
"self": "http:///api/users/00000000-0000-0000-0000-000000000002"
}
},
"newValue": {
"data": [
{
"id": "00000000-0000-0000-0000-000000000003",
"links": {
"related": "http:///api/areas/00000000-0000-0000-0000-000000000003",
"self": "http:///api/areas/00000000-0000-0000-0000-000000000003"
},
"type": "areas"
}
]
Expand All @@ -34,10 +31,6 @@
"data": [
{
"id": "",
"links": {
"related": "http:///api/areas/",
"self": "http:///api/areas/"
},
"type": "areas"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,17 @@
"modifier": {
"data": {
"id": "00000000-0000-0000-0000-000000000002",
"links": {
"related": "http:///api/users/00000000-0000-0000-0000-000000000002"
},
"type": "identities"
"type": "users"
},
"links": {
"related": "http:///api/users/00000000-0000-0000-0000-000000000002",
"self": "http:///api/users/00000000-0000-0000-0000-000000000002"
}
},
"newValue": {
"data": [
{
"id": "00000000-0000-0000-0000-000000000002",
"links": {
"related": "http:///api/users/00000000-0000-0000-0000-000000000002",
"self": "http:///api/users/00000000-0000-0000-0000-000000000002"
},
"type": "users"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
"modifier": {
"data": {
"id": "00000000-0000-0000-0000-000000000002",
"links": {
"related": "http:///api/users/00000000-0000-0000-0000-000000000002"
},
"type": "identities"
"type": "users"
},
"links": {
"related": "http:///api/users/00000000-0000-0000-0000-000000000002",
"self": "http:///api/users/00000000-0000-0000-0000-000000000002"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,17 @@
"modifier": {
"data": {
"id": "00000000-0000-0000-0000-000000000002",
"links": {
"related": "http:///api/users/00000000-0000-0000-0000-000000000002"
},
"type": "identities"
"type": "users"
},
"links": {
"related": "http:///api/users/00000000-0000-0000-0000-000000000002",
"self": "http:///api/users/00000000-0000-0000-0000-000000000002"
}
},
"newValue": {
"data": [
{
"id": "00000000-0000-0000-0000-000000000003",
"links": {
"related": "http:///api/iterations/00000000-0000-0000-0000-000000000003",
"self": "http:///api/iterations/00000000-0000-0000-0000-000000000003"
},
"type": "iterations"
}
]
Expand All @@ -34,10 +31,6 @@
"data": [
{
"id": "",
"links": {
"related": "http:///api/iterations/",
"self": "http:///api/iterations/"
},
"type": "iterations"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
"modifier": {
"data": {
"id": "00000000-0000-0000-0000-000000000002",
"links": {
"related": "http:///api/users/00000000-0000-0000-0000-000000000002"
},
"type": "identities"
"type": "users"
},
"links": {
"related": "http:///api/users/00000000-0000-0000-0000-000000000002",
"self": "http:///api/users/00000000-0000-0000-0000-000000000002"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
"modifier": {
"data": {
"id": "00000000-0000-0000-0000-000000000002",
"links": {
"related": "http:///api/users/00000000-0000-0000-0000-000000000002"
},
"type": "identities"
"type": "users"
},
"links": {
"related": "http:///api/users/00000000-0000-0000-0000-000000000002",
"self": "http:///api/users/00000000-0000-0000-0000-000000000002"
}
}
},
Expand Down
20 changes: 7 additions & 13 deletions controller/test-files/event/list/ok-labels.res.payload.golden.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
"modifier": {
"data": {
"id": "00000000-0000-0000-0000-000000000002",
"links": {
"related": "http:///api/users/00000000-0000-0000-0000-000000000002"
},
"type": "identities"
"type": "users"
},
"links": {
"related": "http:///api/users/00000000-0000-0000-0000-000000000002",
"self": "http:///api/users/00000000-0000-0000-0000-000000000002"
}
},
"newValue": {
Expand All @@ -28,16 +29,9 @@
"id": "00000000-0000-0000-0000-000000000004",
"type": "labels"
}
],
"links": {
"related": "http:///api/workitems/00000000-0000-0000-0000-000000000005/labels"
}
]
},
"oldValue": {
"links": {
"related": "http:///api/workitems/00000000-0000-0000-0000-000000000005/labels"
}
}
"oldValue": {}
},
"type": "events"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
"modifier": {
"data": {
"id": "00000000-0000-0000-0000-000000000002",
"links": {
"related": "http:///api/users/00000000-0000-0000-0000-000000000002"
},
"type": "identities"
"type": "users"
},
"links": {
"related": "http:///api/users/00000000-0000-0000-0000-000000000002",
"self": "http:///api/users/00000000-0000-0000-0000-000000000002"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
"modifier": {
"data": {
"id": "00000000-0000-0000-0000-000000000003",
"links": {
"related": "http:///api/users/00000000-0000-0000-0000-000000000003"
},
"type": "identities"
"type": "users"
},
"links": {
"related": "http:///api/users/00000000-0000-0000-0000-000000000003",
"self": "http:///api/users/00000000-0000-0000-0000-000000000003"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
"area": {
"data": {
"id": "00000000-0000-0000-0000-000000000002",
"links": {
"related": "http:///api/areas/00000000-0000-0000-0000-000000000002",
"self": "http:///api/areas/00000000-0000-0000-0000-000000000002"
},
"type": "areas"
},
"links": {
"related": "http:///api/areas/00000000-0000-0000-0000-000000000002",
"self": "http:///api/areas/00000000-0000-0000-0000-000000000002"
}
},
"assignees": {},
Expand Down Expand Up @@ -54,11 +54,11 @@
"creator": {
"data": {
"id": "00000000-0000-0000-0000-000000000004",
"links": {
"related": "http:///api/users/00000000-0000-0000-0000-000000000004",
"self": "http:///api/users/00000000-0000-0000-0000-000000000004"
},
"type": "users"
},
"links": {
"related": "http:///api/users/00000000-0000-0000-0000-000000000004",
"self": "http:///api/users/00000000-0000-0000-0000-000000000004"
}
},
"events": {
Expand All @@ -69,11 +69,11 @@
"iteration": {
"data": {
"id": "00000000-0000-0000-0000-000000000005",
"links": {
"related": "http:///api/iterations/00000000-0000-0000-0000-000000000005",
"self": "http:///api/iterations/00000000-0000-0000-0000-000000000005"
},
"type": "iterations"
},
"links": {
"related": "http:///api/iterations/00000000-0000-0000-0000-000000000005",
"self": "http:///api/iterations/00000000-0000-0000-0000-000000000005"
}
},
"labels": {
Expand Down
Loading

0 comments on commit d74c13e

Please sign in to comment.