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", "type": "coreclr",
"request": "launch", "request": "launch",
"preLaunchTask": "build", "preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/net7.0/GerbilManager.dll", "program": "${workspaceFolder}/GerbilManagerWebAPI/bin/Debug/net7.0/GerbilManagerWebAPI.dll",
"args": [], "args": [],
"cwd": "${workspaceFolder}", "cwd": "${workspaceFolder}/GerbilManagerWebAPI",
"stopAtEntry": false, "stopAtEntry": false,
"serverReadyAction": { "serverReadyAction": {
"action": "openExternally", "action": "openExternally",
@@ -21,7 +21,7 @@
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
}, },
"sourceFileMap": { "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 # Visual Studio Version 17
VisualStudioVersion = 17.5.002.0 VisualStudioVersion = 17.5.002.0
MinimumVisualStudioVersion = 10.0.40219.1 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 EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,4 @@
using GerbilManager.Repositories; using GerbilManagerWebAPI.Repositories;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
@@ -12,7 +12,7 @@ builder.Services.AddSwaggerGen();
builder.Services.AddSingleton<IGerbilRepository, InMemGerbilRepository>(); 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(); 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 public interface IBreederRepository
{ {

View File

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

View File

@@ -1,6 +1,6 @@
using GerbilManager.Models; using GerbilManagerWebAPI.Models;
namespace GerbilManager.Repositories namespace GerbilManagerWebAPI.Repositories
{ {
public interface ILitterRepository 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 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: