| @@ -1,7 +1,13 @@ | |||
| namespace SecureSharing.Data.Data; | |||
| using System.ComponentModel.DataAnnotations.Schema; | |||
| using System.Diagnostics.CodeAnalysis; | |||
| namespace SecureSharing.Data.Data; | |||
| public class FileModel | |||
| { | |||
| public int Id { get; set; } | |||
| public string Name { get; set; } | |||
| [NotNull] | |||
| [ForeignKey("MessageId")] | |||
| public int MessageId { get; set; } | |||
| } | |||
| @@ -12,7 +12,7 @@ using SecureSharing.Data.DbContexts; | |||
| namespace SecureSharing.Data.Migrations | |||
| { | |||
| [DbContext(typeof(AppDbContext))] | |||
| [Migration("20220929105349_Init")] | |||
| [Migration("20221003065352_Init")] | |||
| partial class Init | |||
| { | |||
| protected override void BuildTargetModel(ModelBuilder modelBuilder) | |||
| @@ -234,7 +234,7 @@ namespace SecureSharing.Data.Migrations | |||
| SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1); | |||
| b.Property<int?>("MessageId") | |||
| b.Property<int>("MessageId") | |||
| .HasColumnType("int"); | |||
| b.Property<string>("Name") | |||
| @@ -327,7 +327,9 @@ namespace SecureSharing.Data.Migrations | |||
| { | |||
| b.HasOne("SecureSharing.Data.Data.Message", null) | |||
| .WithMany("FileNames") | |||
| .HasForeignKey("MessageId"); | |||
| .HasForeignKey("MessageId") | |||
| .OnDelete(DeleteBehavior.Cascade) | |||
| .IsRequired(); | |||
| }); | |||
| modelBuilder.Entity("SecureSharing.Data.Data.Message", b => | |||
| @@ -177,7 +177,7 @@ namespace SecureSharing.Data.Migrations | |||
| Id = table.Column<int>(type: "int", nullable: false) | |||
| .Annotation("SqlServer:Identity", "1, 1"), | |||
| Name = table.Column<string>(type: "nvarchar(max)", nullable: true), | |||
| MessageId = table.Column<int>(type: "int", nullable: true) | |||
| MessageId = table.Column<int>(type: "int", nullable: false) | |||
| }, | |||
| constraints: table => | |||
| { | |||
| @@ -232,7 +232,7 @@ namespace SecureSharing.Data.Migrations | |||
| SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1); | |||
| b.Property<int?>("MessageId") | |||
| b.Property<int>("MessageId") | |||
| .HasColumnType("int"); | |||
| b.Property<string>("Name") | |||
| @@ -325,7 +325,9 @@ namespace SecureSharing.Data.Migrations | |||
| { | |||
| b.HasOne("SecureSharing.Data.Data.Message", null) | |||
| .WithMany("FileNames") | |||
| .HasForeignKey("MessageId"); | |||
| .HasForeignKey("MessageId") | |||
| .OnDelete(DeleteBehavior.Cascade) | |||
| .IsRequired(); | |||
| }); | |||
| modelBuilder.Entity("SecureSharing.Data.Data.Message", b => | |||
| @@ -8,21 +8,17 @@ | |||
| </PropertyGroup> | |||
| <ItemGroup> | |||
| <PackageReference Include="AutoMapper" Version="11.0.1"/> | |||
| <PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="6.0.9"/> | |||
| <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.9"/> | |||
| <PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.9"/> | |||
| <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.9"/> | |||
| <PackageReference Include="AutoMapper" Version="11.0.1" /> | |||
| <PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="6.0.9" /> | |||
| <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.9" /> | |||
| <PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.9" /> | |||
| <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.9" /> | |||
| <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.9"> | |||
| <PrivateAssets>all</PrivateAssets> | |||
| <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | |||
| </PackageReference> | |||
| <PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1"/> | |||
| <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0"/> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <Folder Include="Migrations"/> | |||
| <PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" /> | |||
| <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" /> | |||
| </ItemGroup> | |||
| </Project> | |||
| @@ -45,7 +45,7 @@ services.AddSingleton<ISchedulerFactory, StdSchedulerFactory>(); | |||
| services.AddScoped<MessageDeletionJob>(); | |||
| services.AddSingleton(new JobMetadata( | |||
| typeof(MessageDeletionJob), | |||
| "0 0 01 * * ?")); | |||
| "0 10 09 * * ?")); | |||
| services.AddHostedService<JobsService>(); | |||