Skip to content

Commit d67da8d

Browse files
authored
Update 4-schema-design.md (#76)
- Use non-obsolete `ExtendObjectTypeAttribute` constructor - `AddSessionPayload` inherits from `SessionPayloadBase` instead of `Payload`
1 parent 9cf7c01 commit d67da8d

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

docs/4-schema-design.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Now, that we have some base classes for our mutation let us start to reorganize
7979

8080
namespace ConferencePlanner.GraphQL.Speakers
8181
{
82-
[ExtendObjectType(Name = "Mutation")]
82+
[ExtendObjectType("Mutation")]
8383
public class SpeakerMutations
8484
{
8585
[UseApplicationDbContext]
@@ -584,7 +584,7 @@ We will start by adding the rest of the DataLoader that we will need. Then we wi
584584

585585
1. Move the `Query.cs` to the `Speakers` directory and rename it to `SpeakerQueries.cs`.
586586

587-
1. Next, add the `[ExtendObjectType(Name = "Query")]` on top of our `SpeakerQueries` class. The code should now look like the following.
587+
1. Next, add the `[ExtendObjectType("Query")]` on top of our `SpeakerQueries` class. The code should now look like the following.
588588

589589
```csharp
590590
using System.Collections.Generic;
@@ -599,7 +599,7 @@ We will start by adding the rest of the DataLoader that we will need. Then we wi
599599

600600
namespace ConferencePlanner.GraphQL.Speakers
601601
{
602-
[ExtendObjectType(Name = "Query")]
602+
[ExtendObjectType("Query")]
603603
public class SpeakerQueries
604604
{
605605
[UseApplicationDbContext]
@@ -717,19 +717,20 @@ mkdir GraphQL/Sessions
717717

718718
namespace ConferencePlanner.GraphQL.Sessions
719719
{
720-
public class AddSessionPayload : Payload
720+
public class AddSessionPayload : SessionPayloadBase
721721
{
722-
public AddSessionPayload(Session session)
722+
public AddSessionPayload(UserError error)
723+
: base(new[] { error })
723724
{
724-
Session = session;
725725
}
726726

727-
public AddSessionPayload(UserError error)
728-
: base(new[] { error })
727+
public AddSessionPayload(Session session) : base(session)
729728
{
730729
}
731730

732-
public Session? Session { get; }
731+
public AddSessionPayload(IReadOnlyList<UserError> errors) : base(errors)
732+
{
733+
}
733734
}
734735
}
735736
```
@@ -746,7 +747,7 @@ mkdir GraphQL/Sessions
746747

747748
namespace ConferencePlanner.GraphQL.Sessions
748749
{
749-
[ExtendObjectType(Name = "Mutation")]
750+
[ExtendObjectType("Mutation")]
750751
public class SessionMutations
751752
{
752753
[UseApplicationDbContext]
@@ -1001,7 +1002,7 @@ mkdir GraphQL/Sessions
10011002

10021003
namespace ConferencePlanner.GraphQL.Tracks
10031004
{
1004-
[ExtendObjectType(Name = "Mutation")]
1005+
[ExtendObjectType("Mutation")]
10051006
public class TrackMutations
10061007
{
10071008
[UseApplicationDbContext]
@@ -1141,7 +1142,7 @@ In this section, we will optimize our `Query` type by bringing in more fields to
11411142

11421143
namespace ConferencePlanner.GraphQL.Speakers
11431144
{
1144-
[ExtendObjectType(Name = "Query")]
1145+
[ExtendObjectType("Query")]
11451146
public class SpeakerQueries
11461147
{
11471148
[UseApplicationDbContext]
@@ -1175,7 +1176,7 @@ In this section, we will optimize our `Query` type by bringing in more fields to
11751176

11761177
namespace ConferencePlanner.GraphQL.Speakers
11771178
{
1178-
[ExtendObjectType(Name = "Query")]
1179+
[ExtendObjectType("Query")]
11791180
public class SpeakerQueries
11801181
{
11811182
[UseApplicationDbContext]
@@ -1213,7 +1214,7 @@ In this section, we will optimize our `Query` type by bringing in more fields to
12131214

12141215
namespace ConferencePlanner.GraphQL.Sessions
12151216
{
1216-
[ExtendObjectType(Name = "Query")]
1217+
[ExtendObjectType("Query")]
12171218
public class SessionQueries
12181219
{
12191220
[UseApplicationDbContext]
@@ -1272,7 +1273,7 @@ In this section, we will optimize our `Query` type by bringing in more fields to
12721273

12731274
namespace ConferencePlanner.GraphQL.Tracks
12741275
{
1275-
[ExtendObjectType(Name = "Query")]
1276+
[ExtendObjectType("Query")]
12761277
public class TrackQueries
12771278
{
12781279
[UseApplicationDbContext]

0 commit comments

Comments
 (0)