feat(roles): the holders answer names the function
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aRnCGqELxoix5TfpX8Ejf
This commit is contained in:
1 parent
9c2e23a036
commit
79588bef05
3 files changed
+4
-2
No files matched your search
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user