mirror of https://github.com/Squidex/squidex.git
12 changed files with 126 additions and 42 deletions
@ -0,0 +1,37 @@ |
|||
// ==========================================================================
|
|||
// GeolocationScalarType.cs
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex Group
|
|||
// All rights reserved.
|
|||
// ==========================================================================
|
|||
|
|||
using GraphQL.Language.AST; |
|||
using GraphQL.Types; |
|||
using Newtonsoft.Json.Linq; |
|||
|
|||
namespace Squidex.Domain.Apps.Read.Contents.GraphQL.Types |
|||
{ |
|||
public sealed class GeolocationScalarType : ScalarGraphType |
|||
{ |
|||
public GeolocationScalarType() |
|||
{ |
|||
Name = "Json"; |
|||
} |
|||
|
|||
public override object Serialize(object value) |
|||
{ |
|||
return value; |
|||
} |
|||
|
|||
public override object ParseValue(object value) |
|||
{ |
|||
return value != null ? value is JObject ? value : JObject.FromObject(value) : null; |
|||
} |
|||
|
|||
public override object ParseLiteral(IValue value) |
|||
{ |
|||
return null; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,37 @@ |
|||
// ==========================================================================
|
|||
// JsonScalarType.cs
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex Group
|
|||
// All rights reserved.
|
|||
// ==========================================================================
|
|||
|
|||
using GraphQL.Language.AST; |
|||
using GraphQL.Types; |
|||
using Newtonsoft.Json.Linq; |
|||
|
|||
namespace Squidex.Domain.Apps.Read.Contents.GraphQL.Types |
|||
{ |
|||
public sealed class JsonScalarType : ScalarGraphType |
|||
{ |
|||
public JsonScalarType() |
|||
{ |
|||
Name = "Json"; |
|||
} |
|||
|
|||
public override object Serialize(object value) |
|||
{ |
|||
return value; |
|||
} |
|||
|
|||
public override object ParseValue(object value) |
|||
{ |
|||
return value != null ? value is JObject ? value : JObject.FromObject(value) : null; |
|||
} |
|||
|
|||
public override object ParseLiteral(IValue value) |
|||
{ |
|||
return null; |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue