Skip to content

Commit

Permalink
Merge pull request #111 from Research-Institute/develop
Browse files Browse the repository at this point in the history
v2.0.6
  • Loading branch information
jaredcnance authored May 16, 2017
2 parents 2f3b618 + f765d74 commit 748ce06
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
4 changes: 2 additions & 2 deletions docs/Errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public override async Task<IActionResult> PostAsync([FromBody] MyEntity entity)
return Error(new CustomError("507", "Database is full.", "Theres no more room.", "Sorry."));

if(model.Validations.IsValid == false)
return Errors(model.Validations.Select(v => v.GetErrors()));
return Errors(model.Validations.GetErrors());

// ...
}
```
4 changes: 2 additions & 2 deletions src/JsonApiDotNetCore/Controllers/JsonApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ public virtual async Task<IActionResult> GetAsync(TId id)
[HttpGet("{id}/relationships/{relationshipName}")]
public virtual async Task<IActionResult> GetRelationshipsAsync(TId id, string relationshipName)
{
var relationship = _resourceService.GetRelationshipsAsync(id, relationshipName);
var relationship = await _resourceService.GetRelationshipsAsync(id, relationshipName);
if(relationship == null)
return NotFound();

return await GetRelationshipAsync(id, relationshipName);
return Ok(relationship);
}

[HttpGet("{id}/{relationshipName}")]
Expand Down
9 changes: 3 additions & 6 deletions src/JsonApiDotNetCore/Data/DefaultEntityRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public virtual IQueryable<TEntity> Get()
{
if(_jsonApiContext.QuerySet?.Fields != null && _jsonApiContext.QuerySet.Fields.Any())
return _dbSet.Select(_jsonApiContext.QuerySet?.Fields);

return _dbSet;
}

Expand Down Expand Up @@ -92,12 +92,9 @@ public virtual async Task<TEntity> GetAndIncludeAsync(TId id, string relationshi

var result = await Get()
.Include(relationshipName)
.Where(e => e.Id.Equals(id))
.ToListAsync();

_logger.LogDebug($"[JADN] Found {result.Count} entity");
.SingleOrDefaultAsync(e => e.Id.Equals(id));

return result.SingleOrDefault();
return result;
}

public virtual async Task<TEntity> CreateAsync(TEntity entity)
Expand Down
2 changes: 1 addition & 1 deletion src/JsonApiDotNetCore/JsonApiDotNetCore.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<VersionPrefix>2.0.5</VersionPrefix>
<VersionPrefix>2.0.6</VersionPrefix>
<TargetFrameworks>netstandard1.6</TargetFrameworks>
<AssemblyName>JsonApiDotNetCore</AssemblyName>
<PackageId>JsonApiDotNetCore</PackageId>
Expand Down

0 comments on commit 748ce06

Please sign in to comment.