Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build ASP.NET Core 8

# Определяем, когда запускать этот workflow
on:
push:
branches:
- main # Запускаем при push в ветку main
pull_request:
branches:
- main # Запускаем при pull request в ветку main

# Определяем среду выполнения
jobs:
build:
runs-on: ubuntu-latest # Используем последнюю версию Ubuntu

steps:
# Проверяем код из репозитория
- name: Checkout repository
uses: actions/checkout@v3

# Устанавливаем .NET SDK (версию укажите ту, которая необходима для ASP.NET Core 8)
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x' # Указываем нужную версию SDK

# Восстанавливаем зависимости
- name: Restore dependencies
run: dotnet restore WebApi/WebApi.csproj

# Сборка проекта
- name: Build project
run: dotnet build WebApi/WebApi.csproj --configuration Release --no-restore
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ COPY ["Services/Services.Contracts/Services.Contracts.csproj", "Services/Service
COPY ["Services/Services.Abstractions/Services.Abstractions.csproj", "Services/Services.Abstractions/"]
COPY ["Services/Services.Implementations/Services.Implementations.csproj", "Services/Services.Implementations/"]
RUN dotnet restore "WebApi/WebApi.csproj"
COPY ../ .
COPY . .
WORKDIR "/src/WebApi"
RUN dotnet build "WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/build

Expand Down
2 changes: 1 addition & 1 deletion Domain/Domain.Entities/Lesson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public class Lesson: IEntity<int>
/// </summary>
public bool Deleted { get; set; }

//public DateTime DateTime { get; set; }
public DateTime DateTime { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public DatabaseContext(DbContextOptions<DatabaseContext> options) : base(options

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
base.OnModelCreating(modelBuilder);

modelBuilder.Entity<Course>()
.HasMany(u => u.Lessons)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ public static IServiceCollection ConfigureContext(this IServiceCollection servic
services.AddDbContext<DatabaseContext>(optionsBuilder
=> optionsBuilder
//.UseLazyLoadingProxies() // lazy loading
//.UseNpgsql(connectionString));
.UseSqlite(connectionString));
.UseNpgsql(connectionString));
//.UseSqlite(connectionString));
//.UseSqlServer(connectionString));

#region health checks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

<ItemGroup>
<Folder Include="Migrations" />
<Folder Include="Migrations\" />
</ItemGroup>

</Project>

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

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;

#nullable disable

Expand All @@ -14,11 +15,11 @@ protected override void Up(MigrationBuilder migrationBuilder)
name: "Courses",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true),
Price = table.Column<decimal>(type: "TEXT", nullable: false),
Deleted = table.Column<bool>(type: "INTEGER", nullable: false)
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
Price = table.Column<decimal>(type: "numeric", nullable: false),
Deleted = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
Expand All @@ -29,11 +30,11 @@ protected override void Up(MigrationBuilder migrationBuilder)
name: "Lessons",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Subject = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true),
CourseId = table.Column<int>(type: "INTEGER", nullable: false),
Deleted = table.Column<bool>(type: "INTEGER", nullable: false)
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Subject = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
CourseId = table.Column<int>(type: "integer", nullable: false),
Deleted = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
Expand Down

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Infrastructure.EntityFramework.Migrations
{
/// <inheritdoc />
public partial class AddedDateTime : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "DateTime",
table: "Lessons",
type: "timestamp with time zone",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "DateTime",
table: "Lessons");
}
}
}
Loading