Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 54aee7e

Browse files
Merge branch 'feature/umbraco-forms' into develop
2 parents 50cc2cc + 6165ea4 commit 54aee7e

File tree

5 files changed

+16
-12
lines changed

5 files changed

+16
-12
lines changed

‎Our.Umbraco.GraphQL.Forms/Types/DataSourcesDataQuery.cs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Our.Umbraco.GraphQL.Attributes;
2+
using Our.Umbraco.GraphQL.Types;
23
using System;
34
using System.Collections.Generic;
45
using Umbraco.Forms.Core;
@@ -10,6 +11,6 @@ public class DataSourcesDataQuery
1011
{
1112
public IEnumerable<FormDataSource> All([Inject] IDataSourceStorage dataSourceStorage) => dataSourceStorage.GetAllDataSources();
1213

13-
public FormDataSource ById([Inject] IDataSourceStorage dataSourceStorage, string id) => Guid.TryParse(id, out var guid) ? dataSourceStorage.GetDataSource(guid) : null;
14+
public FormDataSource ById([Inject] IDataSourceStorage dataSourceStorage, Id id) => Guid.TryParse(id.Value, out var guid) ? dataSourceStorage.GetDataSource(guid) : null;
1415
}
1516
}

‎Our.Umbraco.GraphQL.Forms/Types/FormsDataQuery.cs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Our.Umbraco.GraphQL.Attributes;
2+
using Our.Umbraco.GraphQL.Types;
23
using System;
34
using System.Collections.Generic;
45
using Umbraco.Forms.Core.Data.Storage;
@@ -10,7 +11,7 @@ public class FormsDataQuery
1011
{
1112
public IEnumerable<Form> All([Inject] IFormStorage formStorage) => formStorage.GetAllForms();
1213

13-
public Form ById([Inject] IFormStorage formStorage, string id) => Guid.TryParse(id, out var formId) ? formStorage.GetForm(formId) : null;
14+
public Form ById([Inject] IFormStorage formStorage, Id id) => Guid.TryParse(id.Value, out var formId) ? formStorage.GetForm(formId) : null;
1415

1516
public Form ByName([Inject] IFormStorage formStorage, string name) => formStorage.GetForm(name);
1617
}

‎Our.Umbraco.GraphQL.Forms/Types/PreValueSourcesDataQuery.cs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Our.Umbraco.GraphQL.Attributes;
2+
using Our.Umbraco.GraphQL.Types;
23
using System;
34
using System.Collections.Generic;
45
using Umbraco.Forms.Core.Interfaces;
@@ -10,6 +11,6 @@ public class PreValueSourcesDataQuery
1011
{
1112
public IEnumerable<IFieldPreValueSource> All([Inject] IPrevalueSourceStorage prevalueSourceStorage) => prevalueSourceStorage.GetAllPrevalueSources();
1213

13-
public IFieldPreValueSource ById([Inject] IPrevalueSourceStorage prevalueSourceStorage, string id) => Guid.TryParse(id, out var guid) ? prevalueSourceStorage.GetPrevalueSource(guid) : null;
14+
public IFieldPreValueSource ById([Inject] IPrevalueSourceStorage prevalueSourceStorage, Id id) => Guid.TryParse(id.Value, out var guid) ? prevalueSourceStorage.GetPrevalueSource(guid) : null;
1415
}
1516
}

‎Our.Umbraco.GraphQL.Forms/Types/UmbracoFormsMutation.cs‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public UmbracoFormsMutation(ILogger logger, IFormStorage formStorage, IFieldType
3737

3838
Field<JsonGraphType>()
3939
.Name("submit")
40-
.Argument<NonNullGraphType<StringGraphType>>("formId", "The GUID of the form")
41-
.Argument<NonNullGraphType<Adapters.Types.IdGraphType>>("umbracoPageId", "The integer ID of the Umbraco page you were on")
40+
.Argument<NonNullGraphType<Adapters.Types.IdGraphType>>("formId", "The GUID of the form")
41+
.Argument<NonNullGraphType<Adapters.Types.IdGraphType>>("umbracoPageId", "The integer ID of the Umbraco page you were on")
4242
.Argument<ListGraphType<FieldValueInputType>>("fields", "An array of objects representing the field data. Each object has a 'field' property that is either the GUID or alias of the form field, and a 'value' property that is the field value")
4343
.Resolve(Submit);
4444
_logger = logger;
@@ -52,12 +52,12 @@ public UmbracoFormsMutation(ILogger logger, IFormStorage formStorage, IFieldType
5252
private object Submit(ResolveFieldContext<object> ctx)
5353
{
5454
string formIdArg = null;
55-
Id umbracoPageId = null;
55+
string umbracoPageId = null;
5656

5757
try
5858
{
59-
formIdArg = ctx.GetArgument<string>("formId");
60-
umbracoPageId = ctx.GetArgument<Id>("umbracoPageId");
59+
formIdArg = ctx.GetArgument<Id>("formId").Value;
60+
umbracoPageId = ctx.GetArgument<Id>("umbracoPageId").Value;
6161
var fieldsList = ctx.GetArgument<List<FieldValue>>("fields");
6262

6363
if (!Guid.TryParse(formIdArg, out var formId) || !(_formStorage.GetForm(formId) is Form form)) return SubmitResult("The form ID specified could not be found");
@@ -74,9 +74,9 @@ private object Submit(ResolveFieldContext<object> ctx)
7474
using (var ucRef = _umbracoContextFactory.EnsureUmbracoContext(contextWrapped))
7575
{
7676
var uc = ucRef.UmbracoContext;
77-
var page = Guid.TryParse(umbracoPageId.Value, out var guid) ? uc.Content.GetById(guid)
78-
: (int.TryParse(umbracoPageId.Value, out var id) ? uc.Content.GetById(id)
79-
: (GuidUdi.TryParse(umbracoPageId.Value, out var udi) ? uc.Content.GetById(udi.Guid) : null));
77+
var page = Guid.TryParse(umbracoPageId, out var guid) ? uc.Content.GetById(guid)
78+
: (int.TryParse(umbracoPageId, out var id) ? uc.Content.GetById(id)
79+
: (GuidUdi.TryParse(umbracoPageId, out var udi) ? uc.Content.GetById(udi.Guid) : null));
8080
if (page == null) return SubmitResult("Could not find the umbracoPageId specified");
8181

8282
var url = page.Url;

‎Our.Umbraco.GraphQL.Forms/Types/WorkflowsDataQuery.cs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Our.Umbraco.GraphQL.Attributes;
2+
using Our.Umbraco.GraphQL.Types;
23
using System;
34
using System.Collections.Generic;
45
using Umbraco.Forms.Core.Data.Storage;
@@ -10,6 +11,6 @@ public class WorkflowsDataQuery
1011
{
1112
public IEnumerable<IWorkflow> All([Inject] IWorkflowStorage workflowStorage) => workflowStorage.GetAllWorkFlows();
1213

13-
public IWorkflow ById([Inject] IWorkflowStorage workflowStorage, string id) => Guid.TryParse(id, out var guid) ? workflowStorage.GetWorkflow(guid) : null;
14+
public IWorkflow ById([Inject] IWorkflowStorage workflowStorage, Id id) => Guid.TryParse(id.Value, out var guid) ? workflowStorage.GetWorkflow(guid) : null;
1415
}
1516
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /