Skip to content

Commit c4a3cbe

Browse files
committed
refactor(controller): inherit from mixin
1 parent 5dcd131 commit c4a3cbe

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

src/JsonApiDotNetCore/Controllers/JsonApiController.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System.Threading.Tasks;
44
using JsonApiDotNetCore.Data;
55
using JsonApiDotNetCore.Extensions;
6-
using JsonApiDotNetCore.Internal.Query;
76
using JsonApiDotNetCore.Models;
87
using JsonApiDotNetCore.Services;
98
using Microsoft.AspNetCore.Mvc;
@@ -25,7 +24,7 @@ public JsonApiController(
2524
}
2625

2726
public class JsonApiController<T, TId>
28-
: Controller where T : class, IIdentifiable<TId>
27+
: JsonApiControllerMixin where T : class, IIdentifiable<TId>
2928
{
3029
private readonly IEntityRepository<T, TId> _entities;
3130
private readonly IJsonApiContext _jsonApiContext;
@@ -189,10 +188,5 @@ private IQueryable<T> IncludeRelationships(IQueryable<T> entities, List<string>
189188

190189
return entities;
191190
}
192-
193-
protected IActionResult UnprocessableEntity()
194-
{
195-
return new StatusCodeResult(422);
196-
}
197191
}
198192
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
3+
namespace JsonApiDotNetCore.Controllers
4+
{
5+
public class JsonApiControllerMixin : Controller
6+
{
7+
public JsonApiControllerMixin()
8+
{ }
9+
10+
protected IActionResult UnprocessableEntity()
11+
{
12+
return new StatusCodeResult(422);
13+
}
14+
}
15+
}

0 commit comments

Comments
 (0)