Remove measure importance
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
@@ -29,17 +29,16 @@ import (
|
||||
|
||||
type (
|
||||
Mesure struct {
|
||||
ID gid.GID `db:"id"`
|
||||
TenantID gid.TenantID `db:"tenant_id"`
|
||||
OrganizationID gid.GID `db:"organization_id"`
|
||||
Category string `db:"category"`
|
||||
Name string `db:"name"`
|
||||
Description string `db:"description"`
|
||||
Importance MesureImportance `db:"importance"`
|
||||
State MesureState `db:"state"`
|
||||
ReferenceID string `db:"reference_id"`
|
||||
CreatedAt time.Time `db:"created_at"`
|
||||
UpdatedAt time.Time `db:"updated_at"`
|
||||
ID gid.GID `db:"id"`
|
||||
TenantID gid.TenantID `db:"tenant_id"`
|
||||
OrganizationID gid.GID `db:"organization_id"`
|
||||
Category string `db:"category"`
|
||||
Name string `db:"name"`
|
||||
Description string `db:"description"`
|
||||
State MesureState `db:"state"`
|
||||
ReferenceID string `db:"reference_id"`
|
||||
CreatedAt time.Time `db:"created_at"`
|
||||
UpdatedAt time.Time `db:"updated_at"`
|
||||
}
|
||||
|
||||
Mesures []*Mesure
|
||||
@@ -71,7 +70,6 @@ WITH msrs AS (
|
||||
m.name,
|
||||
m.description,
|
||||
m.state,
|
||||
m.importance,
|
||||
m.reference_id,
|
||||
m.created_at,
|
||||
m.updated_at
|
||||
@@ -90,7 +88,6 @@ SELECT
|
||||
name,
|
||||
description,
|
||||
state,
|
||||
importance,
|
||||
reference_id,
|
||||
created_at,
|
||||
updated_at
|
||||
@@ -137,7 +134,6 @@ WITH mtgtns AS (
|
||||
m.name,
|
||||
m.description,
|
||||
m.state,
|
||||
m.importance,
|
||||
m.reference_id,
|
||||
m.created_at,
|
||||
m.updated_at
|
||||
@@ -156,7 +152,6 @@ SELECT
|
||||
name,
|
||||
description,
|
||||
state,
|
||||
importance,
|
||||
reference_id,
|
||||
created_at,
|
||||
updated_at
|
||||
@@ -202,7 +197,6 @@ SELECT
|
||||
name,
|
||||
description,
|
||||
state,
|
||||
importance,
|
||||
reference_id,
|
||||
created_at,
|
||||
updated_at
|
||||
@@ -249,7 +243,6 @@ SELECT
|
||||
name,
|
||||
description,
|
||||
state,
|
||||
importance,
|
||||
reference_id,
|
||||
created_at,
|
||||
updated_at
|
||||
@@ -294,7 +287,6 @@ INSERT INTO
|
||||
organization_id,
|
||||
category,
|
||||
name,
|
||||
importance,
|
||||
state,
|
||||
description,
|
||||
reference_id,
|
||||
@@ -307,7 +299,6 @@ VALUES (
|
||||
@organization_id,
|
||||
@category,
|
||||
@name,
|
||||
@importance,
|
||||
@state,
|
||||
@description,
|
||||
@reference_id,
|
||||
@@ -339,7 +330,6 @@ RETURNING
|
||||
"organization_id": m.OrganizationID,
|
||||
"category": m.Category,
|
||||
"name": m.Name,
|
||||
"importance": m.Importance,
|
||||
"state": m.State,
|
||||
"description": m.Description,
|
||||
"reference_id": m.ReferenceID,
|
||||
@@ -375,7 +365,6 @@ INSERT INTO
|
||||
organization_id,
|
||||
category,
|
||||
name,
|
||||
importance,
|
||||
state,
|
||||
description,
|
||||
reference_id,
|
||||
@@ -388,7 +377,6 @@ VALUES (
|
||||
@organization_id,
|
||||
@category,
|
||||
@name,
|
||||
@importance,
|
||||
@state,
|
||||
@description,
|
||||
@reference_id,
|
||||
@@ -408,7 +396,6 @@ VALUES (
|
||||
"created_at": m.CreatedAt,
|
||||
"updated_at": m.UpdatedAt,
|
||||
"state": m.State,
|
||||
"importance": m.Importance,
|
||||
}
|
||||
_, err := conn.Exec(ctx, q, args)
|
||||
return err
|
||||
@@ -426,7 +413,6 @@ SET
|
||||
description = @description,
|
||||
category = @category,
|
||||
state = @state,
|
||||
importance = @importance,
|
||||
updated_at = @updated_at
|
||||
WHERE %s
|
||||
AND id = @mesure_id
|
||||
@@ -439,7 +425,6 @@ WHERE %s
|
||||
"description": m.Description,
|
||||
"category": m.Category,
|
||||
"state": m.State,
|
||||
"importance": m.Importance,
|
||||
"updated_at": m.UpdatedAt,
|
||||
}
|
||||
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
// Copyright (c) 2025 Probo Inc <hello@getprobo.com>.
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
// PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
package coredata
|
||||
|
||||
import (
|
||||
"database/sql/driver"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type MesureImportance uint8
|
||||
|
||||
const (
|
||||
MesureImportanceMandatory MesureImportance = iota
|
||||
MesureImportancePreferred
|
||||
MesureImportanceAdvanced
|
||||
)
|
||||
|
||||
func (i MesureImportance) String() string {
|
||||
return []string{"MANDATORY", "PREFERRED", "ADVANCED"}[i]
|
||||
}
|
||||
|
||||
func (i *MesureImportance) Scan(value interface{}) error {
|
||||
switch v := value.(type) {
|
||||
case uint8:
|
||||
*i = MesureImportance(v)
|
||||
case string:
|
||||
switch v {
|
||||
case "MANDATORY":
|
||||
*i = MesureImportanceMandatory
|
||||
case "PREFERRED":
|
||||
*i = MesureImportancePreferred
|
||||
case "ADVANCED":
|
||||
*i = MesureImportanceAdvanced
|
||||
default:
|
||||
return fmt.Errorf("invalid MesureImportance value: %q", v)
|
||||
}
|
||||
default:
|
||||
return fmt.Errorf("unsupported type for MesureImportance: %T", value)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (i MesureImportance) Value() (driver.Value, error) {
|
||||
return i.String(), nil
|
||||
}
|
||||
|
||||
func (i MesureImportance) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(i.String())
|
||||
}
|
||||
|
||||
func (i *MesureImportance) UnmarshalJSON(data []byte) error {
|
||||
var s string
|
||||
if err := json.Unmarshal(data, &s); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
switch s {
|
||||
case "MANDATORY":
|
||||
*i = MesureImportanceMandatory
|
||||
case "PREFERRED":
|
||||
*i = MesureImportancePreferred
|
||||
case "ADVANCED":
|
||||
*i = MesureImportanceAdvanced
|
||||
default:
|
||||
return fmt.Errorf("invalid MesureImportance value: %q", s)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (i *MesureImportance) UnmarshalText(text []byte) error {
|
||||
var s string
|
||||
if err := json.Unmarshal(text, &s); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
switch s {
|
||||
case "MANDATORY":
|
||||
*i = MesureImportanceMandatory
|
||||
case "PREFERRED":
|
||||
*i = MesureImportancePreferred
|
||||
case "ADVANCED":
|
||||
*i = MesureImportanceAdvanced
|
||||
default:
|
||||
return fmt.Errorf("invalid MesureImportance value: %q", s)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
1
pkg/coredata/migrations/20250427T082100Z.sql
Normal file
1
pkg/coredata/migrations/20250427T082100Z.sql
Normal file
@@ -0,0 +1 @@
|
||||
ALTER TABLE mesures DROP COLUMN importance;
|
||||
@@ -1,15 +0,0 @@
|
||||
type Risk {
|
||||
id: ID!
|
||||
organizationId: ID!
|
||||
name: String!
|
||||
description: String!
|
||||
category: String!
|
||||
treatment: RiskTreatment!
|
||||
ownerId: ID
|
||||
inherentLikelihood: Int!
|
||||
inherentImpact: Int!
|
||||
residualLikelihood: Int!
|
||||
residualImpact: Int!
|
||||
createdAt: Time!
|
||||
updatedAt: Time!
|
||||
}
|
||||
@@ -36,7 +36,6 @@ type (
|
||||
Name string
|
||||
Description string
|
||||
Category string
|
||||
Importance coredata.MesureImportance
|
||||
}
|
||||
|
||||
UpdateMesureRequest struct {
|
||||
@@ -45,16 +44,13 @@ type (
|
||||
Description *string
|
||||
Category *string
|
||||
State *coredata.MesureState
|
||||
Importance *coredata.MesureImportance
|
||||
}
|
||||
|
||||
ImportMesureRequest struct {
|
||||
Mesures []struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Category string `json:"category"`
|
||||
Importance coredata.MesureImportance `json:"importance"`
|
||||
ReferenceID string `json:"reference-id"`
|
||||
Name string `json:"name"`
|
||||
Category string `json:"category"`
|
||||
ReferenceID string `json:"reference-id"`
|
||||
Standards []struct {
|
||||
Framework string `json:"framework"`
|
||||
Control string `json:"control"`
|
||||
@@ -157,11 +153,10 @@ func (s MesureService) Import(
|
||||
ID: mesureID,
|
||||
OrganizationID: organizationID,
|
||||
Name: req.Mesures[i].Name,
|
||||
Description: req.Mesures[i].Description,
|
||||
Description: "",
|
||||
Category: req.Mesures[i].Category,
|
||||
State: coredata.MesureStateNotStarted,
|
||||
ReferenceID: req.Mesures[i].ReferenceID,
|
||||
Importance: req.Mesures[i].Importance,
|
||||
CreatedAt: now,
|
||||
UpdatedAt: now,
|
||||
}
|
||||
@@ -289,10 +284,6 @@ func (s MesureService) Update(
|
||||
mesure.State = *req.State
|
||||
}
|
||||
|
||||
if req.Importance != nil {
|
||||
mesure.Importance = *req.Importance
|
||||
}
|
||||
|
||||
mesure.UpdatedAt = time.Now()
|
||||
|
||||
if err := mesure.Update(ctx, conn, s.svc.scope); err != nil {
|
||||
@@ -359,7 +350,6 @@ func (s MesureService) Create(
|
||||
Category: req.Category,
|
||||
ReferenceID: "custom-mesure-" + referenceID.String(),
|
||||
State: coredata.MesureStateNotStarted,
|
||||
Importance: req.Importance,
|
||||
CreatedAt: now,
|
||||
UpdatedAt: now,
|
||||
}
|
||||
|
||||
@@ -91,22 +91,6 @@ enum PeopleKind
|
||||
)
|
||||
}
|
||||
|
||||
enum MesureImportance
|
||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.MesureImportance") {
|
||||
MANDATORY
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.MesureImportanceMandatory"
|
||||
)
|
||||
PREFERRED
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.MesureImportancePreferred"
|
||||
)
|
||||
ADVANCED
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.MesureImportanceAdvanced"
|
||||
)
|
||||
}
|
||||
|
||||
enum PolicyStatus
|
||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.PolicyStatus") {
|
||||
DRAFT
|
||||
@@ -581,7 +565,6 @@ type Mesure implements Node {
|
||||
name: String!
|
||||
description: String!
|
||||
state: MesureState!
|
||||
importance: MesureImportance!
|
||||
|
||||
tasks(
|
||||
first: Int
|
||||
@@ -1083,7 +1066,6 @@ input CreateMesureInput {
|
||||
name: String!
|
||||
description: String!
|
||||
category: String!
|
||||
importance: MesureImportance!
|
||||
}
|
||||
|
||||
input UpdateMesureInput {
|
||||
@@ -1092,7 +1074,6 @@ input UpdateMesureInput {
|
||||
description: String
|
||||
category: String
|
||||
state: MesureState
|
||||
importance: MesureImportance
|
||||
}
|
||||
|
||||
input ImportMesureInput {
|
||||
|
||||
@@ -283,7 +283,6 @@ type ComplexityRoot struct {
|
||||
CreatedAt func(childComplexity int) int
|
||||
Description func(childComplexity int) int
|
||||
ID func(childComplexity int) int
|
||||
Importance func(childComplexity int) int
|
||||
Name func(childComplexity int) int
|
||||
Risks func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.RiskOrderBy) int
|
||||
State func(childComplexity int) int
|
||||
@@ -1382,13 +1381,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
||||
|
||||
return e.complexity.Mesure.ID(childComplexity), true
|
||||
|
||||
case "Mesure.importance":
|
||||
if e.complexity.Mesure.Importance == nil {
|
||||
break
|
||||
}
|
||||
|
||||
return e.complexity.Mesure.Importance(childComplexity), true
|
||||
|
||||
case "Mesure.name":
|
||||
if e.complexity.Mesure.Name == nil {
|
||||
break
|
||||
@@ -3483,22 +3475,6 @@ enum PeopleKind
|
||||
)
|
||||
}
|
||||
|
||||
enum MesureImportance
|
||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.MesureImportance") {
|
||||
MANDATORY
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.MesureImportanceMandatory"
|
||||
)
|
||||
PREFERRED
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.MesureImportancePreferred"
|
||||
)
|
||||
ADVANCED
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.MesureImportanceAdvanced"
|
||||
)
|
||||
}
|
||||
|
||||
enum PolicyStatus
|
||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.PolicyStatus") {
|
||||
DRAFT
|
||||
@@ -3973,7 +3949,6 @@ type Mesure implements Node {
|
||||
name: String!
|
||||
description: String!
|
||||
state: MesureState!
|
||||
importance: MesureImportance!
|
||||
|
||||
tasks(
|
||||
first: Int
|
||||
@@ -4475,7 +4450,6 @@ input CreateMesureInput {
|
||||
name: String!
|
||||
description: String!
|
||||
category: String!
|
||||
importance: MesureImportance!
|
||||
}
|
||||
|
||||
input UpdateMesureInput {
|
||||
@@ -4484,7 +4458,6 @@ input UpdateMesureInput {
|
||||
description: String
|
||||
category: String
|
||||
state: MesureState
|
||||
importance: MesureImportance
|
||||
}
|
||||
|
||||
input ImportMesureInput {
|
||||
@@ -12165,50 +12138,6 @@ func (ec *executionContext) fieldContext_Mesure_state(_ context.Context, field g
|
||||
return fc, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Mesure_importance(ctx context.Context, field graphql.CollectedField, obj *types.Mesure) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_Mesure_importance(ctx, field)
|
||||
if err != nil {
|
||||
return graphql.Null
|
||||
}
|
||||
ctx = graphql.WithFieldContext(ctx, fc)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = graphql.Null
|
||||
}
|
||||
}()
|
||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
|
||||
ctx = rctx // use context from middleware stack in children
|
||||
return obj.Importance, nil
|
||||
})
|
||||
if err != nil {
|
||||
ec.Error(ctx, err)
|
||||
return graphql.Null
|
||||
}
|
||||
if resTmp == nil {
|
||||
if !graphql.HasFieldError(ctx, fc) {
|
||||
ec.Errorf(ctx, "must not be null")
|
||||
}
|
||||
return graphql.Null
|
||||
}
|
||||
res := resTmp.(coredata.MesureImportance)
|
||||
fc.Result = res
|
||||
return ec.marshalNMesureImportance2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐMesureImportance(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) fieldContext_Mesure_importance(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||
fc = &graphql.FieldContext{
|
||||
Object: "Mesure",
|
||||
Field: field,
|
||||
IsMethod: false,
|
||||
IsResolver: false,
|
||||
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||
return nil, errors.New("field of type MesureImportance does not have child fields")
|
||||
},
|
||||
}
|
||||
return fc, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Mesure_tasks(ctx context.Context, field graphql.CollectedField, obj *types.Mesure) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_Mesure_tasks(ctx, field)
|
||||
if err != nil {
|
||||
@@ -12677,8 +12606,6 @@ func (ec *executionContext) fieldContext_MesureEdge_node(_ context.Context, fiel
|
||||
return ec.fieldContext_Mesure_description(ctx, field)
|
||||
case "state":
|
||||
return ec.fieldContext_Mesure_state(ctx, field)
|
||||
case "importance":
|
||||
return ec.fieldContext_Mesure_importance(ctx, field)
|
||||
case "tasks":
|
||||
return ec.fieldContext_Mesure_tasks(ctx, field)
|
||||
case "risks":
|
||||
@@ -19912,8 +19839,6 @@ func (ec *executionContext) fieldContext_UpdateMesurePayload_mesure(_ context.Co
|
||||
return ec.fieldContext_Mesure_description(ctx, field)
|
||||
case "state":
|
||||
return ec.fieldContext_Mesure_state(ctx, field)
|
||||
case "importance":
|
||||
return ec.fieldContext_Mesure_importance(ctx, field)
|
||||
case "tasks":
|
||||
return ec.fieldContext_Mesure_tasks(ctx, field)
|
||||
case "risks":
|
||||
@@ -25922,7 +25847,7 @@ func (ec *executionContext) unmarshalInputCreateMesureInput(ctx context.Context,
|
||||
asMap[k] = v
|
||||
}
|
||||
|
||||
fieldsInOrder := [...]string{"organizationId", "name", "description", "category", "importance"}
|
||||
fieldsInOrder := [...]string{"organizationId", "name", "description", "category"}
|
||||
for _, k := range fieldsInOrder {
|
||||
v, ok := asMap[k]
|
||||
if !ok {
|
||||
@@ -25957,13 +25882,6 @@ func (ec *executionContext) unmarshalInputCreateMesureInput(ctx context.Context,
|
||||
return it, err
|
||||
}
|
||||
it.Category = data
|
||||
case "importance":
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("importance"))
|
||||
data, err := ec.unmarshalNMesureImportance2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐMesureImportance(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
it.Importance = data
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27514,7 +27432,7 @@ func (ec *executionContext) unmarshalInputUpdateMesureInput(ctx context.Context,
|
||||
asMap[k] = v
|
||||
}
|
||||
|
||||
fieldsInOrder := [...]string{"id", "name", "description", "category", "state", "importance"}
|
||||
fieldsInOrder := [...]string{"id", "name", "description", "category", "state"}
|
||||
for _, k := range fieldsInOrder {
|
||||
v, ok := asMap[k]
|
||||
if !ok {
|
||||
@@ -27556,13 +27474,6 @@ func (ec *executionContext) unmarshalInputUpdateMesureInput(ctx context.Context,
|
||||
return it, err
|
||||
}
|
||||
it.State = data
|
||||
case "importance":
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("importance"))
|
||||
data, err := ec.unmarshalOMesureImportance2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐMesureImportance(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
it.Importance = data
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30417,11 +30328,6 @@ func (ec *executionContext) _Mesure(ctx context.Context, sel ast.SelectionSet, o
|
||||
if out.Values[i] == graphql.Null {
|
||||
atomic.AddUint32(&out.Invalids, 1)
|
||||
}
|
||||
case "importance":
|
||||
out.Values[i] = ec._Mesure_importance(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
atomic.AddUint32(&out.Invalids, 1)
|
||||
}
|
||||
case "tasks":
|
||||
field := field
|
||||
|
||||
@@ -35733,35 +35639,6 @@ func (ec *executionContext) marshalNMesureEdge2ᚖgithubᚗcomᚋgetproboᚋprob
|
||||
return ec._MesureEdge(ctx, sel, v)
|
||||
}
|
||||
|
||||
func (ec *executionContext) unmarshalNMesureImportance2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐMesureImportance(ctx context.Context, v any) (coredata.MesureImportance, error) {
|
||||
tmp, err := graphql.UnmarshalString(v)
|
||||
res := unmarshalNMesureImportance2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐMesureImportance[tmp]
|
||||
return res, graphql.ErrorOnPath(ctx, err)
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalNMesureImportance2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐMesureImportance(ctx context.Context, sel ast.SelectionSet, v coredata.MesureImportance) graphql.Marshaler {
|
||||
res := graphql.MarshalString(marshalNMesureImportance2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐMesureImportance[v])
|
||||
if res == graphql.Null {
|
||||
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
|
||||
ec.Errorf(ctx, "the requested element is null which the schema does not allow")
|
||||
}
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
var (
|
||||
unmarshalNMesureImportance2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐMesureImportance = map[string]coredata.MesureImportance{
|
||||
"MANDATORY": coredata.MesureImportanceMandatory,
|
||||
"PREFERRED": coredata.MesureImportancePreferred,
|
||||
"ADVANCED": coredata.MesureImportanceAdvanced,
|
||||
}
|
||||
marshalNMesureImportance2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐMesureImportance = map[coredata.MesureImportance]string{
|
||||
coredata.MesureImportanceMandatory: "MANDATORY",
|
||||
coredata.MesureImportancePreferred: "PREFERRED",
|
||||
coredata.MesureImportanceAdvanced: "ADVANCED",
|
||||
}
|
||||
)
|
||||
|
||||
func (ec *executionContext) unmarshalNMesureOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐMesureOrderField(ctx context.Context, v any) (coredata.MesureOrderField, error) {
|
||||
tmp, err := graphql.UnmarshalString(v)
|
||||
res := unmarshalNMesureOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐMesureOrderField[tmp]
|
||||
@@ -37571,36 +37448,6 @@ func (ec *executionContext) marshalOInt2ᚖint(ctx context.Context, sel ast.Sele
|
||||
return res
|
||||
}
|
||||
|
||||
func (ec *executionContext) unmarshalOMesureImportance2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐMesureImportance(ctx context.Context, v any) (*coredata.MesureImportance, error) {
|
||||
if v == nil {
|
||||
return nil, nil
|
||||
}
|
||||
tmp, err := graphql.UnmarshalString(v)
|
||||
res := unmarshalOMesureImportance2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐMesureImportance[tmp]
|
||||
return &res, graphql.ErrorOnPath(ctx, err)
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalOMesureImportance2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐMesureImportance(ctx context.Context, sel ast.SelectionSet, v *coredata.MesureImportance) graphql.Marshaler {
|
||||
if v == nil {
|
||||
return graphql.Null
|
||||
}
|
||||
res := graphql.MarshalString(marshalOMesureImportance2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐMesureImportance[*v])
|
||||
return res
|
||||
}
|
||||
|
||||
var (
|
||||
unmarshalOMesureImportance2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐMesureImportance = map[string]coredata.MesureImportance{
|
||||
"MANDATORY": coredata.MesureImportanceMandatory,
|
||||
"PREFERRED": coredata.MesureImportancePreferred,
|
||||
"ADVANCED": coredata.MesureImportanceAdvanced,
|
||||
}
|
||||
marshalOMesureImportance2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐMesureImportance = map[coredata.MesureImportance]string{
|
||||
coredata.MesureImportanceMandatory: "MANDATORY",
|
||||
coredata.MesureImportancePreferred: "PREFERRED",
|
||||
coredata.MesureImportanceAdvanced: "ADVANCED",
|
||||
}
|
||||
)
|
||||
|
||||
func (ec *executionContext) unmarshalOMesureOrder2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐMesureOrderBy(ctx context.Context, v any) (*types.MesureOrderBy, error) {
|
||||
if v == nil {
|
||||
return nil, nil
|
||||
|
||||
@@ -50,7 +50,6 @@ func NewMesure(c *coredata.Mesure) *Mesure {
|
||||
Name: c.Name,
|
||||
Description: c.Description,
|
||||
State: c.State,
|
||||
Importance: c.Importance,
|
||||
CreatedAt: c.CreatedAt,
|
||||
UpdatedAt: c.UpdatedAt,
|
||||
}
|
||||
|
||||
@@ -128,11 +128,10 @@ type CreateFrameworkPayload struct {
|
||||
}
|
||||
|
||||
type CreateMesureInput struct {
|
||||
OrganizationID gid.GID `json:"organizationId"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Category string `json:"category"`
|
||||
Importance coredata.MesureImportance `json:"importance"`
|
||||
OrganizationID gid.GID `json:"organizationId"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Category string `json:"category"`
|
||||
}
|
||||
|
||||
type CreateMesurePayload struct {
|
||||
@@ -456,17 +455,16 @@ type InviteUserPayload struct {
|
||||
}
|
||||
|
||||
type Mesure struct {
|
||||
ID gid.GID `json:"id"`
|
||||
Category string `json:"category"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
State coredata.MesureState `json:"state"`
|
||||
Importance coredata.MesureImportance `json:"importance"`
|
||||
Tasks *TaskConnection `json:"tasks"`
|
||||
Risks *RiskConnection `json:"risks"`
|
||||
Controls *ControlConnection `json:"controls"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
ID gid.GID `json:"id"`
|
||||
Category string `json:"category"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
State coredata.MesureState `json:"state"`
|
||||
Tasks *TaskConnection `json:"tasks"`
|
||||
Risks *RiskConnection `json:"risks"`
|
||||
Controls *ControlConnection `json:"controls"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
}
|
||||
|
||||
func (Mesure) IsNode() {}
|
||||
@@ -680,12 +678,11 @@ type UpdateFrameworkPayload struct {
|
||||
}
|
||||
|
||||
type UpdateMesureInput struct {
|
||||
ID gid.GID `json:"id"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Category *string `json:"category,omitempty"`
|
||||
State *coredata.MesureState `json:"state,omitempty"`
|
||||
Importance *coredata.MesureImportance `json:"importance,omitempty"`
|
||||
ID gid.GID `json:"id"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Category *string `json:"category,omitempty"`
|
||||
State *coredata.MesureState `json:"state,omitempty"`
|
||||
}
|
||||
|
||||
type UpdateMesurePayload struct {
|
||||
|
||||
@@ -539,7 +539,6 @@ func (r *mutationResolver) CreateMesure(ctx context.Context, input types.CreateM
|
||||
Name: input.Name,
|
||||
Description: input.Description,
|
||||
Category: input.Category,
|
||||
Importance: input.Importance,
|
||||
})
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("cannot create mesure: %w", err))
|
||||
@@ -559,7 +558,6 @@ func (r *mutationResolver) UpdateMesure(ctx context.Context, input types.UpdateM
|
||||
Name: input.Name,
|
||||
Description: input.Description,
|
||||
Category: input.Category,
|
||||
Importance: input.Importance,
|
||||
State: input.State,
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user