Skip to content

Commit

Permalink
Agregando mais itens à arquitetura inicial
Browse files Browse the repository at this point in the history
  • Loading branch information
cperes-sprintmind committed Apr 18, 2024
1 parent 15cb651 commit 606d86b
Show file tree
Hide file tree
Showing 17 changed files with 230 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using FIAP.TechChallenge.ByteMeBurger.Application.UseCases;
using FIAP.TechChallenge.ByteMeBurger.Domain.Entities;
using Microsoft.AspNetCore.Mvc;

namespace FIAP.TechChallenge.ByteMeBurger.Api.Controllers
{
public class ClientesController : ControllerBase
{
private readonly IClienteUseCase _clienteUseCase;

public ClientesController(IClienteUseCase clienteUseCase)
{
_clienteUseCase = clienteUseCase;
}

[HttpGet]
public IActionResult Get(string cpf)
{
return Ok(_clienteUseCase.GetByCpf(cpf));
}


[HttpPost]
public IActionResult Post([FromBody] Cliente cliente)
{
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.3"/>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.3" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.2" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0"/>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>

<ItemGroup>
Expand All @@ -19,4 +19,9 @@
</Content>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\FIAP.TechChallenge.ByteMeBurger.Application\FIAP.TechChallenge.ByteMeBurger.Application.csproj" />
<ProjectReference Include="..\FIAP.TechChallenge.ByteMeBurger.Domain\FIAP.TechChallenge.ByteMeBurger.Domain.csproj" />
</ItemGroup>

</Project>
9 changes: 9 additions & 0 deletions src/FIAP.TechChallenge.ByteMeBurger.Api/Program.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
using FIAP.TechChallenge.ByteMeBurger.Application.UseCases;
using FIAP.TechChallenge.ByteMeBurger.Domain.Repositories;

namespace FIAP.TechChallenge.ByteMeBurger.Api;

public class Program
Expand All @@ -14,6 +17,12 @@ public static void Main(string[] args)
builder.Services.AddSwaggerGen();
builder.Services.AddControllers();

#region Injeção de dependências

//builder.Services.AddTransient<IClienteRepository, ClienteRepository>();
builder.Services.AddTransient<IClienteUseCase, ClienteUseCase>();
#endregion

var app = builder.Build();

// Configure the HTTP request pipeline.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@

<ItemGroup>
<Folder Include="Ports\Ingoing\" />
<Folder Include="Ports\Ingoing\" />
<Folder Include="Ports\Outgoing\" />
<Folder Include="Ports\Outgoing\" />
<Folder Include="Services\" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\FIAP.TechChallenge.ByteMeBurger.Domain\FIAP.TechChallenge.ByteMeBurger.Domain.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using FIAP.TechChallenge.ByteMeBurger.Domain.Entities;

namespace FIAP.TechChallenge.ByteMeBurger.Application.UseCases
{
public class ClienteUseCase : IClienteUseCase
{
public void AddCliente(Cliente cliente)
{
throw new NotImplementedException();
}

public Cliente GetByCpf(string cpf)
{
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using FIAP.TechChallenge.ByteMeBurger.Domain.Entities;

namespace FIAP.TechChallenge.ByteMeBurger.Application.UseCases
{
public interface IClienteUseCase
{
Cliente GetByCpf(string cpf);
void AddCliente(Cliente cliente);

}
}
16 changes: 16 additions & 0 deletions src/FIAP.TechChallenge.ByteMeBurger.Domain/Entities/Cliente.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FIAP.TechChallenge.ByteMeBurger.Domain.Entities
{
public class Cliente
{
public int Id { get; set; }
public string Nome { get; set; }

Check warning on line 12 in src/FIAP.TechChallenge.ByteMeBurger.Domain/Entities/Cliente.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Nome' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
public string Email { get; set; }

Check warning on line 13 in src/FIAP.TechChallenge.ByteMeBurger.Domain/Entities/Cliente.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Email' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
public string Cpf { get; set; }

Check warning on line 14 in src/FIAP.TechChallenge.ByteMeBurger.Domain/Entities/Cliente.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Cpf' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
}
}
16 changes: 16 additions & 0 deletions src/FIAP.TechChallenge.ByteMeBurger.Domain/Entities/ItemPedido.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FIAP.TechChallenge.ByteMeBurger.Domain.Entities
{
public class ItemPedido
{
public int Id { get; set; }
public Produto Produto { get; set; }

Check warning on line 12 in src/FIAP.TechChallenge.ByteMeBurger.Domain/Entities/ItemPedido.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Produto' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
public int Quantidade { get; set; }
public double Subtotal { get; set; }
}
}
22 changes: 22 additions & 0 deletions src/FIAP.TechChallenge.ByteMeBurger.Domain/Entities/Pedido.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using FIAP.TechChallenge.ByteMeBurger.Domain.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FIAP.TechChallenge.ByteMeBurger.Domain.Entities
{
public class Pedido
{
public int Id { get; set; }
public string Codigo { get; set; }

Check warning on line 13 in src/FIAP.TechChallenge.ByteMeBurger.Domain/Entities/Pedido.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Codigo' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
public string Status { get; set; }

Check warning on line 14 in src/FIAP.TechChallenge.ByteMeBurger.Domain/Entities/Pedido.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Status' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
public Cliente Cliente { get; set; }

Check warning on line 15 in src/FIAP.TechChallenge.ByteMeBurger.Domain/Entities/Pedido.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Cliente' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
public double PrecoTotal { get; set; }
public double ValorPago { get; set; }
public DateTime DataPagamento { get; set; }
public FormaPagamento FormaPagamento { get; set; }
public List<ItemPedido> Produtos { get; set; }

Check warning on line 20 in src/FIAP.TechChallenge.ByteMeBurger.Domain/Entities/Pedido.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Produtos' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
}
}
20 changes: 20 additions & 0 deletions src/FIAP.TechChallenge.ByteMeBurger.Domain/Entities/Produto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using FIAP.TechChallenge.ByteMeBurger.Domain.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FIAP.TechChallenge.ByteMeBurger.Domain.Entities
{
public class Produto
{
public int Id { get; set; }
public string Codigo { get; set; }

Check warning on line 13 in src/FIAP.TechChallenge.ByteMeBurger.Domain/Entities/Produto.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Codigo' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
public string Nome { get; set; }

Check warning on line 14 in src/FIAP.TechChallenge.ByteMeBurger.Domain/Entities/Produto.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Nome' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
public CategoriaProduto Categoria { get; set; }
public double Preco { get; set; }
public string Descricao { get; set; }
public List<string> Imagens { get; set; } // Lista de URLs das imagens
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FIAP.TechChallenge.ByteMeBurger.Domain.Enums
{
public enum CategoriaProduto
{
Lanche,
Acompanamento,
Bebida,
Sobremesa
}
}
13 changes: 13 additions & 0 deletions src/FIAP.TechChallenge.ByteMeBurger.Domain/Enums/FormaPagamento.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FIAP.TechChallenge.ByteMeBurger.Domain.Enums
{
public enum FormaPagamento
{
MercadoPago
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

<ItemGroup>
<Folder Include="Base\" />
<Folder Include="Entities\" />
<Folder Include="Base\" />
<Folder Include="ValueObjects\" />
<Folder Include="ValueObjects\" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using FIAP.TechChallenge.ByteMeBurger.Domain.Entities;

namespace FIAP.TechChallenge.ByteMeBurger.Domain.Repositories
{
public interface IClienteRepository
{
Task<Cliente> GetByCpf(string cpf);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\FIAP.TechChallenge.ByteMeBurger.Domain\FIAP.TechChallenge.ByteMeBurger.Domain.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using FIAP.TechChallenge.ByteMeBurger.Domain.Entities;
using Microsoft.EntityFrameworkCore;

Check failure on line 2 in src/FIAP.TechChallenge.ByteMeBurger.Infrastructure/Repositories/ByteMeBurgerDbContext.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'EntityFrameworkCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

Check failure on line 2 in src/FIAP.TechChallenge.ByteMeBurger.Infrastructure/Repositories/ByteMeBurgerDbContext.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'EntityFrameworkCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
using Microsoft.Identity.Client;

Check failure on line 3 in src/FIAP.TechChallenge.ByteMeBurger.Infrastructure/Repositories/ByteMeBurgerDbContext.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'Identity' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

Check failure on line 3 in src/FIAP.TechChallenge.ByteMeBurger.Infrastructure/Repositories/ByteMeBurgerDbContext.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'Identity' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

namespace FIAP.TechChallenge.ByteMeBurger.Infrastructure.Repositories
{
public class ByteMeBurgerDbContext: DbContext

Check failure on line 7 in src/FIAP.TechChallenge.ByteMeBurger.Infrastructure/Repositories/ByteMeBurgerDbContext.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'DbContext' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 7 in src/FIAP.TechChallenge.ByteMeBurger.Infrastructure/Repositories/ByteMeBurgerDbContext.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'DbContext' could not be found (are you missing a using directive or an assembly reference?)
{
public ByteMeBurgerDbContext(DbContextOptions options) : base(options)

Check failure on line 9 in src/FIAP.TechChallenge.ByteMeBurger.Infrastructure/Repositories/ByteMeBurgerDbContext.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'DbContextOptions' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 9 in src/FIAP.TechChallenge.ByteMeBurger.Infrastructure/Repositories/ByteMeBurgerDbContext.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'DbContextOptions' could not be found (are you missing a using directive or an assembly reference?)
{

}
public DbSet<Cliente> Clientes { get; set; }

Check failure on line 13 in src/FIAP.TechChallenge.ByteMeBurger.Infrastructure/Repositories/ByteMeBurgerDbContext.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'DbSet<>' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 13 in src/FIAP.TechChallenge.ByteMeBurger.Infrastructure/Repositories/ByteMeBurgerDbContext.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'DbSet<>' could not be found (are you missing a using directive or an assembly reference?)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using FIAP.TechChallenge.ByteMeBurger.Domain.Entities;
using FIAP.TechChallenge.ByteMeBurger.Domain.Repositories;

namespace FIAP.TechChallenge.ByteMeBurger.Infrastructure.Repositories
{
public class ClienteRepository : IClienteRepository
{
private readonly ByteMeBurgerDbContext _context;
public ClienteRepository(ByteMeBurgerDbContext context) {
_context = context;
}
public Task<Cliente> GetByCpf(string cpf)
{
throw new NotImplementedException();
}
}
}

0 comments on commit 606d86b

Please sign in to comment.