diff --git a/apps/console/src/pages/VendorOverviewPage.tsx b/apps/console/src/pages/VendorOverviewPage.tsx index ae052a213..319b5a655 100644 --- a/apps/console/src/pages/VendorOverviewPage.tsx +++ b/apps/console/src/pages/VendorOverviewPage.tsx @@ -28,6 +28,7 @@ const vendorOverviewPageQuery = graphql` serviceCriticality riskTier statusPageUrl + termsOfServiceUrl createdAt updatedAt } @@ -210,6 +211,24 @@ function VendorOverviewPageContent({ )} + + {data.node.termsOfServiceUrl && ( +
+
+ + +
+ + View Terms of Service + + +
+ )} diff --git a/apps/console/src/pages/__generated__/VendorOverviewPageQuery.graphql.ts b/apps/console/src/pages/__generated__/VendorOverviewPageQuery.graphql.ts index 8205e10a8..f6bb182db 100644 --- a/apps/console/src/pages/__generated__/VendorOverviewPageQuery.graphql.ts +++ b/apps/console/src/pages/__generated__/VendorOverviewPageQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<5e9e499f91b8d971375b191b9ce35f5d>> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -25,6 +25,7 @@ export type VendorOverviewPageQuery$data = { readonly serviceStartDate?: any; readonly serviceTerminationDate?: any | null | undefined; readonly statusPageUrl?: string | null | undefined; + readonly termsOfServiceUrl?: string | null | undefined; readonly updatedAt?: any; }; }; @@ -108,10 +109,17 @@ v10 = { "alias": null, "args": null, "kind": "ScalarField", - "name": "createdAt", + "name": "termsOfServiceUrl", "storageKey": null }, v11 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "createdAt", + "storageKey": null +}, +v12 = { "alias": null, "args": null, "kind": "ScalarField", @@ -145,7 +153,8 @@ return { (v8/*: any*/), (v9/*: any*/), (v10/*: any*/), - (v11/*: any*/) + (v11/*: any*/), + (v12/*: any*/) ], "type": "Vendor", "abstractKey": null @@ -190,7 +199,8 @@ return { (v8/*: any*/), (v9/*: any*/), (v10/*: any*/), - (v11/*: any*/) + (v11/*: any*/), + (v12/*: any*/) ], "type": "Vendor", "abstractKey": null @@ -201,16 +211,16 @@ return { ] }, "params": { - "cacheID": "04e4ae3f0c7613bf50b59368d02ba937", + "cacheID": "37f7dba24b43c13a4e5467dd58fdfcd6", "id": null, "metadata": {}, "name": "VendorOverviewPageQuery", "operationKind": "query", - "text": "query VendorOverviewPageQuery(\n $vendorId: ID!\n) {\n node(id: $vendorId) {\n __typename\n ... on Vendor {\n id\n name\n description\n serviceStartDate\n serviceTerminationDate\n serviceCriticality\n riskTier\n statusPageUrl\n createdAt\n updatedAt\n }\n id\n }\n}\n" + "text": "query VendorOverviewPageQuery(\n $vendorId: ID!\n) {\n node(id: $vendorId) {\n __typename\n ... on Vendor {\n id\n name\n description\n serviceStartDate\n serviceTerminationDate\n serviceCriticality\n riskTier\n statusPageUrl\n termsOfServiceUrl\n createdAt\n updatedAt\n }\n id\n }\n}\n" } }; })(); -(node as any).hash = "474b8b7350d917a50c91a0b8239370ea"; +(node as any).hash = "86f10af28dac38699127a302a42aca12"; export default node; diff --git a/pkg/api/console/v1/schema.graphql b/pkg/api/console/v1/schema.graphql index cc0973182..c39c7f5b2 100644 --- a/pkg/api/console/v1/schema.graphql +++ b/pkg/api/console/v1/schema.graphql @@ -123,6 +123,7 @@ type Vendor implements Node { serviceCriticality: ServiceCriticality! riskTier: RiskTier! statusPageUrl: String + termsOfServiceUrl: String } type FrameworkConnection { @@ -358,4 +359,5 @@ input UpdateVendorInput { serviceCriticality: ServiceCriticality riskTier: RiskTier statusPageUrl: String + termsOfServiceUrl: String } \ No newline at end of file diff --git a/pkg/api/console/v1/schema/schema.go b/pkg/api/console/v1/schema/schema.go index c5e1561e7..e47d7f2c8 100644 --- a/pkg/api/console/v1/schema/schema.go +++ b/pkg/api/console/v1/schema/schema.go @@ -254,6 +254,7 @@ type ComplexityRoot struct { ServiceStartDate func(childComplexity int) int ServiceTerminationDate func(childComplexity int) int StatusPageURL func(childComplexity int) int + TermsOfServiceURL func(childComplexity int) int UpdatedAt func(childComplexity int) int } @@ -1184,6 +1185,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Vendor.StatusPageURL(childComplexity), true + case "Vendor.termsOfServiceUrl": + if e.complexity.Vendor.TermsOfServiceURL == nil { + break + } + + return e.complexity.Vendor.TermsOfServiceURL(childComplexity), true + case "Vendor.updatedAt": if e.complexity.Vendor.UpdatedAt == nil { break @@ -1454,6 +1462,7 @@ type Vendor implements Node { serviceCriticality: ServiceCriticality! riskTier: RiskTier! statusPageUrl: String + termsOfServiceUrl: String } type FrameworkConnection { @@ -1689,6 +1698,7 @@ input UpdateVendorInput { serviceCriticality: ServiceCriticality riskTier: RiskTier statusPageUrl: String + termsOfServiceUrl: String }`, BuiltIn: false}, } var parsedSchema = gqlparser.MustLoadSchema(sources...) @@ -4917,6 +4927,8 @@ func (ec *executionContext) fieldContext_Mutation_createVendor(ctx context.Conte return ec.fieldContext_Vendor_riskTier(ctx, field) case "statusPageUrl": return ec.fieldContext_Vendor_statusPageUrl(ctx, field) + case "termsOfServiceUrl": + return ec.fieldContext_Vendor_termsOfServiceUrl(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Vendor", field.Name) }, @@ -7451,6 +7463,41 @@ func (ec *executionContext) fieldContext_Vendor_statusPageUrl(_ context.Context, return fc, nil } +func (ec *executionContext) _Vendor_termsOfServiceUrl(ctx context.Context, field graphql.CollectedField, obj *types.Vendor) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Vendor_termsOfServiceUrl(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.TermsOfServiceURL, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2áš–string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Vendor_termsOfServiceUrl(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Vendor", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _VendorConnection_edges(ctx context.Context, field graphql.CollectedField, obj *types.VendorConnection) (ret graphql.Marshaler) { fc, err := ec.fieldContext_VendorConnection_edges(ctx, field) if err != nil { @@ -7634,6 +7681,8 @@ func (ec *executionContext) fieldContext_VendorEdge_node(_ context.Context, fiel return ec.fieldContext_Vendor_riskTier(ctx, field) case "statusPageUrl": return ec.fieldContext_Vendor_statusPageUrl(ctx, field) + case "termsOfServiceUrl": + return ec.fieldContext_Vendor_termsOfServiceUrl(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Vendor", field.Name) }, @@ -9342,7 +9391,7 @@ func (ec *executionContext) unmarshalInputUpdateVendorInput(ctx context.Context, asMap[k] = v } - fieldsInOrder := [...]string{"id", "name", "description", "serviceStartDate", "serviceTerminationDate", "serviceCriticality", "riskTier", "statusPageUrl"} + fieldsInOrder := [...]string{"id", "name", "description", "serviceStartDate", "serviceTerminationDate", "serviceCriticality", "riskTier", "statusPageUrl", "termsOfServiceUrl"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -9405,6 +9454,13 @@ func (ec *executionContext) unmarshalInputUpdateVendorInput(ctx context.Context, return it, err } it.StatusPageURL = data + case "termsOfServiceUrl": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("termsOfServiceUrl")) + data, err := ec.unmarshalOString2áš–string(ctx, v) + if err != nil { + return it, err + } + it.TermsOfServiceURL = data } } @@ -11263,6 +11319,8 @@ func (ec *executionContext) _Vendor(ctx context.Context, sel ast.SelectionSet, o } case "statusPageUrl": out.Values[i] = ec._Vendor_statusPageUrl(ctx, field, obj) + case "termsOfServiceUrl": + out.Values[i] = ec._Vendor_termsOfServiceUrl(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } diff --git a/pkg/api/console/v1/types/types.go b/pkg/api/console/v1/types/types.go index 9606fea19..94b696d50 100644 --- a/pkg/api/console/v1/types/types.go +++ b/pkg/api/console/v1/types/types.go @@ -247,6 +247,7 @@ type UpdateVendorInput struct { ServiceCriticality *coredata.ServiceCriticality `json:"serviceCriticality,omitempty"` RiskTier *coredata.RiskTier `json:"riskTier,omitempty"` StatusPageURL *string `json:"statusPageUrl,omitempty"` + TermsOfServiceURL *string `json:"termsOfServiceUrl,omitempty"` } type Vendor struct { @@ -260,6 +261,7 @@ type Vendor struct { ServiceCriticality coredata.ServiceCriticality `json:"serviceCriticality"` RiskTier coredata.RiskTier `json:"riskTier"` StatusPageURL *string `json:"statusPageUrl,omitempty"` + TermsOfServiceURL *string `json:"termsOfServiceUrl,omitempty"` } func (Vendor) IsNode() {} diff --git a/pkg/api/console/v1/types/vendor.go b/pkg/api/console/v1/types/vendor.go index 47b25c0c5..1d2669fa8 100644 --- a/pkg/api/console/v1/types/vendor.go +++ b/pkg/api/console/v1/types/vendor.go @@ -51,5 +51,6 @@ func NewVendor(v *coredata.Vendor) *Vendor { ServiceCriticality: v.ServiceCriticality, RiskTier: v.RiskTier, StatusPageURL: v.StatusPageURL, + TermsOfServiceURL: v.TermsOfServiceURL, } } diff --git a/pkg/probo/coredata/migrations/20250218T113200Z.sql b/pkg/probo/coredata/migrations/20250218T113200Z.sql new file mode 100644 index 000000000..bc89f0d39 --- /dev/null +++ b/pkg/probo/coredata/migrations/20250218T113200Z.sql @@ -0,0 +1 @@ +ALTER TABLE vendors ADD COLUMN terms_of_service_url TEXT; diff --git a/pkg/probo/coredata/vendor.go b/pkg/probo/coredata/vendor.go index 6841e927a..5d86c0c52 100644 --- a/pkg/probo/coredata/vendor.go +++ b/pkg/probo/coredata/vendor.go @@ -37,6 +37,7 @@ type ( ServiceCriticality ServiceCriticality RiskTier RiskTier StatusPageURL *string + TermsOfServiceURL *string CreatedAt time.Time UpdatedAt time.Time } @@ -59,6 +60,7 @@ func (v *Vendor) scan(r pgx.Row) error { &v.ServiceCriticality, &v.RiskTier, &v.StatusPageURL, + &v.TermsOfServiceURL, &v.CreatedAt, &v.UpdatedAt, ) @@ -81,6 +83,7 @@ SELECT service_criticality, risk_tier, status_page_url, + terms_of_service_url, created_at, updated_at FROM @@ -124,6 +127,7 @@ INSERT INTO service_criticality, risk_tier, status_page_url, + terms_of_service_url, created_at, updated_at ) @@ -137,6 +141,7 @@ VALUES ( @service_criticality, @risk_tier, @status_page_url, + @terms_of_service_url, @created_at, @updated_at ) @@ -152,6 +157,7 @@ VALUES ( "service_criticality": v.ServiceCriticality, "risk_tier": v.RiskTier, "status_page_url": v.StatusPageURL, + "terms_of_service_url": v.TermsOfServiceURL, "created_at": v.CreatedAt, "updated_at": v.UpdatedAt, } @@ -195,6 +201,7 @@ SELECT service_criticality, risk_tier, status_page_url, + terms_of_service_url, created_at, updated_at FROM