Compare commits

..

4 Commits

Author SHA1 Message Date
Julian
00fd8ded6e Pass in sql connection configuration 2023-10-21 14:59:53 +02:00
Julian
c00f650c42 Rename project to webAPI 2023-10-21 14:23:54 +02:00
Julian
ae085b1466 Add docker compose 2023-10-21 14:21:22 +02:00
Julian
a986e3546a Move webapi to sub folder 2023-10-21 14:02:51 +02:00
33 changed files with 702 additions and 681 deletions

6
.vscode/launch.json vendored
View File

@@ -9,9 +9,9 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/net7.0/GerbilManager.dll",
"program": "${workspaceFolder}/GerbilManagerWebAPI/bin/Debug/net7.0/GerbilManagerWebAPI.dll",
"args": [],
"cwd": "${workspaceFolder}",
"cwd": "${workspaceFolder}/GerbilManagerWebAPI",
"stopAtEntry": false,
"serverReadyAction": {
"action": "openExternally",
@@ -21,7 +21,7 @@
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
"/Views": "${workspaceFolder}/GerbilManagerWebAPI/Views"
}
},
{

View File

@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.002.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GerbilManager", "GerbilManager.csproj", "{48875578-7112-4F6F-A4C0-F1E7637B513D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GerbilManagerWebAPI", "GerbilManagerWebAPI\GerbilManagerWebAPI.csproj", "{48875578-7112-4F6F-A4C0-F1E7637B513D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@@ -1,4 +1,4 @@
using GerbilManager.Models;
using GerbilManagerWebAPI.Models;
using Microsoft.EntityFrameworkCore;
public class ApplicationContext : DbContext

View File

@@ -1,13 +1,13 @@
using GerbilManager.Models;
using GerbilManager.Repositories;
using GerbilManager.Dtos;
using GerbilManagerWebAPI.Models;
using GerbilManagerWebAPI.Repositories;
using GerbilManagerWebAPI.Dtos;
using GerbilManager.Converter;
using GerbilManagerWebAPI.Converter;
using Microsoft.AspNetCore.Mvc;
using System.Xml;
namespace GerbilManager.Controllers
namespace GerbilManagerWebAPI.Controllers
{
[ApiController]
[Route("breeders")]

View File

@@ -1,11 +1,11 @@
using GerbilManager.Models;
using GerbilManager.Repositories;
using GerbilManager.Dtos;
using GerbilManagerWebAPI.Models;
using GerbilManagerWebAPI.Repositories;
using GerbilManagerWebAPI.Dtos;
using Microsoft.AspNetCore.Mvc;
using GerbilManager.Converter;
using GerbilManagerWebAPI.Converter;
namespace GerbilManager.Controllers
namespace GerbilManagerWebAPI.Controllers
{
[ApiController]
[Route("gerbils")]

View File

@@ -1,13 +1,13 @@
using GerbilManager.Models;
using GerbilManager.Repositories;
using GerbilManager.Dtos;
using GerbilManagerWebAPI.Models;
using GerbilManagerWebAPI.Repositories;
using GerbilManagerWebAPI.Dtos;
using GerbilManager.Converter;
using GerbilManagerWebAPI.Converter;
using Microsoft.AspNetCore.Mvc;
using System.Xml;
namespace GerbilManager.Controllers
namespace GerbilManagerWebAPI.Controllers
{
[ApiController]
[Route("litters")]

View File

@@ -1,7 +1,7 @@
using GerbilManager.Dtos;
using GerbilManager.Models;
using GerbilManagerWebAPI.Dtos;
using GerbilManagerWebAPI.Models;
namespace GerbilManager.Converter
namespace GerbilManagerWebAPI.Converter
{
public static class BreederConverterExtension
{

View File

@@ -1,7 +1,7 @@
using GerbilManager.Dtos;
using GerbilManager.Models;
using GerbilManagerWebAPI.Dtos;
using GerbilManagerWebAPI.Models;
namespace GerbilManager.Converter
namespace GerbilManagerWebAPI.Converter
{
public static class GerbilConverterExtension
{

View File

@@ -1,7 +1,7 @@
using GerbilManager.Dtos;
using GerbilManager.Models;
using GerbilManagerWebAPI.Dtos;
using GerbilManagerWebAPI.Models;
namespace GerbilManager.Converter
namespace GerbilManagerWebAPI.Converter
{
public static class LitterConverterExtension
{

View File

@@ -1,4 +1,4 @@
namespace GerbilManager.Dtos
namespace GerbilManagerWebAPI.Dtos
{
public record BreederDto
{

View File

@@ -1,4 +1,4 @@
namespace GerbilManager.Dtos
namespace GerbilManagerWebAPI.Dtos
{
public record CreateBreederDto
{

View File

@@ -1,4 +1,4 @@
namespace GerbilManager.Dtos
namespace GerbilManagerWebAPI.Dtos
{
public record CreateGerbilDto
{

View File

@@ -1,4 +1,4 @@
namespace GerbilManager.Dtos
namespace GerbilManagerWebAPI.Dtos
{
public record CreateLitterDto
{

View File

@@ -1,4 +1,4 @@
namespace GerbilManager.Dtos
namespace GerbilManagerWebAPI.Dtos
{
public enum GenderDto
{

View File

@@ -1,4 +1,4 @@
namespace GerbilManager.Dtos
namespace GerbilManagerWebAPI.Dtos
{
public record GerbilDto
{

View File

@@ -1,4 +1,4 @@
namespace GerbilManager.Dtos
namespace GerbilManagerWebAPI.Dtos
{
public record LitterDto
{

View File

@@ -1,5 +1,5 @@
namespace GerbilManager.Dtos
namespace GerbilManagerWebAPI.Dtos
{
public record UpdateBreederDto
{

View File

@@ -1,4 +1,4 @@
namespace GerbilManager.Dtos
namespace GerbilManagerWebAPI.Dtos
{
public record UpdateGerbilDto
{

View File

@@ -1,5 +1,5 @@
namespace GerbilManager.Dtos
namespace GerbilManagerWebAPI.Dtos
{
public record UpdateLitterDto
{

View File

@@ -1,4 +1,4 @@
namespace GerbilManager.Models
namespace GerbilManagerWebAPI.Models
{
public record Breeder
{

View File

@@ -1,4 +1,4 @@
namespace GerbilManager.Models
namespace GerbilManagerWebAPI.Models
{
public enum Gender
{

View File

@@ -1,4 +1,4 @@
namespace GerbilManager.Models
namespace GerbilManagerWebAPI.Models
{
public record Gerbil
{

View File

@@ -1,4 +1,4 @@
namespace GerbilManager.Models
namespace GerbilManagerWebAPI.Models
{
public record Litter
{

View File

@@ -1,4 +1,4 @@
using GerbilManager.Repositories;
using GerbilManagerWebAPI.Repositories;
using Microsoft.EntityFrameworkCore;
var builder = WebApplication.CreateBuilder(args);
@@ -12,7 +12,7 @@ builder.Services.AddSwaggerGen();
builder.Services.AddSingleton<IGerbilRepository, InMemGerbilRepository>();
builder.Services.AddDbContext<ApplicationContext>(opts => opts.UseSqlServer(Configuration.GetConnectionString("sqlConnection")));
builder.Services.AddDbContext<ApplicationContext>(opts => opts.UseSqlServer(builder.Configuration.GetConnectionString("sqlConnection")));
var app = builder.Build();

View File

@@ -1,6 +1,6 @@
using GerbilManager.Models;
using GerbilManagerWebAPI.Models;
namespace GerbilManager.Repositories
namespace GerbilManagerWebAPI.Repositories
{
public interface IBreederRepository
{

View File

@@ -1,6 +1,6 @@
using GerbilManager.Models;
using GerbilManagerWebAPI.Models;
namespace GerbilManager.Repositories
namespace GerbilManagerWebAPI.Repositories
{
public interface IGerbilRepository
{

View File

@@ -1,6 +1,6 @@
using GerbilManager.Models;
using GerbilManagerWebAPI.Models;
namespace GerbilManager.Repositories
namespace GerbilManagerWebAPI.Repositories
{
public interface ILitterRepository
{

View File

@@ -1,6 +1,6 @@
using GerbilManager.Models;
using GerbilManagerWebAPI.Models;
namespace GerbilManager.Repositories
namespace GerbilManagerWebAPI.Repositories
{
public class InMemGerbilRepository : IGerbilRepository
{

21
compose.yml Normal file
View File

@@ -0,0 +1,21 @@
services:
# frontend:
# backend:
# image:
database:
image: mcr.microsoft.com/mssql/server:2022-latest
environment:
- ACCEPT_EULA=Y
- MSSQL_SA_PASSWORD=StrongerThenYYou1
- MSSQL_PID=Evaluation
ports:
- "1433:1433"
volumes:
- db-data:/var/opt/mssql
volumes:
db-data: