From d4b53e9912da975d091ad21086a10f9c70410dc2 Mon Sep 17 00:00:00 2001 From: haraldnilsen Date: Tue, 3 Oct 2023 10:03:36 +0200 Subject: [PATCH] :building_construction: structured files for testing Co-authored-by: Sindre Kjelsrud --- backend/{ => cinemateket}/Context/DbContext.cs | 0 backend/{ => cinemateket}/Controllers/MovieController.cs | 0 .../Migrations/20230919073410_V1__init.Designer.cs | 0 .../Migrations/20230919073410_V1__init.cs | 0 .../Migrations/MovieDbContextModelSnapshot.cs | 0 backend/{ => cinemateket}/Models/Movie.cs | 0 backend/{ => cinemateket}/Models/MovieResponse.cs | 0 backend/{ => cinemateket}/Models/db/MovieDB.cs | 0 backend/{ => cinemateket}/Program.cs | 9 ++++----- backend/{ => cinemateket}/Properties/launchSettings.json | 0 backend/{ => cinemateket}/Util/Validators.cs | 0 backend/{ => cinemateket}/appsettings.Development.json | 0 backend/{ => cinemateket}/appsettings.json | 0 backend/{ => cinemateket}/backend.csproj | 0 backend/{ => cinemateket}/public/DbMockData.csv | 0 15 files changed, 4 insertions(+), 5 deletions(-) rename backend/{ => cinemateket}/Context/DbContext.cs (100%) rename backend/{ => cinemateket}/Controllers/MovieController.cs (100%) rename backend/{ => cinemateket}/Migrations/20230919073410_V1__init.Designer.cs (100%) rename backend/{ => cinemateket}/Migrations/20230919073410_V1__init.cs (100%) rename backend/{ => cinemateket}/Migrations/MovieDbContextModelSnapshot.cs (100%) rename backend/{ => cinemateket}/Models/Movie.cs (100%) rename backend/{ => cinemateket}/Models/MovieResponse.cs (100%) rename backend/{ => cinemateket}/Models/db/MovieDB.cs (100%) rename backend/{ => cinemateket}/Program.cs (95%) rename backend/{ => cinemateket}/Properties/launchSettings.json (100%) rename backend/{ => cinemateket}/Util/Validators.cs (100%) rename backend/{ => cinemateket}/appsettings.Development.json (100%) rename backend/{ => cinemateket}/appsettings.json (100%) rename backend/{ => cinemateket}/backend.csproj (100%) rename backend/{ => cinemateket}/public/DbMockData.csv (100%) diff --git a/backend/Context/DbContext.cs b/backend/cinemateket/Context/DbContext.cs similarity index 100% rename from backend/Context/DbContext.cs rename to backend/cinemateket/Context/DbContext.cs diff --git a/backend/Controllers/MovieController.cs b/backend/cinemateket/Controllers/MovieController.cs similarity index 100% rename from backend/Controllers/MovieController.cs rename to backend/cinemateket/Controllers/MovieController.cs diff --git a/backend/Migrations/20230919073410_V1__init.Designer.cs b/backend/cinemateket/Migrations/20230919073410_V1__init.Designer.cs similarity index 100% rename from backend/Migrations/20230919073410_V1__init.Designer.cs rename to backend/cinemateket/Migrations/20230919073410_V1__init.Designer.cs diff --git a/backend/Migrations/20230919073410_V1__init.cs b/backend/cinemateket/Migrations/20230919073410_V1__init.cs similarity index 100% rename from backend/Migrations/20230919073410_V1__init.cs rename to backend/cinemateket/Migrations/20230919073410_V1__init.cs diff --git a/backend/Migrations/MovieDbContextModelSnapshot.cs b/backend/cinemateket/Migrations/MovieDbContextModelSnapshot.cs similarity index 100% rename from backend/Migrations/MovieDbContextModelSnapshot.cs rename to backend/cinemateket/Migrations/MovieDbContextModelSnapshot.cs diff --git a/backend/Models/Movie.cs b/backend/cinemateket/Models/Movie.cs similarity index 100% rename from backend/Models/Movie.cs rename to backend/cinemateket/Models/Movie.cs diff --git a/backend/Models/MovieResponse.cs b/backend/cinemateket/Models/MovieResponse.cs similarity index 100% rename from backend/Models/MovieResponse.cs rename to backend/cinemateket/Models/MovieResponse.cs diff --git a/backend/Models/db/MovieDB.cs b/backend/cinemateket/Models/db/MovieDB.cs similarity index 100% rename from backend/Models/db/MovieDB.cs rename to backend/cinemateket/Models/db/MovieDB.cs diff --git a/backend/Program.cs b/backend/cinemateket/Program.cs similarity index 95% rename from backend/Program.cs rename to backend/cinemateket/Program.cs index 4744b2d..b7f544f 100644 --- a/backend/Program.cs +++ b/backend/cinemateket/Program.cs @@ -38,14 +38,13 @@ using (var scope = services.CreateScope()) var context = scope.ServiceProvider.GetRequiredService(); context.Database.EnsureCreated(); - using (context) - { - context.Database.Migrate(); - } - // Check if movies are already inserted to avoid duplicate insertion if (!context.Movies.Any()) { + using (context) + { + context.Database.Migrate(); + } using (var reader = new StreamReader("public/DbMockData.csv")) using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture)) { diff --git a/backend/Properties/launchSettings.json b/backend/cinemateket/Properties/launchSettings.json similarity index 100% rename from backend/Properties/launchSettings.json rename to backend/cinemateket/Properties/launchSettings.json diff --git a/backend/Util/Validators.cs b/backend/cinemateket/Util/Validators.cs similarity index 100% rename from backend/Util/Validators.cs rename to backend/cinemateket/Util/Validators.cs diff --git a/backend/appsettings.Development.json b/backend/cinemateket/appsettings.Development.json similarity index 100% rename from backend/appsettings.Development.json rename to backend/cinemateket/appsettings.Development.json diff --git a/backend/appsettings.json b/backend/cinemateket/appsettings.json similarity index 100% rename from backend/appsettings.json rename to backend/cinemateket/appsettings.json diff --git a/backend/backend.csproj b/backend/cinemateket/backend.csproj similarity index 100% rename from backend/backend.csproj rename to backend/cinemateket/backend.csproj diff --git a/backend/public/DbMockData.csv b/backend/cinemateket/public/DbMockData.csv similarity index 100% rename from backend/public/DbMockData.csv rename to backend/cinemateket/public/DbMockData.csv