@@ -27,13 +27,13 @@ import (
|
||||
)
|
||||
|
||||
type Data struct {
|
||||
ID gid.GID `db:"id"`
|
||||
Name string `db:"name"`
|
||||
OrganizationID gid.GID `db:"organization_id"`
|
||||
OwnerID gid.GID `db:"owner_id"`
|
||||
DataSensitivity DataSensitivity `db:"data_sensitivity"`
|
||||
CreatedAt time.Time `db:"created_at"`
|
||||
UpdatedAt time.Time `db:"updated_at"`
|
||||
ID gid.GID `db:"id"`
|
||||
Name string `db:"name"`
|
||||
OrganizationID gid.GID `db:"organization_id"`
|
||||
OwnerID gid.GID `db:"owner_id"`
|
||||
DataClassification DataClassification `db:"data_classification"`
|
||||
CreatedAt time.Time `db:"created_at"`
|
||||
UpdatedAt time.Time `db:"updated_at"`
|
||||
}
|
||||
|
||||
func (d *Data) CursorKey(field DatumOrderField) page.CursorKey {
|
||||
@@ -42,8 +42,8 @@ func (d *Data) CursorKey(field DatumOrderField) page.CursorKey {
|
||||
return page.NewCursorKey(d.ID, d.CreatedAt)
|
||||
case DatumOrderFieldName:
|
||||
return page.NewCursorKey(d.ID, d.Name)
|
||||
case DatumOrderFieldDataSensitivity:
|
||||
return page.NewCursorKey(d.ID, d.DataSensitivity)
|
||||
case DatumOrderFieldDataClassification:
|
||||
return page.NewCursorKey(d.ID, d.DataClassification)
|
||||
}
|
||||
|
||||
panic(fmt.Sprintf("unsupported order by: %s", field))
|
||||
@@ -63,7 +63,7 @@ SELECT
|
||||
name,
|
||||
owner_id,
|
||||
organization_id,
|
||||
data_sensitivity,
|
||||
data_classification,
|
||||
created_at,
|
||||
updated_at
|
||||
FROM
|
||||
@@ -105,7 +105,7 @@ SELECT
|
||||
name,
|
||||
owner_id,
|
||||
organization_id,
|
||||
data_sensitivity,
|
||||
data_classification,
|
||||
created_at,
|
||||
updated_at
|
||||
FROM
|
||||
@@ -148,7 +148,7 @@ SELECT
|
||||
id,
|
||||
name,
|
||||
owner_id,
|
||||
data_sensitivity,
|
||||
data_classification,
|
||||
created_at,
|
||||
updated_at
|
||||
FROM
|
||||
@@ -193,7 +193,7 @@ SELECT
|
||||
name,
|
||||
organization_id,
|
||||
owner_id,
|
||||
data_sensitivity,
|
||||
data_classification,
|
||||
created_at,
|
||||
updated_at
|
||||
FROM
|
||||
@@ -237,7 +237,7 @@ INSERT INTO data (
|
||||
name,
|
||||
owner_id,
|
||||
organization_id,
|
||||
data_sensitivity,
|
||||
data_classification,
|
||||
created_at,
|
||||
updated_at
|
||||
) VALUES (
|
||||
@@ -246,21 +246,21 @@ INSERT INTO data (
|
||||
@name,
|
||||
@owner_id,
|
||||
@organization_id,
|
||||
@data_sensitivity,
|
||||
@data_classification,
|
||||
@created_at,
|
||||
@updated_at
|
||||
)
|
||||
`
|
||||
|
||||
args := pgx.StrictNamedArgs{
|
||||
"id": d.ID,
|
||||
"tenant_id": scope.GetTenantID(),
|
||||
"name": d.Name,
|
||||
"owner_id": d.OwnerID,
|
||||
"organization_id": d.OrganizationID,
|
||||
"data_sensitivity": d.DataSensitivity,
|
||||
"created_at": d.CreatedAt,
|
||||
"updated_at": d.UpdatedAt,
|
||||
"id": d.ID,
|
||||
"tenant_id": scope.GetTenantID(),
|
||||
"name": d.Name,
|
||||
"owner_id": d.OwnerID,
|
||||
"organization_id": d.OrganizationID,
|
||||
"data_classification": d.DataClassification,
|
||||
"created_at": d.CreatedAt,
|
||||
"updated_at": d.UpdatedAt,
|
||||
}
|
||||
|
||||
_, err := conn.Exec(ctx, q, args)
|
||||
@@ -281,7 +281,7 @@ UPDATE data
|
||||
SET
|
||||
name = @name,
|
||||
owner_id = @owner_id,
|
||||
data_sensitivity = @data_sensitivity,
|
||||
data_classification = @data_classification,
|
||||
updated_at = @updated_at
|
||||
WHERE
|
||||
%s
|
||||
@@ -291,7 +291,7 @@ RETURNING
|
||||
name,
|
||||
owner_id,
|
||||
organization_id,
|
||||
data_sensitivity,
|
||||
data_classification,
|
||||
created_at,
|
||||
updated_at
|
||||
`
|
||||
@@ -299,11 +299,11 @@ RETURNING
|
||||
q = fmt.Sprintf(q, scope.SQLFragment())
|
||||
|
||||
args := pgx.StrictNamedArgs{
|
||||
"id": d.ID,
|
||||
"name": d.Name,
|
||||
"owner_id": d.OwnerID,
|
||||
"data_sensitivity": d.DataSensitivity,
|
||||
"updated_at": time.Now(),
|
||||
"id": d.ID,
|
||||
"name": d.Name,
|
||||
"owner_id": d.OwnerID,
|
||||
"data_classification": d.DataClassification,
|
||||
"updated_at": time.Now(),
|
||||
}
|
||||
maps.Copy(args, scope.SQLArguments())
|
||||
|
||||
|
||||
24
pkg/coredata/data_classification.go
Normal file
24
pkg/coredata/data_classification.go
Normal file
@@ -0,0 +1,24 @@
|
||||
// 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
|
||||
|
||||
type DataClassification string
|
||||
|
||||
const (
|
||||
DataClassificationPublic DataClassification = "PUBLIC"
|
||||
DataClassificationInternal DataClassification = "INTERNAL"
|
||||
DataClassificationConfidential DataClassification = "CONFIDENTIAL"
|
||||
DataClassificationSecret DataClassification = "SECRET"
|
||||
)
|
||||
@@ -21,9 +21,9 @@ import (
|
||||
type DatumOrderField string
|
||||
|
||||
const (
|
||||
DatumOrderFieldCreatedAt DatumOrderField = "CREATED_AT"
|
||||
DatumOrderFieldName DatumOrderField = "NAME"
|
||||
DatumOrderFieldDataSensitivity DatumOrderField = "DATA_SENSITIVITY"
|
||||
DatumOrderFieldCreatedAt DatumOrderField = "CREATED_AT"
|
||||
DatumOrderFieldName DatumOrderField = "NAME"
|
||||
DatumOrderFieldDataClassification DatumOrderField = "DATA_CLASSIFICATION"
|
||||
)
|
||||
|
||||
func (p DatumOrderField) Column() string {
|
||||
@@ -43,7 +43,7 @@ func (p *DatumOrderField) UnmarshalText(text []byte) error {
|
||||
switch val {
|
||||
case string(DatumOrderFieldCreatedAt),
|
||||
string(DatumOrderFieldName),
|
||||
string(DatumOrderFieldDataSensitivity):
|
||||
string(DatumOrderFieldDataClassification):
|
||||
*p = DatumOrderField(val)
|
||||
return nil
|
||||
}
|
||||
|
||||
24
pkg/coredata/migrations/20250609T193222Z.sql
Normal file
24
pkg/coredata/migrations/20250609T193222Z.sql
Normal file
@@ -0,0 +1,24 @@
|
||||
CREATE TYPE data_classification_type AS ENUM (
|
||||
'PUBLIC',
|
||||
'INTERNAL',
|
||||
'CONFIDENTIAL',
|
||||
'SECRET'
|
||||
);
|
||||
|
||||
ALTER TABLE data
|
||||
ADD COLUMN data_classification data_classification_type;
|
||||
|
||||
UPDATE data
|
||||
SET data_classification = CASE
|
||||
WHEN data_sensitivity = 'NONE' THEN 'PUBLIC'::data_classification_type
|
||||
WHEN data_sensitivity = 'LOW' THEN 'INTERNAL'::data_classification_type
|
||||
WHEN data_sensitivity = 'MEDIUM' THEN 'INTERNAL'::data_classification_type
|
||||
WHEN data_sensitivity = 'HIGH' THEN 'CONFIDENTIAL'::data_classification_type
|
||||
WHEN data_sensitivity = 'CRITICAL' THEN 'SECRET'::data_classification_type
|
||||
END;
|
||||
|
||||
ALTER TABLE data
|
||||
ALTER COLUMN data_classification SET NOT NULL;
|
||||
|
||||
ALTER TABLE data
|
||||
DROP COLUMN data_sensitivity;
|
||||
@@ -30,19 +30,19 @@ type DatumService struct {
|
||||
}
|
||||
|
||||
type CreateDatumRequest struct {
|
||||
OrganizationID gid.GID
|
||||
Name string
|
||||
DataSensitivity coredata.DataSensitivity
|
||||
OwnerID gid.GID
|
||||
VendorIDs []gid.GID
|
||||
OrganizationID gid.GID
|
||||
Name string
|
||||
DataClassification coredata.DataClassification
|
||||
OwnerID gid.GID
|
||||
VendorIDs []gid.GID
|
||||
}
|
||||
|
||||
type UpdateDatumRequest struct {
|
||||
ID gid.GID
|
||||
Name *string
|
||||
DataSensitivity *coredata.DataSensitivity
|
||||
OwnerID *gid.GID
|
||||
VendorIDs []gid.GID
|
||||
ID gid.GID
|
||||
Name *string
|
||||
DataClassification *coredata.DataClassification
|
||||
OwnerID *gid.GID
|
||||
VendorIDs []gid.GID
|
||||
}
|
||||
|
||||
func (s DatumService) Get(
|
||||
@@ -126,21 +126,21 @@ func (s DatumService) Update(
|
||||
}
|
||||
|
||||
datum := &coredata.Data{
|
||||
ID: req.ID,
|
||||
OrganizationID: existing.OrganizationID,
|
||||
Name: existing.Name,
|
||||
DataSensitivity: existing.DataSensitivity,
|
||||
OwnerID: existing.OwnerID,
|
||||
CreatedAt: existing.CreatedAt,
|
||||
UpdatedAt: now,
|
||||
ID: req.ID,
|
||||
OrganizationID: existing.OrganizationID,
|
||||
Name: existing.Name,
|
||||
DataClassification: existing.DataClassification,
|
||||
OwnerID: existing.OwnerID,
|
||||
CreatedAt: existing.CreatedAt,
|
||||
UpdatedAt: now,
|
||||
}
|
||||
|
||||
// Update fields from request
|
||||
if req.Name != nil {
|
||||
datum.Name = *req.Name
|
||||
}
|
||||
if req.DataSensitivity != nil {
|
||||
datum.DataSensitivity = *req.DataSensitivity
|
||||
if req.DataClassification != nil {
|
||||
datum.DataClassification = *req.DataClassification
|
||||
}
|
||||
if req.OwnerID != nil {
|
||||
datum.OwnerID = *req.OwnerID
|
||||
@@ -161,13 +161,13 @@ func (s DatumService) Create(
|
||||
datumID := gid.New(s.svc.scope.GetTenantID(), coredata.DatumEntityType)
|
||||
|
||||
datum := &coredata.Data{
|
||||
ID: datumID,
|
||||
OrganizationID: req.OrganizationID,
|
||||
Name: req.Name,
|
||||
DataSensitivity: req.DataSensitivity,
|
||||
OwnerID: req.OwnerID,
|
||||
CreatedAt: now,
|
||||
UpdatedAt: now,
|
||||
ID: datumID,
|
||||
OrganizationID: req.OrganizationID,
|
||||
Name: req.Name,
|
||||
DataClassification: req.DataClassification,
|
||||
OwnerID: req.OwnerID,
|
||||
CreatedAt: now,
|
||||
UpdatedAt: now,
|
||||
}
|
||||
|
||||
err := s.svc.pg.WithTx(
|
||||
|
||||
@@ -367,7 +367,19 @@ enum AssetOrderField @goModel(model: "github.com/getprobo/probo/pkg/coredata.Ass
|
||||
enum DatumOrderField @goModel(model: "github.com/getprobo/probo/pkg/coredata.DatumOrderField") {
|
||||
CREATED_AT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DatumOrderFieldCreatedAt")
|
||||
NAME @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DatumOrderFieldName")
|
||||
DATA_SENSITIVITY @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DatumOrderFieldDataSensitivity")
|
||||
DATA_CLASSIFICATION @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DatumOrderFieldDataClassification")
|
||||
}
|
||||
|
||||
enum DataClassification
|
||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.DataClassification") {
|
||||
PUBLIC
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.DataClassificationPublic")
|
||||
INTERNAL
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.DataClassificationInternal")
|
||||
CONFIDENTIAL
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.DataClassificationConfidential")
|
||||
SECRET
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.DataClassificationSecret")
|
||||
}
|
||||
|
||||
# Input Types
|
||||
@@ -2029,7 +2041,7 @@ type DeleteAssetPayload {
|
||||
type Datum implements Node {
|
||||
id: ID!
|
||||
name: String!
|
||||
dataSensitivity: DataSensitivity!
|
||||
dataClassification: DataClassification!
|
||||
owner: People! @goField(forceResolver: true)
|
||||
vendors(
|
||||
first: Int
|
||||
@@ -2051,7 +2063,7 @@ input DatumOrder {
|
||||
input CreateDatumInput {
|
||||
organizationId: ID!
|
||||
name: String!
|
||||
dataSensitivity: DataSensitivity!
|
||||
dataClassification: DataClassification!
|
||||
ownerId: ID!
|
||||
vendorIds: [ID!]
|
||||
}
|
||||
@@ -2059,7 +2071,7 @@ input CreateDatumInput {
|
||||
input UpdateDatumInput {
|
||||
id: ID!
|
||||
name: String
|
||||
dataSensitivity: DataSensitivity
|
||||
dataClassification: DataClassification
|
||||
ownerId: ID
|
||||
vendorIds: [ID!]
|
||||
}
|
||||
|
||||
@@ -221,14 +221,14 @@ type ComplexityRoot struct {
|
||||
}
|
||||
|
||||
Datum struct {
|
||||
CreatedAt func(childComplexity int) int
|
||||
DataSensitivity func(childComplexity int) int
|
||||
ID func(childComplexity int) int
|
||||
Name func(childComplexity int) int
|
||||
Organization func(childComplexity int) int
|
||||
Owner func(childComplexity int) int
|
||||
UpdatedAt func(childComplexity int) int
|
||||
Vendors func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.VendorOrderBy) int
|
||||
CreatedAt func(childComplexity int) int
|
||||
DataClassification func(childComplexity int) int
|
||||
ID func(childComplexity int) int
|
||||
Name func(childComplexity int) int
|
||||
Organization func(childComplexity int) int
|
||||
Owner func(childComplexity int) int
|
||||
UpdatedAt func(childComplexity int) int
|
||||
Vendors func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.VendorOrderBy) int
|
||||
}
|
||||
|
||||
DatumConnection struct {
|
||||
@@ -1518,12 +1518,12 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
|
||||
|
||||
return e.complexity.Datum.CreatedAt(childComplexity), true
|
||||
|
||||
case "Datum.dataSensitivity":
|
||||
if e.complexity.Datum.DataSensitivity == nil {
|
||||
case "Datum.dataClassification":
|
||||
if e.complexity.Datum.DataClassification == nil {
|
||||
break
|
||||
}
|
||||
|
||||
return e.complexity.Datum.DataSensitivity(childComplexity), true
|
||||
return e.complexity.Datum.DataClassification(childComplexity), true
|
||||
|
||||
case "Datum.id":
|
||||
if e.complexity.Datum.ID == nil {
|
||||
@@ -5061,7 +5061,19 @@ enum AssetOrderField @goModel(model: "github.com/getprobo/probo/pkg/coredata.Ass
|
||||
enum DatumOrderField @goModel(model: "github.com/getprobo/probo/pkg/coredata.DatumOrderField") {
|
||||
CREATED_AT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DatumOrderFieldCreatedAt")
|
||||
NAME @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DatumOrderFieldName")
|
||||
DATA_SENSITIVITY @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DatumOrderFieldDataSensitivity")
|
||||
DATA_CLASSIFICATION @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DatumOrderFieldDataClassification")
|
||||
}
|
||||
|
||||
enum DataClassification
|
||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.DataClassification") {
|
||||
PUBLIC
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.DataClassificationPublic")
|
||||
INTERNAL
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.DataClassificationInternal")
|
||||
CONFIDENTIAL
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.DataClassificationConfidential")
|
||||
SECRET
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.DataClassificationSecret")
|
||||
}
|
||||
|
||||
# Input Types
|
||||
@@ -6723,7 +6735,7 @@ type DeleteAssetPayload {
|
||||
type Datum implements Node {
|
||||
id: ID!
|
||||
name: String!
|
||||
dataSensitivity: DataSensitivity!
|
||||
dataClassification: DataClassification!
|
||||
owner: People! @goField(forceResolver: true)
|
||||
vendors(
|
||||
first: Int
|
||||
@@ -6745,7 +6757,7 @@ input DatumOrder {
|
||||
input CreateDatumInput {
|
||||
organizationId: ID!
|
||||
name: String!
|
||||
dataSensitivity: DataSensitivity!
|
||||
dataClassification: DataClassification!
|
||||
ownerId: ID!
|
||||
vendorIds: [ID!]
|
||||
}
|
||||
@@ -6753,7 +6765,7 @@ input CreateDatumInput {
|
||||
input UpdateDatumInput {
|
||||
id: ID!
|
||||
name: String
|
||||
dataSensitivity: DataSensitivity
|
||||
dataClassification: DataClassification
|
||||
ownerId: ID
|
||||
vendorIds: [ID!]
|
||||
}
|
||||
@@ -14755,8 +14767,8 @@ func (ec *executionContext) fieldContext_Datum_name(_ context.Context, field gra
|
||||
return fc, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Datum_dataSensitivity(ctx context.Context, field graphql.CollectedField, obj *types.Datum) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_Datum_dataSensitivity(ctx, field)
|
||||
func (ec *executionContext) _Datum_dataClassification(ctx context.Context, field graphql.CollectedField, obj *types.Datum) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_Datum_dataClassification(ctx, field)
|
||||
if err != nil {
|
||||
return graphql.Null
|
||||
}
|
||||
@@ -14769,7 +14781,7 @@ func (ec *executionContext) _Datum_dataSensitivity(ctx context.Context, field gr
|
||||
}()
|
||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
|
||||
ctx = rctx // use context from middleware stack in children
|
||||
return obj.DataSensitivity, nil
|
||||
return obj.DataClassification, nil
|
||||
})
|
||||
if err != nil {
|
||||
ec.Error(ctx, err)
|
||||
@@ -14781,19 +14793,19 @@ func (ec *executionContext) _Datum_dataSensitivity(ctx context.Context, field gr
|
||||
}
|
||||
return graphql.Null
|
||||
}
|
||||
res := resTmp.(coredata.DataSensitivity)
|
||||
res := resTmp.(coredata.DataClassification)
|
||||
fc.Result = res
|
||||
return ec.marshalNDataSensitivity2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataSensitivity(ctx, field.Selections, res)
|
||||
return ec.marshalNDataClassification2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataClassification(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) fieldContext_Datum_dataSensitivity(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||
func (ec *executionContext) fieldContext_Datum_dataClassification(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||
fc = &graphql.FieldContext{
|
||||
Object: "Datum",
|
||||
Field: field,
|
||||
IsMethod: false,
|
||||
IsResolver: false,
|
||||
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||
return nil, errors.New("field of type DataSensitivity does not have child fields")
|
||||
return nil, errors.New("field of type DataClassification does not have child fields")
|
||||
},
|
||||
}
|
||||
return fc, nil
|
||||
@@ -15285,8 +15297,8 @@ func (ec *executionContext) fieldContext_DatumEdge_node(_ context.Context, field
|
||||
return ec.fieldContext_Datum_id(ctx, field)
|
||||
case "name":
|
||||
return ec.fieldContext_Datum_name(ctx, field)
|
||||
case "dataSensitivity":
|
||||
return ec.fieldContext_Datum_dataSensitivity(ctx, field)
|
||||
case "dataClassification":
|
||||
return ec.fieldContext_Datum_dataClassification(ctx, field)
|
||||
case "owner":
|
||||
return ec.fieldContext_Datum_owner(ctx, field)
|
||||
case "vendors":
|
||||
@@ -29608,8 +29620,8 @@ func (ec *executionContext) fieldContext_UpdateDatumPayload_datum(_ context.Cont
|
||||
return ec.fieldContext_Datum_id(ctx, field)
|
||||
case "name":
|
||||
return ec.fieldContext_Datum_name(ctx, field)
|
||||
case "dataSensitivity":
|
||||
return ec.fieldContext_Datum_dataSensitivity(ctx, field)
|
||||
case "dataClassification":
|
||||
return ec.fieldContext_Datum_dataClassification(ctx, field)
|
||||
case "owner":
|
||||
return ec.fieldContext_Datum_owner(ctx, field)
|
||||
case "vendors":
|
||||
@@ -36225,7 +36237,7 @@ func (ec *executionContext) unmarshalInputCreateDatumInput(ctx context.Context,
|
||||
asMap[k] = v
|
||||
}
|
||||
|
||||
fieldsInOrder := [...]string{"organizationId", "name", "dataSensitivity", "ownerId", "vendorIds"}
|
||||
fieldsInOrder := [...]string{"organizationId", "name", "dataClassification", "ownerId", "vendorIds"}
|
||||
for _, k := range fieldsInOrder {
|
||||
v, ok := asMap[k]
|
||||
if !ok {
|
||||
@@ -36246,13 +36258,13 @@ func (ec *executionContext) unmarshalInputCreateDatumInput(ctx context.Context,
|
||||
return it, err
|
||||
}
|
||||
it.Name = data
|
||||
case "dataSensitivity":
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("dataSensitivity"))
|
||||
data, err := ec.unmarshalNDataSensitivity2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataSensitivity(ctx, v)
|
||||
case "dataClassification":
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("dataClassification"))
|
||||
data, err := ec.unmarshalNDataClassification2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataClassification(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
it.DataSensitivity = data
|
||||
it.DataClassification = data
|
||||
case "ownerId":
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerId"))
|
||||
data, err := ec.unmarshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v)
|
||||
@@ -38465,7 +38477,7 @@ func (ec *executionContext) unmarshalInputUpdateDatumInput(ctx context.Context,
|
||||
asMap[k] = v
|
||||
}
|
||||
|
||||
fieldsInOrder := [...]string{"id", "name", "dataSensitivity", "ownerId", "vendorIds"}
|
||||
fieldsInOrder := [...]string{"id", "name", "dataClassification", "ownerId", "vendorIds"}
|
||||
for _, k := range fieldsInOrder {
|
||||
v, ok := asMap[k]
|
||||
if !ok {
|
||||
@@ -38486,13 +38498,13 @@ func (ec *executionContext) unmarshalInputUpdateDatumInput(ctx context.Context,
|
||||
return it, err
|
||||
}
|
||||
it.Name = data
|
||||
case "dataSensitivity":
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("dataSensitivity"))
|
||||
data, err := ec.unmarshalODataSensitivity2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataSensitivity(ctx, v)
|
||||
case "dataClassification":
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("dataClassification"))
|
||||
data, err := ec.unmarshalODataClassification2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataClassification(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
it.DataSensitivity = data
|
||||
it.DataClassification = data
|
||||
case "ownerId":
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerId"))
|
||||
data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v)
|
||||
@@ -41109,8 +41121,8 @@ func (ec *executionContext) _Datum(ctx context.Context, sel ast.SelectionSet, ob
|
||||
if out.Values[i] == graphql.Null {
|
||||
atomic.AddUint32(&out.Invalids, 1)
|
||||
}
|
||||
case "dataSensitivity":
|
||||
out.Values[i] = ec._Datum_dataSensitivity(ctx, field, obj)
|
||||
case "dataClassification":
|
||||
out.Values[i] = ec._Datum_dataClassification(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
atomic.AddUint32(&out.Invalids, 1)
|
||||
}
|
||||
@@ -49024,6 +49036,38 @@ func (ec *executionContext) marshalNCursorKey2githubᚗcomᚋgetproboᚋproboᚋ
|
||||
return res
|
||||
}
|
||||
|
||||
func (ec *executionContext) unmarshalNDataClassification2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataClassification(ctx context.Context, v any) (coredata.DataClassification, error) {
|
||||
tmp, err := graphql.UnmarshalString(v)
|
||||
res := unmarshalNDataClassification2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataClassification[tmp]
|
||||
return res, graphql.ErrorOnPath(ctx, err)
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalNDataClassification2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataClassification(ctx context.Context, sel ast.SelectionSet, v coredata.DataClassification) graphql.Marshaler {
|
||||
_ = sel
|
||||
res := graphql.MarshalString(marshalNDataClassification2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataClassification[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 (
|
||||
unmarshalNDataClassification2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataClassification = map[string]coredata.DataClassification{
|
||||
"PUBLIC": coredata.DataClassificationPublic,
|
||||
"INTERNAL": coredata.DataClassificationInternal,
|
||||
"CONFIDENTIAL": coredata.DataClassificationConfidential,
|
||||
"SECRET": coredata.DataClassificationSecret,
|
||||
}
|
||||
marshalNDataClassification2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataClassification = map[coredata.DataClassification]string{
|
||||
coredata.DataClassificationPublic: "PUBLIC",
|
||||
coredata.DataClassificationInternal: "INTERNAL",
|
||||
coredata.DataClassificationConfidential: "CONFIDENTIAL",
|
||||
coredata.DataClassificationSecret: "SECRET",
|
||||
}
|
||||
)
|
||||
|
||||
func (ec *executionContext) unmarshalNDataSensitivity2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataSensitivity(ctx context.Context, v any) (coredata.DataSensitivity, error) {
|
||||
tmp, err := graphql.UnmarshalString(v)
|
||||
res := unmarshalNDataSensitivity2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataSensitivity[tmp]
|
||||
@@ -49171,14 +49215,14 @@ func (ec *executionContext) marshalNDatumOrderField2githubᚗcomᚋgetproboᚋpr
|
||||
|
||||
var (
|
||||
unmarshalNDatumOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDatumOrderField = map[string]coredata.DatumOrderField{
|
||||
"CREATED_AT": coredata.DatumOrderFieldCreatedAt,
|
||||
"NAME": coredata.DatumOrderFieldName,
|
||||
"DATA_SENSITIVITY": coredata.DatumOrderFieldDataSensitivity,
|
||||
"CREATED_AT": coredata.DatumOrderFieldCreatedAt,
|
||||
"NAME": coredata.DatumOrderFieldName,
|
||||
"DATA_CLASSIFICATION": coredata.DatumOrderFieldDataClassification,
|
||||
}
|
||||
marshalNDatumOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDatumOrderField = map[coredata.DatumOrderField]string{
|
||||
coredata.DatumOrderFieldCreatedAt: "CREATED_AT",
|
||||
coredata.DatumOrderFieldName: "NAME",
|
||||
coredata.DatumOrderFieldDataSensitivity: "DATA_SENSITIVITY",
|
||||
coredata.DatumOrderFieldCreatedAt: "CREATED_AT",
|
||||
coredata.DatumOrderFieldName: "NAME",
|
||||
coredata.DatumOrderFieldDataClassification: "DATA_CLASSIFICATION",
|
||||
}
|
||||
)
|
||||
|
||||
@@ -52369,39 +52413,37 @@ func (ec *executionContext) marshalOCursorKey2ᚖgithubᚗcomᚋgetproboᚋprobo
|
||||
return res
|
||||
}
|
||||
|
||||
func (ec *executionContext) unmarshalODataSensitivity2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataSensitivity(ctx context.Context, v any) (*coredata.DataSensitivity, error) {
|
||||
func (ec *executionContext) unmarshalODataClassification2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataClassification(ctx context.Context, v any) (*coredata.DataClassification, error) {
|
||||
if v == nil {
|
||||
return nil, nil
|
||||
}
|
||||
tmp, err := graphql.UnmarshalString(v)
|
||||
res := unmarshalODataSensitivity2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataSensitivity[tmp]
|
||||
res := unmarshalODataClassification2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataClassification[tmp]
|
||||
return &res, graphql.ErrorOnPath(ctx, err)
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalODataSensitivity2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataSensitivity(ctx context.Context, sel ast.SelectionSet, v *coredata.DataSensitivity) graphql.Marshaler {
|
||||
func (ec *executionContext) marshalODataClassification2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataClassification(ctx context.Context, sel ast.SelectionSet, v *coredata.DataClassification) graphql.Marshaler {
|
||||
if v == nil {
|
||||
return graphql.Null
|
||||
}
|
||||
_ = sel
|
||||
_ = ctx
|
||||
res := graphql.MarshalString(marshalODataSensitivity2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataSensitivity[*v])
|
||||
res := graphql.MarshalString(marshalODataClassification2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataClassification[*v])
|
||||
return res
|
||||
}
|
||||
|
||||
var (
|
||||
unmarshalODataSensitivity2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataSensitivity = map[string]coredata.DataSensitivity{
|
||||
"NONE": coredata.DataSensitivityNone,
|
||||
"LOW": coredata.DataSensitivityLow,
|
||||
"MEDIUM": coredata.DataSensitivityMedium,
|
||||
"HIGH": coredata.DataSensitivityHigh,
|
||||
"CRITICAL": coredata.DataSensitivityCritical,
|
||||
unmarshalODataClassification2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataClassification = map[string]coredata.DataClassification{
|
||||
"PUBLIC": coredata.DataClassificationPublic,
|
||||
"INTERNAL": coredata.DataClassificationInternal,
|
||||
"CONFIDENTIAL": coredata.DataClassificationConfidential,
|
||||
"SECRET": coredata.DataClassificationSecret,
|
||||
}
|
||||
marshalODataSensitivity2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataSensitivity = map[coredata.DataSensitivity]string{
|
||||
coredata.DataSensitivityNone: "NONE",
|
||||
coredata.DataSensitivityLow: "LOW",
|
||||
coredata.DataSensitivityMedium: "MEDIUM",
|
||||
coredata.DataSensitivityHigh: "HIGH",
|
||||
coredata.DataSensitivityCritical: "CRITICAL",
|
||||
marshalODataClassification2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataClassification = map[coredata.DataClassification]string{
|
||||
coredata.DataClassificationPublic: "PUBLIC",
|
||||
coredata.DataClassificationInternal: "INTERNAL",
|
||||
coredata.DataClassificationConfidential: "CONFIDENTIAL",
|
||||
coredata.DataClassificationSecret: "SECRET",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
// 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 types
|
||||
|
||||
import (
|
||||
@@ -7,12 +21,12 @@ import (
|
||||
|
||||
func NewDatum(d *coredata.Data) *Datum {
|
||||
return &Datum{
|
||||
ID: d.ID,
|
||||
Name: d.Name,
|
||||
DataSensitivity: d.DataSensitivity,
|
||||
CreatedAt: d.CreatedAt,
|
||||
UpdatedAt: d.UpdatedAt,
|
||||
Organization: &Organization{ID: d.OrganizationID},
|
||||
ID: d.ID,
|
||||
Name: d.Name,
|
||||
DataClassification: d.DataClassification,
|
||||
CreatedAt: d.CreatedAt,
|
||||
UpdatedAt: d.UpdatedAt,
|
||||
Organization: &Organization{ID: d.OrganizationID},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -176,11 +176,11 @@ type CreateControlPayload struct {
|
||||
}
|
||||
|
||||
type CreateDatumInput struct {
|
||||
OrganizationID gid.GID `json:"organizationId"`
|
||||
Name string `json:"name"`
|
||||
DataSensitivity coredata.DataSensitivity `json:"dataSensitivity"`
|
||||
OwnerID gid.GID `json:"ownerId"`
|
||||
VendorIds []gid.GID `json:"vendorIds,omitempty"`
|
||||
OrganizationID gid.GID `json:"organizationId"`
|
||||
Name string `json:"name"`
|
||||
DataClassification coredata.DataClassification `json:"dataClassification"`
|
||||
OwnerID gid.GID `json:"ownerId"`
|
||||
VendorIds []gid.GID `json:"vendorIds,omitempty"`
|
||||
}
|
||||
|
||||
type CreateDatumPayload struct {
|
||||
@@ -357,14 +357,14 @@ type CreateVendorRiskAssessmentPayload struct {
|
||||
}
|
||||
|
||||
type Datum struct {
|
||||
ID gid.GID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
DataSensitivity coredata.DataSensitivity `json:"dataSensitivity"`
|
||||
Owner *People `json:"owner"`
|
||||
Vendors *VendorConnection `json:"vendors"`
|
||||
Organization *Organization `json:"organization"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
ID gid.GID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
DataClassification coredata.DataClassification `json:"dataClassification"`
|
||||
Owner *People `json:"owner"`
|
||||
Vendors *VendorConnection `json:"vendors"`
|
||||
Organization *Organization `json:"organization"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
}
|
||||
|
||||
func (Datum) IsNode() {}
|
||||
@@ -972,11 +972,11 @@ type UpdateControlPayload struct {
|
||||
}
|
||||
|
||||
type UpdateDatumInput struct {
|
||||
ID gid.GID `json:"id"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
DataSensitivity *coredata.DataSensitivity `json:"dataSensitivity,omitempty"`
|
||||
OwnerID *gid.GID `json:"ownerId,omitempty"`
|
||||
VendorIds []gid.GID `json:"vendorIds,omitempty"`
|
||||
ID gid.GID `json:"id"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
DataClassification *coredata.DataClassification `json:"dataClassification,omitempty"`
|
||||
OwnerID *gid.GID `json:"ownerId,omitempty"`
|
||||
VendorIds []gid.GID `json:"vendorIds,omitempty"`
|
||||
}
|
||||
|
||||
type UpdateDatumPayload struct {
|
||||
|
||||
@@ -1844,11 +1844,11 @@ func (r *mutationResolver) CreateDatum(ctx context.Context, input types.CreateDa
|
||||
svc := GetTenantService(ctx, r.proboSvc, input.OrganizationID.TenantID())
|
||||
|
||||
data, err := svc.Data.Create(ctx, probo.CreateDatumRequest{
|
||||
OrganizationID: input.OrganizationID,
|
||||
Name: input.Name,
|
||||
DataSensitivity: input.DataSensitivity,
|
||||
OwnerID: input.OwnerID,
|
||||
VendorIDs: input.VendorIds,
|
||||
OrganizationID: input.OrganizationID,
|
||||
Name: input.Name,
|
||||
DataClassification: input.DataClassification,
|
||||
OwnerID: input.OwnerID,
|
||||
VendorIDs: input.VendorIds,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
@@ -1865,11 +1865,11 @@ func (r *mutationResolver) UpdateDatum(ctx context.Context, input types.UpdateDa
|
||||
svc := GetTenantService(ctx, r.proboSvc, input.ID.TenantID())
|
||||
|
||||
datum, err := svc.Data.Update(ctx, probo.UpdateDatumRequest{
|
||||
ID: input.ID,
|
||||
Name: input.Name,
|
||||
DataSensitivity: input.DataSensitivity,
|
||||
OwnerID: input.OwnerID,
|
||||
VendorIDs: input.VendorIds,
|
||||
ID: input.ID,
|
||||
Name: input.Name,
|
||||
DataClassification: input.DataClassification,
|
||||
OwnerID: input.OwnerID,
|
||||
VendorIDs: input.VendorIds,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user