diff --git a/internal/roles/dataset.go b/internal/roles/dataset.go index 648417d..aa43e31 100644 --- a/internal/roles/dataset.go +++ b/internal/roles/dataset.go @@ -877,6 +877,7 @@ func (ds *Dataset) Resolve(dt string, scope Scope, now time.Time) (*Resolution, // holders. type FunctionHolders struct { Function string `json:"function"` + Label string `json:"label"` AnyMember bool `json:"any_member,omitempty"` Holders []Holder `json:"holders"` Deputies []ResolutionDeputy `json:"deputies"` @@ -896,7 +897,7 @@ func (ds *Dataset) holdersOf(fn string, scope Scope, now time.Time, dt string) ( if !ok { return nil, &Error{Status: http.StatusBadRequest, Code: "unknown_function", Message: fmt.Sprintf("unknown function %q", fn)} } - res := &FunctionHolders{Function: fn, Holders: []Holder{}, Deputies: []ResolutionDeputy{}, Status: StatusOpen} + res := &FunctionHolders{Function: fn, Label: f.Label, Holders: []Holder{}, Deputies: []ResolutionDeputy{}, Status: StatusOpen} if f.AnyMember { res.AnyMember, res.Status = true, StatusFilled return res, nil diff --git a/internal/server/role_dataset_test.go b/internal/server/role_dataset_test.go index e064a83..09a3fea 100644 --- a/internal/server/role_dataset_test.go +++ b/internal/server/role_dataset_test.go @@ -166,7 +166,7 @@ func TestRoleDataset_lifecycle(t *testing.T) { if code != http.StatusOK || out["status"] != roles.StatusFilled || out["revision"].(float64) != 2 || len(out["holders"].([]any)) != 1 || len(out["deputies"].([]any)) != 1 { t.Fatalf("holders: %d %s", code, raw) } - if h := out["holders"].([]any)[0].(map[string]any); h["kind"] != "member" || h["sub"] != "u-ceo" { + if h := out["holders"].([]any)[0].(map[string]any); h["kind"] != "member" || h["sub"] != "u-ceo" || out["label"] != "Geschäftsleitung" { t.Fatalf("holder: %v", h) } if code, out, _ := f.do(t, "werkmeister", "GET", f.path("/holders?function=r1.vorfallkontakt"), ""); code != http.StatusOK || out["status"] != roles.StatusOpen || len(out["holders"].([]any)) != 0 { diff --git a/openapi.yaml b/openapi.yaml index 14a2d62..27fd856 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -2771,6 +2771,7 @@ components: revision: { type: integer, minimum: 0 } catalogue_version: { type: string } function: { type: string } + label: { type: string, description: "the function's name in the catalogue" } any_member: { type: boolean } holders: { type: array, items: { $ref: "#/components/schemas/RoleHolder" } } deputies: