Skip to content

Commit

Permalink
Merge pull request #270 from kzi-nastava/develop
Browse files Browse the repository at this point in the history
KT4
  • Loading branch information
FilipT03 authored Jun 17, 2024
2 parents 8667f02 + de3c5e6 commit ea60a28
Show file tree
Hide file tree
Showing 17 changed files with 1,032 additions and 129 deletions.
10 changes: 1 addition & 9 deletions LangLang/Application/DTO/DatabaseCredentials.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LangLang.Application.DTO
namespace LangLang.Application.DTO
{
//private string connectionString = "Host=localhost;Port=5433;Username=postgres;Password=123;Database=langlang;";

public class DatabaseCredentials
{
public string Host { get; }
Expand Down
4 changes: 0 additions & 4 deletions LangLang/Application/DTO/EmailSendingResultDto.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using LangLang.Domain.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LangLang.Application.DTO;

Expand Down
11 changes: 5 additions & 6 deletions LangLang/HostBuilders/AddRepositoriesHostBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Options;
using System.Diagnostics;

namespace LangLang.HostBuilders;

Expand All @@ -26,16 +28,13 @@ public static IHostBuilder AddRepositories(this IHostBuilder host)
options.UseNpgsql(databaseCredentials.ConnectionString);
});
services.AddSingleton<ICourseRepository, CourseRepositorySQL>();
services.AddSingleton<ILanguageRepository, LanguageRepositorySQL>();
services.AddSingleton<IExamRepository, ExamRepositorySQL>();
services.AddSingleton<ITutorRepository, TutorRepositorySQL>();
services.AddSingleton<IDirectorRepository, DirectorRepository>(_ =>
new DirectorRepository(Constants.DirectorFilePath, Constants.DirectorIdFilePath));
services.AddSingleton<IExamRepository, ExamRepository>(_ =>
new ExamRepository(Constants.ExamFilePath, Constants.ExamIdFilePath));
services.AddSingleton<ILanguageRepository, LanguageRepository>(_ =>
new LanguageRepository(Constants.LanguageFilePath));
services.AddSingleton<IStudentRepository, StudentRepository>(_ =>
new StudentRepository(Constants.StudentFilePath, Constants.StudentIdFilePath));
services.AddSingleton<ITutorRepository, TutorRepository>(_ =>
new TutorRepository(Constants.TutorFilePath, Constants.TutorIdFilePath));
services.AddSingleton<ICourseApplicationRepository, CourseApplicationRepository>(_ =>
new CourseApplicationRepository(Constants.CourseApplicationsFilePath,
Constants.CourseApplicationsIdFilePath));
Expand Down
44 changes: 0 additions & 44 deletions LangLang/Migrations/20240613193348_Mig1.cs

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

102 changes: 102 additions & 0 deletions LangLang/Migrations/20240616173831_MigMapaFresh.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace LangLang.Migrations
{
public partial class MigMapaFresh : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Languages",
columns: table => new
{
Name = table.Column<string>(type: "text", nullable: false),
Code = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Languages", x => x.Name);
});

migrationBuilder.CreateTable(
name: "Courses",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
LanguageName = table.Column<string>(type: "text", nullable: false),
Level = table.Column<int>(type: "integer", nullable: false),
Duration = table.Column<int>(type: "integer", nullable: false),
Schedule = table.Column<string>(type: "text", nullable: false),
ScheduleSerialized = table.Column<string>(type: "text", nullable: false),
Start = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
Online = table.Column<bool>(type: "boolean", nullable: false),
MaxStudents = table.Column<int>(type: "integer", nullable: false),
NumStudents = table.Column<int>(type: "integer", nullable: false),
State = table.Column<int>(type: "integer", nullable: false),
TutorId = table.Column<string>(type: "text", nullable: true),
IsCreatedByTutor = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Courses", x => x.Id);
table.ForeignKey(
name: "FK_Courses_Languages_LanguageName",
column: x => x.LanguageName,
principalTable: "Languages",
principalColumn: "Name",
onDelete: ReferentialAction.Cascade);
});

migrationBuilder.CreateTable(
name: "Exams",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
LanguageName = table.Column<string>(type: "text", nullable: false),
LanguageLevel = table.Column<int>(type: "integer", nullable: false),
Time = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
ClassroomNumber = table.Column<int>(type: "integer", nullable: false),
MaxStudents = table.Column<int>(type: "integer", nullable: false),
NumStudents = table.Column<int>(type: "integer", nullable: false),
ExamState = table.Column<int>(type: "integer", nullable: false),
TutorId = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Exams", x => x.Id);
table.ForeignKey(
name: "FK_Exams_Languages_LanguageName",
column: x => x.LanguageName,
principalTable: "Languages",
principalColumn: "Name",
onDelete: ReferentialAction.Cascade);
});

migrationBuilder.CreateIndex(
name: "IX_Courses_LanguageName",
table: "Courses",
column: "LanguageName");

migrationBuilder.CreateIndex(
name: "IX_Exams_LanguageName",
table: "Exams",
column: "LanguageName");
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Courses");

migrationBuilder.DropTable(
name: "Exams");

migrationBuilder.DropTable(
name: "Languages");
}
}
}
Loading

0 comments on commit ea60a28

Please sign in to comment.