| namespace SecureSharing.Data.Data; | |||||
| using System.ComponentModel.DataAnnotations.Schema; | |||||
| using System.Diagnostics.CodeAnalysis; | |||||
| namespace SecureSharing.Data.Data; | |||||
| public class FileModel | public class FileModel | ||||
| { | { | ||||
| public int Id { get; set; } | public int Id { get; set; } | ||||
| public string Name { get; set; } | public string Name { get; set; } | ||||
| [NotNull] | |||||
| [ForeignKey("MessageId")] | |||||
| public int MessageId { get; set; } | |||||
| } | } |
| namespace SecureSharing.Data.Migrations | namespace SecureSharing.Data.Migrations | ||||
| { | { | ||||
| [DbContext(typeof(AppDbContext))] | [DbContext(typeof(AppDbContext))] | ||||
| [Migration("20220929105349_Init")] | |||||
| [Migration("20221003065352_Init")] | |||||
| partial class Init | partial class Init | ||||
| { | { | ||||
| protected override void BuildTargetModel(ModelBuilder modelBuilder) | protected override void BuildTargetModel(ModelBuilder modelBuilder) | ||||
| SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1); | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1); | ||||
| b.Property<int?>("MessageId") | |||||
| b.Property<int>("MessageId") | |||||
| .HasColumnType("int"); | .HasColumnType("int"); | ||||
| b.Property<string>("Name") | b.Property<string>("Name") | ||||
| { | { | ||||
| b.HasOne("SecureSharing.Data.Data.Message", null) | b.HasOne("SecureSharing.Data.Data.Message", null) | ||||
| .WithMany("FileNames") | .WithMany("FileNames") | ||||
| .HasForeignKey("MessageId"); | |||||
| .HasForeignKey("MessageId") | |||||
| .OnDelete(DeleteBehavior.Cascade) | |||||
| .IsRequired(); | |||||
| }); | }); | ||||
| modelBuilder.Entity("SecureSharing.Data.Data.Message", b => | modelBuilder.Entity("SecureSharing.Data.Data.Message", b => |
| Id = table.Column<int>(type: "int", nullable: false) | Id = table.Column<int>(type: "int", nullable: false) | ||||
| .Annotation("SqlServer:Identity", "1, 1"), | .Annotation("SqlServer:Identity", "1, 1"), | ||||
| Name = table.Column<string>(type: "nvarchar(max)", nullable: true), | 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 => | constraints: table => | ||||
| { | { |
| SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1); | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1); | ||||
| b.Property<int?>("MessageId") | |||||
| b.Property<int>("MessageId") | |||||
| .HasColumnType("int"); | .HasColumnType("int"); | ||||
| b.Property<string>("Name") | b.Property<string>("Name") | ||||
| { | { | ||||
| b.HasOne("SecureSharing.Data.Data.Message", null) | b.HasOne("SecureSharing.Data.Data.Message", null) | ||||
| .WithMany("FileNames") | .WithMany("FileNames") | ||||
| .HasForeignKey("MessageId"); | |||||
| .HasForeignKey("MessageId") | |||||
| .OnDelete(DeleteBehavior.Cascade) | |||||
| .IsRequired(); | |||||
| }); | }); | ||||
| modelBuilder.Entity("SecureSharing.Data.Data.Message", b => | modelBuilder.Entity("SecureSharing.Data.Data.Message", b => |
| </PropertyGroup> | </PropertyGroup> | ||||
| <ItemGroup> | <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"> | <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.9"> | ||||
| <PrivateAssets>all</PrivateAssets> | <PrivateAssets>all</PrivateAssets> | ||||
| <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||||
| </PackageReference> | </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> | </ItemGroup> | ||||
| </Project> | </Project> |
| services.AddScoped<MessageDeletionJob>(); | services.AddScoped<MessageDeletionJob>(); | ||||
| services.AddSingleton(new JobMetadata( | services.AddSingleton(new JobMetadata( | ||||
| typeof(MessageDeletionJob), | typeof(MessageDeletionJob), | ||||
| "0 0 01 * * ?")); | |||||
| "0 10 09 * * ?")); | |||||
| services.AddHostedService<JobsService>(); | services.AddHostedService<JobsService>(); | ||||