Skip to content

Commit 404f77a

Browse files
authored
Merge pull request #11 from Mathavana/develop
Develop - API Project structure changed
2 parents d6f6371 + 77cc38a commit 404f77a

29 files changed

+202
-348
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
| Branch | CircleCi |
44
| ------ | ------ |
5-
| master | ![CircleCI branch](https://img.shields.io/circleci/project/github/Mathavana/asp_net_core_api/master.svg?style=popout) |
6-
| develop | ![CircleCI branch](https://img.shields.io/circleci/project/github/Mathavana/asp_net_core_api/develop.svg?style=popout) |
5+
| master | [![CircleCI](https://circleci.com/gh/Mathavana/asp_net_core_api/tree/master.svg?style=svg)](https://circleci.com/gh/Mathavana/asp_net_core_api/tree/master) |
6+
| develop | [![CircleCI](https://circleci.com/gh/Mathavana/asp_net_core_api/tree/develop.svg?style=svg)](https://circleci.com/gh/Mathavana/asp_net_core_api/tree/develop) |
77

88
We will try to create an API application using asp.net core.
99
- Mainly using repository pattern, generics, LINQ, Entity framework core
@@ -16,13 +16,17 @@ We will try to create an API application using asp.net core.
1616
- Model.IsValid is removed in each controller. (ApiController auto implement Model.IsValid)
1717
- Models, Enums, Context, Repositories moved to Supermarket.Core project
1818
- xUnit Test Project added
19+
- CircleCi
20+
- Standard response for error (400,404) results (Similar to ApiController model validation result)
1921

2022
### Next ToDo List:
2123
- Role Based Authentication/Authorization
22-
- Standard response for both error/success results
2324
- Global Error Handling
2425
- Dockerization
25-
- CircleCi
26+
- More test cases needed
27+
- Proper model implementation
28+
- model to DB
29+
2630

2731
### Note
2832
- Trying to understand best practices. May be frequently modified the project structure.

Supermarket.Core/Supermarket.Core.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
<TargetFramework>netcoreapp2.2</TargetFramework>
55
</PropertyGroup>
66

7-
<ItemGroup>
8-
<Folder Include="Services\Contracts\" />
9-
</ItemGroup>
10-
117
<ItemGroup>
128
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="2.2.0" />
139
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.3" />
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Net;
5+
6+
namespace Supermarket.ApiResponse
7+
{
8+
public class BadRequestResponse : ValidationProblemDetails
9+
{
10+
public Guid TraceId { get; set; }
11+
public BadRequestResponse(string error) : base(new Dictionary<string, string[]> { { "error", new[] { error } } })
12+
{
13+
TraceId = Guid.NewGuid();
14+
Title = HttpStatusCode.BadRequest.ToString();
15+
}
16+
}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Net;
5+
6+
namespace Supermarket.ApiResponse
7+
{
8+
public class NotFoundResponse : ValidationProblemDetails
9+
{
10+
public Guid TraceId { get; set; }
11+
public NotFoundResponse(string error) : base(new Dictionary<string, string[]> { { "error", new[] { error } } })
12+
{
13+
TraceId = Guid.NewGuid();
14+
Title = HttpStatusCode.NotFound.ToString();
15+
}
16+
}
17+
}

Supermarket/Domain/Communication/BaseResponse.cs

Lines changed: 0 additions & 19 deletions
This file was deleted.

Supermarket/Domain/Communication/CategoryResponse.cs

Lines changed: 0 additions & 20 deletions
This file was deleted.

Supermarket/Domain/Services/CategoryService.cs

Lines changed: 0 additions & 77 deletions
This file was deleted.

Supermarket/Domain/Services/Contracts/ICategoryService.cs

Lines changed: 0 additions & 15 deletions
This file was deleted.

Supermarket/Domain/Services/Contracts/IProductService.cs

Lines changed: 0 additions & 11 deletions
This file was deleted.

Supermarket/Domain/Services/Contracts/IServiceWrapper.cs

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)