Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename project to Orion #16

Merged
merged 3 commits into from
Sep 24, 2023
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ jobs:
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: vanderlangs/vbaseprojectapi
repository: vanderlangs/orion-api
tag_with_ref: true
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ WORKDIR /app

COPY . .

RUN dotnet restore "VBaseProject.Api/VBaseProject.Api.csproj"
RUN dotnet publish "VBaseProject.Api/VBaseProject.Api.csproj" -c Release -o /out
RUN dotnet restore "Orion.Api/Orion.Api.csproj"
RUN dotnet publish "Orion.Api/Orion.Api.csproj" -c Release -o /out

WORKDIR /out

ENTRYPOINT ["dotnet", "VBaseProject.Api.dll"]
ENTRYPOINT ["dotnet", "Orion.Api.dll"]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Authorization;

namespace VBaseProject.Api.Attributes
namespace Orion.Api.Attributes
{
public class AuthorizeForAttribute : AuthorizeAttribute
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using AutoMapper;
using VBaseProject.Api.AutoMapper.Output;
using VBaseProject.Entities.Domain;
using VBaseProject.Entities.ValueObjects.Pagination;
using Orion.Api.AutoMapper.Output;
using Orion.Entities.Domain;
using Orion.Entities.ValueObjects.Pagination;

namespace VBaseProject.Api.AutoMapper.Config
namespace Orion.Api.AutoMapper.Config
{
public class DomainToOutputProfile : Profile
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using AutoMapper;
using VBaseProject.Api.AutoMapper.Input;
using VBaseProject.Entities.Domain;
using Orion.Api.AutoMapper.Input;
using Orion.Entities.Domain;

namespace VBaseProject.Api.AutoMapper.Config
namespace Orion.Api.AutoMapper.Config
{
public class InputToDomainProfile : Profile
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace VBaseProject.Api.AutoMapper.Input
namespace Orion.Api.AutoMapper.Input
{
public class CustomerInput
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using VBaseProject.Entities.Enuns;
using Orion.Entities.Enuns;

namespace VBaseProject.Api.AutoMapper.Input
namespace Orion.Api.AutoMapper.Input
{
public class UserInput
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace VBaseProject.Api.AutoMapper.Output
namespace Orion.Api.AutoMapper.Output
{
public class CustomerOutput
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

using VBaseProject.Entities.Enuns;
using VBaseProject.Domain.Authentication;
using Orion.Entities.Enuns;
using Orion.Domain.Authentication;

namespace VBaseProject.Api.AutoMapper.Output
namespace Orion.Api.AutoMapper.Output
{
public class UserOutput
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using System.Security.Claims;
using VBaseProject.Api.Models;
using Orion.Api.Models;

namespace VBaseProject.Api.Controllers
namespace Orion.Api.Controllers
{
[ApiController]
public abstract class ApiController : ControllerBase
{
protected readonly IMapper _mapper;
protected readonly IMapper Mapper;
protected AuthUserModel AuthUser => GetAuthenticatedUser();
protected ApiController(IMapper mapper)
{
_mapper = mapper;
_mapper.ConfigurationProvider.AssertConfigurationIsValid();
Mapper = mapper;
Mapper.ConfigurationProvider.AssertConfigurationIsValid();
}

private AuthUserModel GetAuthenticatedUser()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;
using VBaseProject.Api.AutoMapper.Output;
using VBaseProject.Api.Jwt;
using VBaseProject.Api.Models;
using VBaseProject.Domain.Extensions;
using VBaseProject.Domain.Interfaces;
using VBaseProject.Entities.Domain;
using Orion.Api.AutoMapper.Output;
using Orion.Api.Jwt;
using Orion.Api.Models;
using Orion.Domain.Extensions;
using Orion.Domain.Interfaces;
using Orion.Entities.Domain;

namespace VBaseProject.Api.Controllers
namespace Orion.Api.Controllers
{
[Route("api/[controller]")]
[ApiController]
Expand All @@ -35,7 +35,7 @@ public AuthController(IUserService userService, IMapper mapper, IConfiguration c
[HttpPost]
public async Task<IActionResult> Login([FromBody] UserLoginModel model)
{
var userOutput = _mapper.Map<UserOutput>(await _userService.LoginAsync(model.Email, model.Password));
var userOutput = Mapper.Map<UserOutput>(await _userService.LoginAsync(model.Email, model.Password));

return await AuthorizeUser(userOutput);
}
Expand All @@ -45,7 +45,7 @@ public async Task<IActionResult> Login([FromBody] UserLoginModel model)
[HttpPost]
public async Task<IActionResult> RefreshToken([FromBody] RefreshTokenModel refreshTokenModel)
{
var userOutput = _mapper.Map<UserOutput>(await _userService.GetUserByRefreshTokenAsync(refreshTokenModel.RefreshToken));
var userOutput = Mapper.Map<UserOutput>(await _userService.GetUserByRefreshTokenAsync(refreshTokenModel.RefreshToken));

return await AuthorizeUser(userOutput);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
using Microsoft.AspNetCore.Mvc;
using System.Net;
using System.Threading.Tasks;
using VBaseProject.Api.Attributes;
using VBaseProject.Api.AutoMapper.Input;
using VBaseProject.Api.AutoMapper.Output;
using VBaseProject.Entities.Domain;
using VBaseProject.Entities.Filter;
using VBaseProject.Entities.ValueObjects.Pagination;
using VBaseProject.Domain.Interfaces;
using static VBaseProject.Domain.Authentication.AuthorizationConfiguration;
using Orion.Api.Attributes;
using Orion.Api.AutoMapper.Input;
using Orion.Api.AutoMapper.Output;
using Orion.Entities.Domain;
using Orion.Entities.Filter;
using Orion.Entities.ValueObjects.Pagination;
using Orion.Domain.Interfaces;
using static Orion.Domain.Authentication.AuthorizationConfiguration;

namespace VBaseProject.Api.Controllers
namespace Orion.Api.Controllers
{
[ApiVersion("1.0")]
[Route("api/[controller]")]
Expand All @@ -32,7 +32,7 @@ public async Task<IActionResult> Get([FromQuery] CustomerFilter filter)
{
var customer = await _customerService.ListPaginate(filter);

var customerOutputList = _mapper.Map<PagedList<CustomerOutput>>(customer);
var customerOutputList = Mapper.Map<PagedList<CustomerOutput>>(customer);

return Ok(customerOutputList);
}
Expand All @@ -43,7 +43,7 @@ public async Task<IActionResult> Get([FromQuery] CustomerFilter filter)
public async Task<IActionResult> Get(string id)
{
var customer = await _customerService.FindByIdAsync(id);
var customerOutput = _mapper.Map<CustomerOutput>(customer);
var customerOutput = Mapper.Map<CustomerOutput>(customer);

return Ok(customerOutput);
}
Expand All @@ -53,11 +53,11 @@ public async Task<IActionResult> Get(string id)
[ProducesResponseType((int)HttpStatusCode.BadRequest)]
public async Task<IActionResult> Post([FromBody] CustomerInput customerInput)
{
var customer = _mapper.Map<Customer>(customerInput);
var customer = Mapper.Map<Customer>(customerInput);

var created = await _customerService.AddAsync(customer);

return Created(_mapper.Map<CustomerOutput>(created));
return Created(Mapper.Map<CustomerOutput>(created));
}

[HttpPut("{id}")]
Expand All @@ -67,7 +67,7 @@ public async Task<IActionResult> Post([FromBody] CustomerInput customerInput)
public async Task<IActionResult> Put(string id, [FromBody] CustomerInput customerInput)
{
customerInput.PublicId = id;
var customer = _mapper.Map<Customer>(customerInput);
var customer = Mapper.Map<Customer>(customerInput);

await _customerService.UpdateAsync(customer);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
using Microsoft.AspNetCore.Mvc;
using System.Net;
using System.Threading.Tasks;
using VBaseProject.Api.Attributes;
using VBaseProject.Api.AutoMapper.Input;
using VBaseProject.Api.AutoMapper.Output;
using VBaseProject.Entities.Domain;
using VBaseProject.Entities.Filter;
using VBaseProject.Entities.ValueObjects.Pagination;
using VBaseProject.Domain.Interfaces;
using static VBaseProject.Domain.Authentication.AuthorizationConfiguration;
using Orion.Api.Attributes;
using Orion.Api.AutoMapper.Input;
using Orion.Api.AutoMapper.Output;
using Orion.Entities.Domain;
using Orion.Entities.Filter;
using Orion.Entities.ValueObjects.Pagination;
using Orion.Domain.Interfaces;
using static Orion.Domain.Authentication.AuthorizationConfiguration;

namespace VBaseProject.Api.Controllers
namespace Orion.Api.Controllers
{
[ApiVersion("1.0")]
[Route("api/[controller]")]
Expand All @@ -32,7 +32,7 @@ public async Task<IActionResult> Get([FromQuery] UserFilter filter)
{
var user = await _userService.ListPaginateAsync(filter);

var userOutputList = _mapper.Map<PagedList<UserOutput>>(user);
var userOutputList = Mapper.Map<PagedList<UserOutput>>(user);

return Ok(userOutputList);
}
Expand All @@ -43,7 +43,7 @@ public async Task<IActionResult> Get([FromQuery] UserFilter filter)
public async Task<IActionResult> Get(string id)
{
var user = await _userService.FindByIdAsync(id);
var userOutput = _mapper.Map<UserOutput>(user);
var userOutput = Mapper.Map<UserOutput>(user);

return Ok(userOutput);
}
Expand All @@ -53,11 +53,11 @@ public async Task<IActionResult> Get(string id)
[ProducesResponseType((int)HttpStatusCode.BadRequest)]
public async Task<IActionResult> Post([FromBody] UserInput userInput)
{
var user = _mapper.Map<User>(userInput);
var user = Mapper.Map<User>(userInput);

var created = await _userService.AddAsync(user);

return Created(_mapper.Map<UserOutput>(created));
return Created(Mapper.Map<UserOutput>(created));
}

[HttpPut("{id}")]
Expand All @@ -67,7 +67,7 @@ public async Task<IActionResult> Post([FromBody] UserInput userInput)
public async Task<IActionResult> Put(string id, [FromBody] UserInput userInput)
{
userInput.PublicId = id;
var user = _mapper.Map<User>(userInput);
var user = Mapper.Map<User>(userInput);

await _userService.UpdateAsync(user);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace VBaseProject.Api.Jwt
namespace Orion.Api.Jwt
{
public class JwtConfiguration
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@
using System;
using System.Net;
using System.Threading.Tasks;
using VBaseProject.Domain.Exceptions;
using Orion.Domain.Exceptions;

namespace VBaseProject.Api.Middleware
namespace Orion.Api.Middleware
{
public class VBaseProjectMiddleware
public class OrionMiddleware
{
private readonly RequestDelegate _next;
private readonly ILoggerFactory _loggerFactory;
private readonly ILogger _logger;
private readonly IHostEnvironment _env;

public VBaseProjectMiddleware(RequestDelegate next, ILoggerFactory loggerFactory, IHostEnvironment env)
public OrionMiddleware(RequestDelegate next, ILoggerFactory loggerFactory, IHostEnvironment env)
{
_env = env;
_loggerFactory = loggerFactory;
_next = next;

_logger = _loggerFactory.CreateLogger<VBaseProjectMiddleware>();
_logger = _loggerFactory.CreateLogger<OrionMiddleware>();
}

public async Task Invoke(HttpContext context)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace VBaseProject.Api.Models
namespace Orion.Api.Models
{
public class AuthUserModel
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;

namespace VBaseProject.Api.Models
namespace Orion.Api.Models
{
public class RefreshTokenModel
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using System;

namespace VBaseProject.Api.Models
namespace Orion.Api.Models
{
public class UserApiTokenModel
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;

namespace VBaseProject.Api.Models
namespace Orion.Api.Models
{
public class UserLoginModel
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<AssemblyName>VBaseProject.Api</AssemblyName>
<AssemblyName>Orion.Api</AssemblyName>
<UserSecretsId>7401dc57-e892-498d-a628-03091ec95c6a</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
Expand Down Expand Up @@ -34,10 +34,10 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\VBaseProject.Domain\VBaseProject.Domain.csproj" />
<ProjectReference Include="..\VBaseProject.Entities\VBaseProject.Entities.csproj" />
<ProjectReference Include="..\VBaseProject.Ioc\VBaseProject.Ioc.csproj" />
<ProjectReference Include="..\VBaseProject.Resources\VBaseProject.Resources.csproj" />
<ProjectReference Include="..\Orion.Domain\Orion.Domain.csproj" />
<ProjectReference Include="..\Orion.Entities\Orion.Entities.csproj" />
<ProjectReference Include="..\Orion.Ioc\Orion.Ioc.csproj" />
<ProjectReference Include="..\Orion.Resources\Orion.Resources.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading
Loading