Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 2
jobs:
build:
docker:
- image: debian:stretch
branches:
only:
advanced
master

steps:
- checkout

- run:
name: Greeting
command: echo Hello, world.

- run:
name: Print the Current Time
command: date
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**/bin/
**/obj/
**/global.json
**/Dockerfile*
**/.dockerignore*
**/*.user

23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**/volume*
/AccountOwnerServer/obj
/AccountOwnerServer/bin
/AccountOwnerServer/Projects
/Contracts/obj
/Contracts/bin
/Entities/obj
/Entities/bin
/LoggerService/obj
/LoggerService/bin
/Repository/obj
/Repository/bin
/Tests/bin
/Tests/obj
publish
/.vs
/AccountOwnerServer/internallog.txt
/Integration/obj
/Integration/bin
/AccountOwnerServer/*.user
/Tests/*.user
/Integration/*.user
.vscode/settings.json
120 changes: 120 additions & 0 deletions AccountOwnerServer.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2010
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AccountOwnerServer", "AccountOwnerServer\AccountOwnerServer.csproj", "{73FB08B8-4033-4116-B3AC-EC8253B024D4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Contracts", "Contracts\Contracts.csproj", "{52725034-B791-4DF1-A227-02EDB5BF78E0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LoggerService", "LoggerService\LoggerService.csproj", "{A190AF01-84DC-40A8-BEF3-C015825C8B30}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Entities", "Entities\Entities.csproj", "{8CD97B3F-C616-469C-80A2-A1B366611487}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Repository", "Repository\Repository.csproj", "{CC0B1C81-CB8A-412C-BD48-BCBC3F1A1CD0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "Tests\Tests.csproj", "{89CF5113-7F84-40B8-A81C-B918F00183AD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Integration", "Integration\Integration.csproj", "{35B4193F-04B2-4C75-BA9B-8221185D2F83}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{73FB08B8-4033-4116-B3AC-EC8253B024D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{73FB08B8-4033-4116-B3AC-EC8253B024D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{73FB08B8-4033-4116-B3AC-EC8253B024D4}.Debug|x64.ActiveCfg = Debug|Any CPU
{73FB08B8-4033-4116-B3AC-EC8253B024D4}.Debug|x64.Build.0 = Debug|Any CPU
{73FB08B8-4033-4116-B3AC-EC8253B024D4}.Debug|x86.ActiveCfg = Debug|Any CPU
{73FB08B8-4033-4116-B3AC-EC8253B024D4}.Debug|x86.Build.0 = Debug|Any CPU
{73FB08B8-4033-4116-B3AC-EC8253B024D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{73FB08B8-4033-4116-B3AC-EC8253B024D4}.Release|Any CPU.Build.0 = Release|Any CPU
{73FB08B8-4033-4116-B3AC-EC8253B024D4}.Release|x64.ActiveCfg = Release|Any CPU
{73FB08B8-4033-4116-B3AC-EC8253B024D4}.Release|x64.Build.0 = Release|Any CPU
{73FB08B8-4033-4116-B3AC-EC8253B024D4}.Release|x86.ActiveCfg = Release|Any CPU
{73FB08B8-4033-4116-B3AC-EC8253B024D4}.Release|x86.Build.0 = Release|Any CPU
{52725034-B791-4DF1-A227-02EDB5BF78E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{52725034-B791-4DF1-A227-02EDB5BF78E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{52725034-B791-4DF1-A227-02EDB5BF78E0}.Debug|x64.ActiveCfg = Debug|Any CPU
{52725034-B791-4DF1-A227-02EDB5BF78E0}.Debug|x64.Build.0 = Debug|Any CPU
{52725034-B791-4DF1-A227-02EDB5BF78E0}.Debug|x86.ActiveCfg = Debug|Any CPU
{52725034-B791-4DF1-A227-02EDB5BF78E0}.Debug|x86.Build.0 = Debug|Any CPU
{52725034-B791-4DF1-A227-02EDB5BF78E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{52725034-B791-4DF1-A227-02EDB5BF78E0}.Release|Any CPU.Build.0 = Release|Any CPU
{52725034-B791-4DF1-A227-02EDB5BF78E0}.Release|x64.ActiveCfg = Release|Any CPU
{52725034-B791-4DF1-A227-02EDB5BF78E0}.Release|x64.Build.0 = Release|Any CPU
{52725034-B791-4DF1-A227-02EDB5BF78E0}.Release|x86.ActiveCfg = Release|Any CPU
{52725034-B791-4DF1-A227-02EDB5BF78E0}.Release|x86.Build.0 = Release|Any CPU
{A190AF01-84DC-40A8-BEF3-C015825C8B30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A190AF01-84DC-40A8-BEF3-C015825C8B30}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A190AF01-84DC-40A8-BEF3-C015825C8B30}.Debug|x64.ActiveCfg = Debug|Any CPU
{A190AF01-84DC-40A8-BEF3-C015825C8B30}.Debug|x64.Build.0 = Debug|Any CPU
{A190AF01-84DC-40A8-BEF3-C015825C8B30}.Debug|x86.ActiveCfg = Debug|Any CPU
{A190AF01-84DC-40A8-BEF3-C015825C8B30}.Debug|x86.Build.0 = Debug|Any CPU
{A190AF01-84DC-40A8-BEF3-C015825C8B30}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A190AF01-84DC-40A8-BEF3-C015825C8B30}.Release|Any CPU.Build.0 = Release|Any CPU
{A190AF01-84DC-40A8-BEF3-C015825C8B30}.Release|x64.ActiveCfg = Release|Any CPU
{A190AF01-84DC-40A8-BEF3-C015825C8B30}.Release|x64.Build.0 = Release|Any CPU
{A190AF01-84DC-40A8-BEF3-C015825C8B30}.Release|x86.ActiveCfg = Release|Any CPU
{A190AF01-84DC-40A8-BEF3-C015825C8B30}.Release|x86.Build.0 = Release|Any CPU
{8CD97B3F-C616-469C-80A2-A1B366611487}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8CD97B3F-C616-469C-80A2-A1B366611487}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8CD97B3F-C616-469C-80A2-A1B366611487}.Debug|x64.ActiveCfg = Debug|Any CPU
{8CD97B3F-C616-469C-80A2-A1B366611487}.Debug|x64.Build.0 = Debug|Any CPU
{8CD97B3F-C616-469C-80A2-A1B366611487}.Debug|x86.ActiveCfg = Debug|Any CPU
{8CD97B3F-C616-469C-80A2-A1B366611487}.Debug|x86.Build.0 = Debug|Any CPU
{8CD97B3F-C616-469C-80A2-A1B366611487}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8CD97B3F-C616-469C-80A2-A1B366611487}.Release|Any CPU.Build.0 = Release|Any CPU
{8CD97B3F-C616-469C-80A2-A1B366611487}.Release|x64.ActiveCfg = Release|Any CPU
{8CD97B3F-C616-469C-80A2-A1B366611487}.Release|x64.Build.0 = Release|Any CPU
{8CD97B3F-C616-469C-80A2-A1B366611487}.Release|x86.ActiveCfg = Release|Any CPU
{8CD97B3F-C616-469C-80A2-A1B366611487}.Release|x86.Build.0 = Release|Any CPU
{CC0B1C81-CB8A-412C-BD48-BCBC3F1A1CD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CC0B1C81-CB8A-412C-BD48-BCBC3F1A1CD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CC0B1C81-CB8A-412C-BD48-BCBC3F1A1CD0}.Debug|x64.ActiveCfg = Debug|Any CPU
{CC0B1C81-CB8A-412C-BD48-BCBC3F1A1CD0}.Debug|x64.Build.0 = Debug|Any CPU
{CC0B1C81-CB8A-412C-BD48-BCBC3F1A1CD0}.Debug|x86.ActiveCfg = Debug|Any CPU
{CC0B1C81-CB8A-412C-BD48-BCBC3F1A1CD0}.Debug|x86.Build.0 = Debug|Any CPU
{CC0B1C81-CB8A-412C-BD48-BCBC3F1A1CD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CC0B1C81-CB8A-412C-BD48-BCBC3F1A1CD0}.Release|Any CPU.Build.0 = Release|Any CPU
{CC0B1C81-CB8A-412C-BD48-BCBC3F1A1CD0}.Release|x64.ActiveCfg = Release|Any CPU
{CC0B1C81-CB8A-412C-BD48-BCBC3F1A1CD0}.Release|x64.Build.0 = Release|Any CPU
{CC0B1C81-CB8A-412C-BD48-BCBC3F1A1CD0}.Release|x86.ActiveCfg = Release|Any CPU
{CC0B1C81-CB8A-412C-BD48-BCBC3F1A1CD0}.Release|x86.Build.0 = Release|Any CPU
{89CF5113-7F84-40B8-A81C-B918F00183AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{89CF5113-7F84-40B8-A81C-B918F00183AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{89CF5113-7F84-40B8-A81C-B918F00183AD}.Debug|x64.ActiveCfg = Debug|Any CPU
{89CF5113-7F84-40B8-A81C-B918F00183AD}.Debug|x64.Build.0 = Debug|Any CPU
{89CF5113-7F84-40B8-A81C-B918F00183AD}.Debug|x86.ActiveCfg = Debug|Any CPU
{89CF5113-7F84-40B8-A81C-B918F00183AD}.Debug|x86.Build.0 = Debug|Any CPU
{89CF5113-7F84-40B8-A81C-B918F00183AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{89CF5113-7F84-40B8-A81C-B918F00183AD}.Release|Any CPU.Build.0 = Release|Any CPU
{89CF5113-7F84-40B8-A81C-B918F00183AD}.Release|x64.ActiveCfg = Release|Any CPU
{89CF5113-7F84-40B8-A81C-B918F00183AD}.Release|x64.Build.0 = Release|Any CPU
{89CF5113-7F84-40B8-A81C-B918F00183AD}.Release|x86.ActiveCfg = Release|Any CPU
{89CF5113-7F84-40B8-A81C-B918F00183AD}.Release|x86.Build.0 = Release|Any CPU
{35B4193F-04B2-4C75-BA9B-8221185D2F83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{35B4193F-04B2-4C75-BA9B-8221185D2F83}.Debug|Any CPU.Build.0 = Debug|Any CPU
{35B4193F-04B2-4C75-BA9B-8221185D2F83}.Debug|x64.ActiveCfg = Debug|Any CPU
{35B4193F-04B2-4C75-BA9B-8221185D2F83}.Debug|x64.Build.0 = Debug|Any CPU
{35B4193F-04B2-4C75-BA9B-8221185D2F83}.Debug|x86.ActiveCfg = Debug|Any CPU
{35B4193F-04B2-4C75-BA9B-8221185D2F83}.Debug|x86.Build.0 = Debug|Any CPU
{35B4193F-04B2-4C75-BA9B-8221185D2F83}.Release|Any CPU.ActiveCfg = Release|Any CPU
{35B4193F-04B2-4C75-BA9B-8221185D2F83}.Release|Any CPU.Build.0 = Release|Any CPU
{35B4193F-04B2-4C75-BA9B-8221185D2F83}.Release|x64.ActiveCfg = Release|Any CPU
{35B4193F-04B2-4C75-BA9B-8221185D2F83}.Release|x64.Build.0 = Release|Any CPU
{35B4193F-04B2-4C75-BA9B-8221185D2F83}.Release|x86.ActiveCfg = Release|Any CPU
{35B4193F-04B2-4C75-BA9B-8221185D2F83}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {86DE07EE-BE1C-4AAB-ADAA-224170CF42B0}
EndGlobalSection
EndGlobal
37 changes: 37 additions & 0 deletions AccountOwnerServer/AccountOwnerServer.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.9" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="2.3.0" />
</ItemGroup>

<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Contracts\Contracts.csproj" />
<ProjectReference Include="..\Entities\Entities.csproj" />
<ProjectReference Include="..\LoggerService\LoggerService.csproj" />
<ProjectReference Include="..\Repository\Repository.csproj" />
</ItemGroup>

<ItemGroup>
<Content Update="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="nlog.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

</Project>
67 changes: 67 additions & 0 deletions AccountOwnerServer/Controllers/AccountController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
using Contracts;
using Entities.Extensions;
using Entities.Models;
using Microsoft.AspNetCore.Mvc;
using System;

namespace AccountOwnerServer.Controllers
{
[Route("api/[controller]")]
public class AccountController : Controller
{
private ILoggerManager _logger;
private IRepositoryWrapper _repository;

public AccountController(ILoggerManager logger, IRepositoryWrapper repository)
{
_logger = logger;
_repository = repository;
}

[HttpGet]
public IActionResult GetAllAccounts()
{
try
{
var accounts = _repository.Account.GetAllAccounts();

_logger.LogInfo($"Returned all accounts from database.");

return Ok(accounts);
}
catch (Exception ex)
{
_logger.LogError($"Something went wrong inside GetAllAccounts action: {ex}");
return StatusCode(500, "Internal server error");
}
}

[HttpPost]
public IActionResult CreateOwner([FromBody]Account account)
{
try
{
if (account.IsObjectNull())
{
_logger.LogError("Object sent from client is null.");
return BadRequest("Object is null");
}

if (!ModelState.IsValid)
{
_logger.LogError("Invalid object sent from client.");
return BadRequest("Invalid model object");
}

_repository.Account.CreateAccount(account);

return CreatedAtRoute("AccountById", new { id = account.Id }, account);
}
catch (Exception ex)
{
_logger.LogError($"Something went wrong inside CreateAccount action: {ex}");
return StatusCode(500, "Internal server error");
}
}
}
}
Loading