Unpublished content through GraphQL

Hello!

I’ve been playing around with the “Unpublished” functionality a bit. For the REST-endpoints everything works well, with the unpublished content being returned under the dataDraft-property. For the GraphQL-endpoints however, things are a little bit more problematic.

Adding the Unpublished header does not affect the returned data, i.e. only published content is returned. After some debugging I think I have found the reason. The unpublished content is actually fetched from the contentRepository, and the contentEntity contains the unpublished data in the dataDraft-property as it should. However, there does not seem to be any mapping for GraphQL in the ContentGraphType for the dataDraft-property.

So i tried adding the following code in Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.ContentGraphType, right below where the ordinary data-property is mapped:

            AddField(new FieldType
            {
                Name = "dataDraft",
                ResolvedType = new NonNullGraphType(contentDataType),
                Resolver = Resolve(x => x.DataDraft),
                Description = $"The draft data of the {schemaName} content."
            });

This change enabled me to fetch unpublished content through GraphQL by using the dataDraft property in my queries. Is this change something that is PR-worthy or will this brake something else that I might have overlooked?

I went ahead and and made a PR just to clarify the fix that made it work:

Thank you very much.