Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
kolappannathan committed Aug 14, 2022
2 parents 0a7d100 + fd19d63 commit d969606
Show file tree
Hide file tree
Showing 20 changed files with 28 additions and 232 deletions.
9 changes: 0 additions & 9 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
version: 2
updates:


# github actions
- package-ecosystem: "github-actions"
# Workflow files stored in the
Expand All @@ -20,14 +19,6 @@ updates:
directory: "/src/WebApiBolierplate/API/" # Location of package manifests
schedule:
interval: "monthly"
- package-ecosystem: "nuget" # See documentation for possible values
directory: "/src/WebApiBolierplate/Model/" # Location of package manifests
schedule:
interval: "monthly"
- package-ecosystem: "nuget" # See documentation for possible values
directory: "/src/WebApiBolierplate/Business.Lib/" # Location of package manifests
schedule:
interval: "monthly"
- package-ecosystem: "nuget" # See documentation for possible values
directory: "/src/WebApiBolierplate/Core.Constants/" # Location of package manifests
schedule:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ jobs:
run: |
cd ./src/WebApiBolierplate
dotnet test ./Core.Test/Core.Test.csproj
- name: IntelliCode Team Completions
uses: microsoft/vs-intellicode@v1.0
build-linux:
runs-on: ubuntu-latest
steps:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,6 @@ MigrationBackup/
FodyWeavers.xsd

# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
Expand Down
8 changes: 8 additions & 0 deletions .vscode/spellright.dict
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
startup
appconfig
appsettings.json
src
launchsettings.json
editorconfig
db
Serilog
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [6.1.0] - 2022-08-15
### Added
- Added dependency Injection
- Added Serilog

### Changed
- Updated the default port
Expand All @@ -17,6 +18,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Removed
- Removed config static class
- Removed StartupLib and Tasks Controller
- Removed csv logger

## [6.0.0] - 2022-07-16
### Added
Expand Down
3 changes: 2 additions & 1 deletion src/WebApiBolierplate/API/API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.8" />
<PackageReference Include="Serilog.Extensions.Logging.File" Version="3.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>

Expand Down
29 changes: 0 additions & 29 deletions src/WebApiBolierplate/API/Controllers/TasksController.cs

This file was deleted.

2 changes: 1 addition & 1 deletion src/WebApiBolierplate/API/Helpers/JWTHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public class JWTHelper

public JWTHelper(IConfiguration configuration)
{
_securityKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_configuration["AppConfig:JWT:Key"]));
_configuration = configuration;
_securityKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_configuration["AppConfig:JWT:Key"]));
}

#region [Token Generation]
Expand Down
2 changes: 0 additions & 2 deletions src/WebApiBolierplate/API/Operations/Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ public class Base

public DBAdapter dBAdapter;
public Core.Lib.Helpers helper;
public CsvLogger csvLogger;

#endregion [Declarations]

public Base(IConfiguration configuration)
{
csvLogger = new CsvLogger();
helper = new Core.Lib.Helpers();

// uncomment this line when there is a valid connection string
Expand Down
21 changes: 0 additions & 21 deletions src/WebApiBolierplate/API/Operations/StarupLib.cs

This file was deleted.

9 changes: 5 additions & 4 deletions src/WebApiBolierplate/API/Operations/UserLib.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ public class UserLib : Base
{
private const string BrandonStark = "Brandon Stark";
private const string EddardStark = "Eddard Stark";
private readonly ILogger _logger;

public UserLib(IConfiguration configuration): base(configuration)
public UserLib(IConfiguration configuration, ILogger<UserLib> logger): base(configuration)
{

_logger = logger;
}

public int ValidateLogin(LoginDTO login)
Expand Down Expand Up @@ -42,7 +43,7 @@ public int ValidateLogin(LoginDTO login)
}
catch (Exception ex)
{
csvLogger.Error(ex);
_logger.LogError("ValidateLogin - {message}", ex.Message);
return -1;
}
}
Expand All @@ -63,7 +64,7 @@ public User GetUser(string userName)
}
catch (Exception ex)
{
csvLogger.Error(ex);
_logger.LogError("GetUser - {message}", ex.Message);
return null;
}
}
Expand Down
8 changes: 3 additions & 5 deletions src/WebApiBolierplate/API/Program.cs
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
using API.Helpers;
using API.Operations;
using Core.Constants;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.IdentityModel.Tokens;
using Microsoft.OpenApi.Models;
using System.Text;

var builder = WebApplication.CreateBuilder(args);

builder.Logging.AddFile("Logs/API.log");

// To prevent .NET and server info from being added to header if Kestrel is used
builder.WebHost.ConfigureKestrel(serverOptions => {
serverOptions.AddServerHeader = false;
});

#region Configuring Services

var startupLib = new StarupLib();
startupLib.LoadConfig(builder.Configuration);

builder.Services.AddControllers();

#region Dependency Injection

#region operations

builder.Services.AddScoped<StarupLib>();
builder.Services.AddScoped<UserLib>();
builder.Services.AddScoped<ValueLib>();

Expand Down
8 changes: 1 addition & 7 deletions src/WebApiBolierplate/API/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"Default": "Information",
"System": "Information",
"Microsoft": "Information"
}
Expand All @@ -10,12 +10,6 @@
"DataBase": {
"ConnectionString": "sample connection string"
},
"Logger": {
"DateFormat": "yyyy-MM-dd HH:mm:ss.fff",
"FileName": "ErrorLog",
"RelativePath": "",
"ReplacementValue": ";"
},
"JWT": {
"Audience": "https://www.example.com",
"Issuer": "WebApiBoilerplate",
Expand Down
6 changes: 0 additions & 6 deletions src/WebApiBolierplate/API/appsettings.production.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@
"DataBase": {
"ConnectionString": "sample connection string"
},
"Logger": {
"DateFormat": "yyyy-MM-dd HH:mm:ss.fff",
"FileName": "ErrorLog",
"RelativePath": "",
"ReplacementValue": ";"
},
"JWT": {
"Audience": "https://www.example.com",
"Issuer": "WebApiBoilerplate",
Expand Down
18 changes: 0 additions & 18 deletions src/WebApiBolierplate/Core.Constants/Config.cs

This file was deleted.

3 changes: 1 addition & 2 deletions src/WebApiBolierplate/Core.Lib/Core.Lib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

<ItemGroup>
<PackageReference Include="BCrypt.Net-Next" Version="4.0.3" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="4.1.0" />
<PackageReference Include="nk.logger.csv" Version="3.0.1" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.0.0" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
</ItemGroup>

Expand Down
93 changes: 0 additions & 93 deletions src/WebApiBolierplate/Core.Lib/CsvLogger.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ namespace Core.Lib.Security;

/// <summary>
/// This class offer simple encryption and decryption
/// This function is taken from the following stack overflow answer with some modifications
/// Ref: https://stackoverflow.com/a/27484425/5407188
/// </summary>
public class EncryptionHelper
Expand Down
2 changes: 1 addition & 1 deletion src/WebApiBolierplate/Core.Test/Core.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Include="coverlet.collector" Version="3.1.2">
Expand Down
Loading

0 comments on commit d969606

Please sign in to comment.