Rename State of Applicability to Statement of Applicability
Rename the entity across the full stack: database table (states_of_applicability → statements_of_applicability), Go model, GraphQL types, MCP specification, CLI commands, frontend components, routes, and display labels. Includes a migration to rename the table and its foreign key column. Widen sidebar from 260px to 280px to fit the longer label. Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -24,9 +24,9 @@ import (
|
||||
)
|
||||
|
||||
const createMutation = `
|
||||
mutation($input: CreateStateOfApplicabilityInput!) {
|
||||
createStateOfApplicability(input: $input) {
|
||||
stateOfApplicabilityEdge {
|
||||
mutation($input: CreateStatementOfApplicabilityInput!) {
|
||||
createStatementOfApplicability(input: $input) {
|
||||
statementOfApplicabilityEdge {
|
||||
node {
|
||||
id
|
||||
name
|
||||
@@ -38,15 +38,15 @@ mutation($input: CreateStateOfApplicabilityInput!) {
|
||||
`
|
||||
|
||||
type createResponse struct {
|
||||
CreateStateOfApplicability struct {
|
||||
StateOfApplicabilityEdge struct {
|
||||
CreateStatementOfApplicability struct {
|
||||
StatementOfApplicabilityEdge struct {
|
||||
Node struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
} `json:"node"`
|
||||
} `json:"stateOfApplicabilityEdge"`
|
||||
} `json:"createStateOfApplicability"`
|
||||
} `json:"statementOfApplicabilityEdge"`
|
||||
} `json:"createStatementOfApplicability"`
|
||||
}
|
||||
|
||||
func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
||||
@@ -107,7 +107,7 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
||||
return fmt.Errorf("cannot parse response: %w", err)
|
||||
}
|
||||
|
||||
s := resp.CreateStateOfApplicability.StateOfApplicabilityEdge.Node
|
||||
s := resp.CreateStatementOfApplicability.StatementOfApplicabilityEdge.Node
|
||||
_, _ = fmt.Fprintf(
|
||||
f.IOStreams.Out,
|
||||
"Created statement of applicability %s (%s)\n",
|
||||
|
||||
@@ -24,9 +24,9 @@ import (
|
||||
)
|
||||
|
||||
const deleteMutation = `
|
||||
mutation($input: DeleteStateOfApplicabilityInput!) {
|
||||
deleteStateOfApplicability(input: $input) {
|
||||
deletedStateOfApplicabilityId
|
||||
mutation($input: DeleteStatementOfApplicabilityInput!) {
|
||||
deleteStatementOfApplicability(input: $input) {
|
||||
deletedStatementOfApplicabilityId
|
||||
}
|
||||
}
|
||||
`
|
||||
@@ -78,7 +78,7 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
|
||||
deleteMutation,
|
||||
map[string]any{
|
||||
"input": map[string]any{
|
||||
"stateOfApplicabilityId": args[0],
|
||||
"statementOfApplicabilityId": args[0],
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
@@ -24,11 +24,11 @@ import (
|
||||
)
|
||||
|
||||
const listQuery = `
|
||||
query($id: ID!, $first: Int, $after: CursorKey, $orderBy: StateOfApplicabilityOrder) {
|
||||
query($id: ID!, $first: Int, $after: CursorKey, $orderBy: StatementOfApplicabilityOrder) {
|
||||
node(id: $id) {
|
||||
__typename
|
||||
... on Organization {
|
||||
statesOfApplicability(first: $first, after: $after, orderBy: $orderBy) {
|
||||
statementsOfApplicability(first: $first, after: $after, orderBy: $orderBy) {
|
||||
totalCount
|
||||
edges {
|
||||
node {
|
||||
@@ -48,7 +48,7 @@ query($id: ID!, $first: Int, $after: CursorKey, $orderBy: StateOfApplicabilityOr
|
||||
}
|
||||
`
|
||||
|
||||
type stateOfApplicability struct {
|
||||
type statementOfApplicability struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
@@ -118,11 +118,11 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
listQuery,
|
||||
variables,
|
||||
flagLimit,
|
||||
func(data json.RawMessage) (*api.Connection[stateOfApplicability], error) {
|
||||
func(data json.RawMessage) (*api.Connection[statementOfApplicability], error) {
|
||||
var resp struct {
|
||||
Node *struct {
|
||||
Typename string `json:"__typename"`
|
||||
StatesOfApplicability api.Connection[stateOfApplicability] `json:"statesOfApplicability"`
|
||||
Typename string `json:"__typename"`
|
||||
StatementsOfApplicability api.Connection[statementOfApplicability] `json:"statementsOfApplicability"`
|
||||
} `json:"node"`
|
||||
}
|
||||
if err := json.Unmarshal(data, &resp); err != nil {
|
||||
@@ -134,7 +134,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
if resp.Node.Typename != "Organization" {
|
||||
return nil, fmt.Errorf("expected Organization node, got %s", resp.Node.Typename)
|
||||
}
|
||||
return &resp.Node.StatesOfApplicability, nil
|
||||
return &resp.Node.StatementsOfApplicability, nil
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
@@ -143,7 +143,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
|
||||
if *flagOutput == cmdutil.OutputJSON {
|
||||
if soas == nil {
|
||||
soas = []stateOfApplicability{}
|
||||
soas = []statementOfApplicability{}
|
||||
}
|
||||
return cmdutil.PrintJSON(f.IOStreams.Out, soas)
|
||||
}
|
||||
|
||||
@@ -130,9 +130,9 @@ func NewCmdAdd(f *cmdutil.Factory) *cobra.Command {
|
||||
)
|
||||
|
||||
input := map[string]any{
|
||||
"stateOfApplicabilityId": flagSoA,
|
||||
"controlId": flagControl,
|
||||
"applicability": flagApplicable,
|
||||
"statementOfApplicabilityId": flagSoA,
|
||||
"controlId": flagControl,
|
||||
"applicability": flagApplicable,
|
||||
}
|
||||
|
||||
if flagJustification != "" {
|
||||
|
||||
@@ -27,7 +27,7 @@ const listQuery = `
|
||||
query($id: ID!, $first: Int, $after: CursorKey, $orderBy: ApplicabilityStatementOrder) {
|
||||
node(id: $id) {
|
||||
__typename
|
||||
... on StateOfApplicability {
|
||||
... on StatementOfApplicability {
|
||||
applicabilityStatements(first: $first, after: $after, orderBy: $orderBy) {
|
||||
totalCount
|
||||
edges {
|
||||
@@ -130,8 +130,8 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
if resp.Node == nil {
|
||||
return nil, fmt.Errorf("statement of applicability %s not found", args[0])
|
||||
}
|
||||
if resp.Node.Typename != "StateOfApplicability" {
|
||||
return nil, fmt.Errorf("expected StateOfApplicability node, got %s", resp.Node.Typename)
|
||||
if resp.Node.Typename != "StatementOfApplicability" {
|
||||
return nil, fmt.Errorf("expected StatementOfApplicability node, got %s", resp.Node.Typename)
|
||||
}
|
||||
return &resp.Node.ApplicabilityStatements, nil
|
||||
},
|
||||
|
||||
@@ -24,9 +24,9 @@ import (
|
||||
)
|
||||
|
||||
const updateMutation = `
|
||||
mutation($input: UpdateStateOfApplicabilityInput!) {
|
||||
updateStateOfApplicability(input: $input) {
|
||||
stateOfApplicability {
|
||||
mutation($input: UpdateStatementOfApplicabilityInput!) {
|
||||
updateStatementOfApplicability(input: $input) {
|
||||
statementOfApplicability {
|
||||
id
|
||||
name
|
||||
}
|
||||
@@ -35,12 +35,12 @@ mutation($input: UpdateStateOfApplicabilityInput!) {
|
||||
`
|
||||
|
||||
type updateResponse struct {
|
||||
UpdateStateOfApplicability struct {
|
||||
StateOfApplicability struct {
|
||||
UpdateStatementOfApplicability struct {
|
||||
StatementOfApplicability struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"stateOfApplicability"`
|
||||
} `json:"updateStateOfApplicability"`
|
||||
} `json:"statementOfApplicability"`
|
||||
} `json:"updateStatementOfApplicability"`
|
||||
}
|
||||
|
||||
func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
||||
@@ -103,7 +103,7 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
||||
return fmt.Errorf("cannot parse response: %w", err)
|
||||
}
|
||||
|
||||
s := resp.UpdateStateOfApplicability.StateOfApplicability
|
||||
s := resp.UpdateStatementOfApplicability.StatementOfApplicability
|
||||
_, _ = fmt.Fprintf(
|
||||
f.IOStreams.Out,
|
||||
"Updated statement of applicability %s (%s)\n",
|
||||
|
||||
@@ -28,7 +28,7 @@ const viewQuery = `
|
||||
query($id: ID!) {
|
||||
node(id: $id) {
|
||||
__typename
|
||||
... on StateOfApplicability {
|
||||
... on StatementOfApplicability {
|
||||
id
|
||||
name
|
||||
owner {
|
||||
@@ -104,8 +104,8 @@ func NewCmdView(f *cmdutil.Factory) *cobra.Command {
|
||||
return fmt.Errorf("statement of applicability %s not found", args[0])
|
||||
}
|
||||
|
||||
if resp.Node.Typename != "StateOfApplicability" {
|
||||
return fmt.Errorf("expected StateOfApplicability node, got %s", resp.Node.Typename)
|
||||
if resp.Node.Typename != "StatementOfApplicability" {
|
||||
return fmt.Errorf("expected StatementOfApplicability node, got %s", resp.Node.Typename)
|
||||
}
|
||||
|
||||
if *flagOutput == cmdutil.OutputJSON {
|
||||
|
||||
Reference in New Issue
Block a user