Move database context, migrations and models to separate project.

This commit is contained in:
2024-05-03 22:18:49 +01:00
parent 16d72acb6a
commit 7bcaf5b1b0
163 changed files with 415 additions and 311 deletions

View File

@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Aaru.CommonTypes" Version="6.0.0-alpha8"/>
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.0"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.0"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="6.0.0"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0"/>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.0"/>
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0"/>
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.0"/>
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql.Design" Version="1.1.2"/>
</ItemGroup>
</Project>

View File

@@ -32,17 +32,21 @@
using System.Data.Common;
using Aaru.CommonTypes.Metadata;
using Aaru.Server.Database.Models;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using OperatingSystem = Aaru.Server.Database.Models.OperatingSystem;
using Version = Aaru.Server.Database.Models.Version;
namespace Aaru.Server.Models;
namespace Aaru.Server.Database;
public sealed class AaruServerContext : IdentityDbContext<IdentityUser>
public sealed class DbContext : IdentityDbContext<IdentityUser>
{
public AaruServerContext() {}
public DbContext() {}
public AaruServerContext(DbContextOptions<AaruServerContext> options) : base(options) {}
public DbContext(DbContextOptions<DbContext> options) : base(options) {}
public DbSet<Device> Devices { get; set; }
public DbSet<UploadedReport> Reports { get; set; }
@@ -338,7 +342,7 @@ public sealed class AaruServerContext : IdentityDbContext<IdentityUser>
internal static bool TableExists(string tableName)
{
using var db = new AaruServerContext();
using var db = new DbContext();
DbConnection connection = db.Database.GetDbConnection();
connection.Open();

View File

@@ -1,14 +1,13 @@
// <auto-generated />
using System;
using Aaru.Server.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
[DbContext(typeof(AaruServerContext))]
[DbContext(typeof(DbContext))]
[Migration("20191102132240_InitialMigration")]
partial class InitialMigration
{

View File

@@ -1,47 +1,46 @@
using Aaru.Server.Models;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
public partial class InitialMigration : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
#region Check for old tables
bool atasExists = AaruServerContext.TableExists("Atas");
bool blockDescriptorsExists = AaruServerContext.TableExists("BlockDescriptors");
bool chsExists = AaruServerContext.TableExists("Chs");
bool commandsExists = AaruServerContext.TableExists("Commands");
bool compactDiscOffsetsExists = AaruServerContext.TableExists("CompactDiscOffsets");
bool densityCodesExists = AaruServerContext.TableExists("DensityCodes");
bool devicesExists = AaruServerContext.TableExists("Devices");
bool deviceStatsExists = AaruServerContext.TableExists("DeviceStats");
bool filesystemsExists = AaruServerContext.TableExists("Filesystems");
bool filtersExists = AaruServerContext.TableExists("Filters");
bool fireWiresExists = AaruServerContext.TableExists("FireWires");
bool mediaExists = AaruServerContext.TableExists("Media");
bool mediaFormatsExists = AaruServerContext.TableExists("MediaFormats");
bool mmcFeaturesExists = AaruServerContext.TableExists("MmcFeatures");
bool mmcsExists = AaruServerContext.TableExists("Mmcs");
bool mmcSdsExists = AaruServerContext.TableExists("MmcSds");
bool operatingSystemsExists = AaruServerContext.TableExists("OperatingSystems");
bool partitionsExists = AaruServerContext.TableExists("Partitions");
bool pcmciasExists = AaruServerContext.TableExists("Pcmcias");
bool scsiModesExists = AaruServerContext.TableExists("ScsiModes");
bool scsiPagesExists = AaruServerContext.TableExists("ScsiPages");
bool scsisExists = AaruServerContext.TableExists("Scsis");
bool sscsExists = AaruServerContext.TableExists("Sscs");
bool sscSupportedMediasExists = AaruServerContext.TableExists("SscSupportedMedias");
bool supportedDensitiesExists = AaruServerContext.TableExists("SupportedDensities");
bool testedMediasExists = AaruServerContext.TableExists("TestedMedias");
bool testedSequentialMediasExists = AaruServerContext.TableExists("TestedSequentialMedias");
bool uploadedReportsExists = AaruServerContext.TableExists("UploadedReports");
bool usbProductsExists = AaruServerContext.TableExists("UsbProducts");
bool usbsExists = AaruServerContext.TableExists("Usbs");
bool usbVendorsExists = AaruServerContext.TableExists("UsbVendors");
bool versionsExists = AaruServerContext.TableExists("Versions");
bool efExists = AaruServerContext.TableExists("__MigrationHistory");
bool atasExists = DbContext.TableExists("Atas");
bool blockDescriptorsExists = DbContext.TableExists("BlockDescriptors");
bool chsExists = DbContext.TableExists("Chs");
bool commandsExists = DbContext.TableExists("Commands");
bool compactDiscOffsetsExists = DbContext.TableExists("CompactDiscOffsets");
bool densityCodesExists = DbContext.TableExists("DensityCodes");
bool devicesExists = DbContext.TableExists("Devices");
bool deviceStatsExists = DbContext.TableExists("DeviceStats");
bool filesystemsExists = DbContext.TableExists("Filesystems");
bool filtersExists = DbContext.TableExists("Filters");
bool fireWiresExists = DbContext.TableExists("FireWires");
bool mediaExists = DbContext.TableExists("Media");
bool mediaFormatsExists = DbContext.TableExists("MediaFormats");
bool mmcFeaturesExists = DbContext.TableExists("MmcFeatures");
bool mmcsExists = DbContext.TableExists("Mmcs");
bool mmcSdsExists = DbContext.TableExists("MmcSds");
bool operatingSystemsExists = DbContext.TableExists("OperatingSystems");
bool partitionsExists = DbContext.TableExists("Partitions");
bool pcmciasExists = DbContext.TableExists("Pcmcias");
bool scsiModesExists = DbContext.TableExists("ScsiModes");
bool scsiPagesExists = DbContext.TableExists("ScsiPages");
bool scsisExists = DbContext.TableExists("Scsis");
bool sscsExists = DbContext.TableExists("Sscs");
bool sscSupportedMediasExists = DbContext.TableExists("SscSupportedMedias");
bool supportedDensitiesExists = DbContext.TableExists("SupportedDensities");
bool testedMediasExists = DbContext.TableExists("TestedMedias");
bool testedSequentialMediasExists = DbContext.TableExists("TestedSequentialMedias");
bool uploadedReportsExists = DbContext.TableExists("UploadedReports");
bool usbProductsExists = DbContext.TableExists("UsbProducts");
bool usbsExists = DbContext.TableExists("Usbs");
bool usbVendorsExists = DbContext.TableExists("UsbVendors");
bool versionsExists = DbContext.TableExists("Versions");
bool efExists = DbContext.TableExists("__MigrationHistory");
#endregion
#region Drop old restrictions

View File

@@ -1,14 +1,13 @@
// <auto-generated />
using System;
using Aaru.Server.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
[DbContext(typeof(AaruServerContext))]
[DbContext(typeof(DbContext))]
[Migration("20191102231633_MakeFieldsUnsigned")]
partial class MakeFieldsUnsigned
{

View File

@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
public partial class MakeFieldsUnsigned : Migration
{

View File

@@ -1,14 +1,13 @@
// <auto-generated />
using System;
using Aaru.Server.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
[DbContext(typeof(AaruServerContext))]
[DbContext(typeof(DbContext))]
[Migration("20191106230730_CreateIdentitySchema")]
partial class CreateIdentitySchema
{

View File

@@ -2,7 +2,7 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
public partial class CreateIdentitySchema : Migration
{

View File

@@ -1,14 +1,13 @@
// <auto-generated />
using System;
using Aaru.Server.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
[DbContext(typeof(AaruServerContext))]
[DbContext(typeof(DbContext))]
[Migration("20191108004756_SetAllOnDeleteSetNull")]
partial class SetAllOnDeleteSetNull
{

View File

@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
public partial class SetAllOnDeleteSetNull : Migration
{

View File

@@ -1,14 +1,13 @@
// <auto-generated />
using System;
using Aaru.Server.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
[DbContext(typeof(AaruServerContext))]
[DbContext(typeof(DbContext))]
[Migration("20191110143605_CascadeDeleteDensityCodes")]
partial class CascadeDeleteDensityCodes
{

View File

@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
public partial class CascadeDeleteDensityCodes : Migration
{

View File

@@ -1,14 +1,13 @@
// <auto-generated />
using System;
using Aaru.Server.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
[DbContext(typeof(AaruServerContext))]
[DbContext(typeof(DbContext))]
[Migration("20191110144834_CascadeDeleteBlockDescriptors")]
partial class CascadeDeleteBlockDescriptors
{

View File

@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
public partial class CascadeDeleteBlockDescriptors : Migration
{

View File

@@ -1,14 +1,13 @@
// <auto-generated />
using System;
using Aaru.Server.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
[DbContext(typeof(AaruServerContext))]
[DbContext(typeof(DbContext))]
[Migration("20191113003156_CascadeDeleteMmcFeatures")]
partial class CascadeDeleteMmcFeatures
{

View File

@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
public partial class CascadeDeleteMmcFeatures : Migration
{

View File

@@ -1,14 +1,13 @@
// <auto-generated />
using System;
using Aaru.Server.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
[DbContext(typeof(AaruServerContext))]
[DbContext(typeof(DbContext))]
[Migration("20191117215158_CascadeDeleteSupportedDensities")]
partial class CascadeDeleteSupportedDensities
{

View File

@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
public partial class CascadeDeleteSupportedDensities : Migration
{

View File

@@ -1,14 +1,13 @@
// <auto-generated />
using System;
using Aaru.Server.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
[DbContext(typeof(AaruServerContext))]
[DbContext(typeof(DbContext))]
[Migration("20191124212117_EFTypesUpdate")]
partial class EFTypesUpdate
{

View File

@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
public partial class EFTypesUpdate : Migration
{

View File

@@ -1,14 +1,13 @@
// <auto-generated />
using System;
using Aaru.Server.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
[DbContext(typeof(AaruServerContext))]
[DbContext(typeof(DbContext))]
[Migration("20191124220655_AddSupportsScrambledReadCd")]
partial class AddSupportsScrambledReadCd
{

View File

@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
public partial class AddSupportsScrambledReadCd : Migration
{

View File

@@ -1,14 +1,13 @@
// <auto-generated />
using System;
using Aaru.Server.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
[DbContext(typeof(AaruServerContext))]
[DbContext(typeof(DbContext))]
[Migration("20191203212552_NameCountModel")]
partial class NameCountModel
{

View File

@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
public partial class NameCountModel : Migration
{

View File

@@ -1,14 +1,13 @@
// <auto-generated />
using System;
using Aaru.Server.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
[DbContext(typeof(AaruServerContext))]
[DbContext(typeof(DbContext))]
[Migration("20191204182314_RemoteStatistics")]
partial class RemoteStatistics
{

View File

@@ -1,7 +1,7 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
public partial class RemoteStatistics : Migration
{

View File

@@ -1,14 +1,13 @@
// <auto-generated />
using System;
using Aaru.Server.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
[DbContext(typeof(AaruServerContext))]
[DbContext(typeof(DbContext))]
[Migration("20200710172932_AddGdRomSwapDiscCapabilities")]
partial class AddGdRomSwapDiscCapabilities
{

View File

@@ -1,7 +1,7 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
public partial class AddGdRomSwapDiscCapabilities : Migration
{

View File

@@ -1,14 +1,13 @@
// <auto-generated />
using System;
using Aaru.Server.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
[DbContext(typeof(AaruServerContext))]
[DbContext(typeof(DbContext))]
[Migration("20200710184810_AddCanReadGdRomUsingSwapDisc")]
partial class AddCanReadGdRomUsingSwapDisc
{

View File

@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
public partial class AddCanReadGdRomUsingSwapDisc : Migration
{

View File

@@ -1,14 +1,13 @@
// <auto-generated />
using System;
using Aaru.Server.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
[DbContext(typeof(AaruServerContext))]
[DbContext(typeof(DbContext))]
[Migration("20200710200444_AddAudioFieldsToGdromReadCapabilities")]
partial class AddAudioFieldsToGdromReadCapabilities
{

View File

@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
public partial class AddAudioFieldsToGdromReadCapabilities : Migration
{

View File

@@ -1,14 +1,13 @@
// <auto-generated />
using System;
using Aaru.Server.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
[DbContext(typeof(AaruServerContext))]
[DbContext(typeof(DbContext))]
[Migration("20200711180338_AddFieldsForF1hCommand06hSubcommand")]
partial class AddFieldsForF1hCommand06hSubcommand
{

View File

@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
public partial class AddFieldsForF1hCommand06hSubcommand : Migration
{

View File

@@ -1,14 +1,13 @@
// <auto-generated />
using System;
using Aaru.Server.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
[DbContext(typeof(AaruServerContext))]
[DbContext(typeof(DbContext))]
[Migration("20200711231045_FixGdRomCapabilitiesFieldName")]
partial class FixGdRomCapabilitiesFieldName
{

View File

@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
public partial class FixGdRomCapabilitiesFieldName : Migration
{

View File

@@ -1,6 +1,5 @@
// <auto-generated />
using System;
using Aaru.Server.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
@@ -8,9 +7,9 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
[DbContext(typeof(AaruServerContext))]
[DbContext(typeof(DbContext))]
[Migration("20211208215447_AddNesHeaders")]
partial class AddNesHeaders
{

View File

@@ -4,7 +4,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
public partial class AddNesHeaders : Migration
{

View File

@@ -1,15 +1,14 @@
// <auto-generated />
using System;
using Aaru.Server.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Aaru.Server.Migrations
namespace Aaru.Server.Database.Migrations
{
[DbContext(typeof(AaruServerContext))]
[DbContext(typeof(DbContext))]
partial class AaruServerContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public abstract class BaseModel<T>
{

View File

@@ -30,7 +30,7 @@
// Copyright © 2011-2024 Natalia Portillo
// ****************************************************************************/
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public abstract class BaseOperatingSystem : BaseModel<int>
{

View File

@@ -33,7 +33,7 @@
using System.ComponentModel;
using Aaru.CommonTypes.Metadata;
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class CompactDiscOffset : CdOffset
{

View File

@@ -1,4 +1,4 @@
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class ChsModel
{

View File

@@ -30,6 +30,6 @@
// Copyright © 2011-2024 Natalia Portillo
// ****************************************************************************/
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class Command : NameCountModel<int> {}

View File

@@ -1,4 +1,4 @@
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class CompareModel
{

View File

@@ -34,7 +34,7 @@ using System.ComponentModel;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Metadata;
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class Device : DeviceReportV2
{

View File

@@ -1,6 +1,6 @@
using Aaru.CommonTypes.Metadata;
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class DeviceDetails
{

View File

@@ -30,7 +30,7 @@
// Copyright © 2011-2024 Natalia Portillo
// ****************************************************************************/
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class DeviceItem
{

View File

@@ -30,7 +30,7 @@
// Copyright © 2011-2024 Natalia Portillo
// ****************************************************************************/
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class DeviceStat : BaseModel<int>
{

View File

@@ -1,4 +1,4 @@
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class ErrorViewModel
{

View File

@@ -30,6 +30,6 @@
// Copyright © 2011-2024 Natalia Portillo
// ****************************************************************************/
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class Filesystem : NameCountModel<int> {}

View File

@@ -30,6 +30,6 @@
// Copyright © 2011-2024 Natalia Portillo
// ****************************************************************************/
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class Filter : NameCountModel<int> {}

View File

@@ -1,4 +1,4 @@
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class FindReportModel : BaseModel<int>
{

View File

@@ -1,7 +1,7 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class FireWireModel
{

View File

@@ -1,4 +1,4 @@
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class IdHashModel : BaseModel<int>
{

View File

@@ -1,4 +1,4 @@
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class IdHashModelForView
{

View File

@@ -34,7 +34,7 @@ using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
using Aaru.CommonTypes;
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class Media : BaseModel<int>
{

View File

@@ -30,6 +30,6 @@
// Copyright © 2011-2024 Natalia Portillo
// ****************************************************************************/
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class MediaFormat : NameCountModel<int> {}

View File

@@ -30,7 +30,7 @@
// Copyright © 2011-2024 Natalia Portillo
// ****************************************************************************/
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class MediaItem
{

View File

@@ -1,7 +1,7 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class MmcModelForView : BaseModel<int>
{

View File

@@ -1,4 +1,4 @@
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public abstract class NameCountModel<T> : BaseModel<T>
{

View File

@@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
using Aaru.CommonTypes.Enums;
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class NesHeaderInfo : BaseModel<int>
{

View File

@@ -30,6 +30,6 @@
// Copyright © 2011-2024 Natalia Portillo
// ****************************************************************************/
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class OperatingSystem : BaseOperatingSystem {}

View File

@@ -30,6 +30,6 @@
// Copyright © 2011-2024 Natalia Portillo
// ****************************************************************************/
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class Partition : NameCountModel<int> {}

View File

@@ -30,6 +30,6 @@
// Copyright © 2011-2024 Natalia Portillo
// ****************************************************************************/
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class RemoteApplication : BaseOperatingSystem {}

View File

@@ -30,6 +30,6 @@
// Copyright © 2011-2024 Natalia Portillo
// ****************************************************************************/
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class RemoteArchitecture : NameCountModel<int> {}

View File

@@ -30,6 +30,6 @@
// Copyright © 2011-2024 Natalia Portillo
// ****************************************************************************/
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class RemoteOperatingSystem : BaseOperatingSystem {}

View File

@@ -1,4 +1,4 @@
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class SscModel
{

View File

@@ -1,4 +1,4 @@
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class TestedMediaDataModel
{

View File

@@ -33,7 +33,7 @@
using System.ComponentModel;
using Aaru.CommonTypes.Metadata;
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class UploadedReport : DeviceReportV2
{

View File

@@ -1,6 +1,6 @@
using Aaru.CommonTypes.Metadata;
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class UploadedReportDetails
{

View File

@@ -1,4 +1,4 @@
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class UsbModel
{

View File

@@ -30,9 +30,9 @@
// Copyright © 2011-2024 Natalia Portillo
// ****************************************************************************/
using Newtonsoft.Json;
using System.Text.Json.Serialization;
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class UsbProduct : BaseModel<int>
{

View File

@@ -1,7 +1,7 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class UsbProductModel
{

View File

@@ -32,9 +32,9 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using Newtonsoft.Json;
using System.Text.Json.Serialization;
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class UsbVendor : BaseModel<int>
{

View File

@@ -1,7 +1,7 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class UsbVendorModel
{

View File

@@ -30,6 +30,6 @@
// Copyright © 2011-2024 Natalia Portillo
// ****************************************************************************/
namespace Aaru.Server.Models;
namespace Aaru.Server.Database.Models;
public class Version : NameCountModel<int> {}

View File

@@ -38,9 +38,10 @@ using System.Net;
using System.Security.Cryptography;
using System.Text.Json;
using Aaru.CommonTypes.Enums;
using Aaru.Server.Models;
using Aaru.Server.Database.Models;
using HtmlAgilityPack;
using Microsoft.EntityFrameworkCore;
using DbContext = Aaru.Server.Database.DbContext;
namespace Aaru.Server.Task;
@@ -53,7 +54,7 @@ class Program
start = DateTime.UtcNow;
System.Console.WriteLine("{0}: Connecting to database...", DateTime.UtcNow);
var ctx = new AaruServerContext();
var ctx = new DbContext();
end = DateTime.UtcNow;
System.Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds);

View File

@@ -22,6 +22,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aaru.Server.Api", "Aaru.Ser
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aaru.Server.New", "Aaru.Server.New\Aaru.Server.New.csproj", "{032D24BA-EC3B-4BD1-ADD6-9463E2DC5D7E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aaru.Server.Database", "Aaru.Server.Database\Aaru.Server.Database.csproj", "{FA830C89-B3C4-4139-B756-B6C0F35C0BB4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -44,6 +46,10 @@ Global
{032D24BA-EC3B-4BD1-ADD6-9463E2DC5D7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{032D24BA-EC3B-4BD1-ADD6-9463E2DC5D7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{032D24BA-EC3B-4BD1-ADD6-9463E2DC5D7E}.Release|Any CPU.Build.0 = Release|Any CPU
{FA830C89-B3C4-4139-B756-B6C0F35C0BB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FA830C89-B3C4-4139-B756-B6C0F35C0BB4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA830C89-B3C4-4139-B756-B6C0F35C0BB4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FA830C89-B3C4-4139-B756-B6C0F35C0BB4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -32,15 +32,9 @@
<PackageReference Include="MailKit" Version="2.15.0"/>
<PackageReference Include="Markdig" Version="0.26.0"/>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.19.0"/>
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.0"/>
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.0"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.0"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="6.0.0"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0"/>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.0"/>
<PackageReference Include="MimeKit" Version="2.15.1"/>
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.0"/>
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql.Design" Version="1.1.2"/>
<PackageReference Include="prometheus-net.AspNetCore" Version="5.0.2"/>
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.4.2" PrivateAssets="all"/>
<PackageReference Include="AsyncFixer" Version="1.6.0">
@@ -184,4 +178,8 @@
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Aaru.Server.Database\Aaru.Server.Database.csproj"/>
</ItemGroup>
</Project>

View File

@@ -1,8 +1,10 @@
using System.Reflection;
using Aaru.CommonTypes.Structs.Devices.ATA;
using Aaru.Server.Core;
using Aaru.Server.Database.Models;
using Newtonsoft.Json;
using Ata = Aaru.CommonTypes.Metadata.Ata;
using DbContext = Aaru.Server.Database.DbContext;
using TestedMedia = Aaru.CommonTypes.Metadata.TestedMedia;
namespace Aaru.Server.Areas.Admin.Controllers;
@@ -11,9 +13,9 @@ namespace Aaru.Server.Areas.Admin.Controllers;
[Authorize]
public sealed class AtasController : Controller
{
readonly AaruServerContext _context;
readonly DbContext _context;
public AtasController(AaruServerContext context) => _context = context;
public AtasController(DbContext context) => _context = context;
// GET: Admin/Atas
public IActionResult Index() => View(_context.Ata.AsEnumerable()

View File

@@ -1,12 +1,14 @@
using DbContext = Aaru.Server.Database.DbContext;
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin")]
[Authorize]
public sealed class BlockDescriptorsController : Controller
{
readonly AaruServerContext _context;
readonly DbContext _context;
public BlockDescriptorsController(AaruServerContext context) => _context = context;
public BlockDescriptorsController(DbContext context) => _context = context;
// GET: Admin/BlockDescriptors
public async Task<IActionResult> Index() => View(await _context.BlockDescriptor.OrderBy(b => b.BlockLength)

View File

@@ -1,5 +1,7 @@
using Aaru.CommonTypes.Metadata;
using Aaru.Server.Database.Models;
using Newtonsoft.Json;
using DbContext = Aaru.Server.Database.DbContext;
namespace Aaru.Server.Areas.Admin.Controllers;
@@ -7,9 +9,9 @@ namespace Aaru.Server.Areas.Admin.Controllers;
[Authorize]
public sealed class ChsController : Controller
{
readonly AaruServerContext _context;
readonly DbContext _context;
public ChsController(AaruServerContext context) => _context = context;
public ChsController(DbContext context) => _context = context;
// GET: Admin/Chs
public async Task<IActionResult> Index() => View(await _context.Chs.OrderBy(c => c.Cylinders)

View File

@@ -1,12 +1,14 @@
using DbContext = Aaru.Server.Database.DbContext;
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin")]
[Authorize]
public sealed class CommandsController : Controller
{
readonly AaruServerContext _context;
readonly DbContext _context;
public CommandsController(AaruServerContext context) => _context = context;
public CommandsController(DbContext context) => _context = context;
// GET: Admin/Commands
public async Task<IActionResult> Index() => View(await _context.Commands.OrderBy(c => c.Name).ToListAsync());

View File

@@ -1,12 +1,15 @@
using Aaru.Server.Database.Models;
using DbContext = Aaru.Server.Database.DbContext;
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin")]
[Authorize]
public sealed class CompactDiscOffsetsController : Controller
{
readonly AaruServerContext _context;
readonly DbContext _context;
public CompactDiscOffsetsController(AaruServerContext context) => _context = context;
public CompactDiscOffsetsController(DbContext context) => _context = context;
// GET: Admin/CompactDiscOffsets
public async Task<IActionResult> Index() => View(await _context.CdOffsets.OrderBy(o => o.Manufacturer)

View File

@@ -1,12 +1,15 @@
using Aaru.Server.Database.Models;
using DbContext = Aaru.Server.Database.DbContext;
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin")]
[Authorize]
public sealed class DeviceStatsController : Controller
{
readonly AaruServerContext _context;
readonly DbContext _context;
public DeviceStatsController(AaruServerContext context) => _context = context;
public DeviceStatsController(DbContext context) => _context = context;
// GET: Admin/DeviceStats
public async Task<IActionResult> Index() => View(await _context.DeviceStats.OrderBy(d => d.Manufacturer)

View File

@@ -1,4 +1,6 @@
using Aaru.CommonTypes.Metadata;
using Aaru.Server.Database.Models;
using DbContext = Aaru.Server.Database.DbContext;
namespace Aaru.Server.Areas.Admin.Controllers;
@@ -6,9 +8,9 @@ namespace Aaru.Server.Areas.Admin.Controllers;
[Authorize]
public sealed class DevicesController : Controller
{
readonly AaruServerContext _context;
readonly DbContext _context;
public DevicesController(AaruServerContext context) => _context = context;
public DevicesController(DbContext context) => _context = context;
// GET: Admin/Devices
public async Task<IActionResult> Index() => View(await _context.Devices.OrderBy(d => d.Manufacturer)

View File

@@ -1,12 +1,14 @@
using DbContext = Aaru.Server.Database.DbContext;
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin")]
[Authorize]
public sealed class FilesystemsController : Controller
{
readonly AaruServerContext _context;
readonly DbContext _context;
public FilesystemsController(AaruServerContext context) => _context = context;
public FilesystemsController(DbContext context) => _context = context;
// GET: Admin/Filesystems
public async Task<IActionResult> Index() => View(await _context.Filesystems.OrderBy(f => f.Name).ToListAsync());

View File

@@ -1,12 +1,14 @@
using DbContext = Aaru.Server.Database.DbContext;
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin")]
[Authorize]
public sealed class FiltersController : Controller
{
readonly AaruServerContext _context;
readonly DbContext _context;
public FiltersController(AaruServerContext context) => _context = context;
public FiltersController(DbContext context) => _context = context;
// GET: Admin/Filters
public async Task<IActionResult> Index() => View(await _context.Filters.OrderBy(f => f.Name).ToListAsync());

View File

@@ -1,5 +1,7 @@
using Aaru.CommonTypes.Metadata;
using Aaru.Server.Database.Models;
using Newtonsoft.Json;
using DbContext = Aaru.Server.Database.DbContext;
namespace Aaru.Server.Areas.Admin.Controllers;
@@ -7,9 +9,9 @@ namespace Aaru.Server.Areas.Admin.Controllers;
[Authorize]
public sealed class FireWiresController : Controller
{
readonly AaruServerContext _context;
readonly DbContext _context;
public FireWiresController(AaruServerContext context) => _context = context;
public FireWiresController(DbContext context) => _context = context;
// GET: Admin/FireWires
public async Task<IActionResult> Index() =>

View File

@@ -3,6 +3,8 @@ using System.Web;
using Aaru.CommonTypes.Metadata;
using Aaru.Decoders.CD;
using Aaru.Helpers;
using Aaru.Server.Database.Models;
using DbContext = Aaru.Server.Database.DbContext;
namespace Aaru.Server.Areas.Admin.Controllers;
@@ -10,9 +12,9 @@ namespace Aaru.Server.Areas.Admin.Controllers;
[Authorize]
public sealed class GdRomSwapDiscCapabilitiesController : Controller
{
readonly AaruServerContext _context;
readonly DbContext _context;
public GdRomSwapDiscCapabilitiesController(AaruServerContext context) => _context = context;
public GdRomSwapDiscCapabilitiesController(DbContext context) => _context = context;
// GET: Admin/GdRomSwapDiscCapabilities/Details/5
public async Task<IActionResult> Details(int? id)

View File

@@ -1,12 +1,15 @@
using Aaru.Server.Database.Models;
using DbContext = Aaru.Server.Database.DbContext;
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin")]
[Authorize]
public sealed class MediaFormatsController : Controller
{
readonly AaruServerContext _context;
readonly DbContext _context;
public MediaFormatsController(AaruServerContext context) => _context = context;
public MediaFormatsController(DbContext context) => _context = context;
// GET: Admin/MediaFormats
public async Task<IActionResult> Index() => View(await _context.MediaFormats.OrderBy(mf => mf.Name).ToListAsync());

View File

@@ -1,12 +1,15 @@
using Aaru.Server.Database.Models;
using DbContext = Aaru.Server.Database.DbContext;
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin")]
[Authorize]
public sealed class MediasController : Controller
{
readonly AaruServerContext _context;
readonly DbContext _context;
public MediasController(AaruServerContext context) => _context = context;
public MediasController(DbContext context) => _context = context;
// GET: Admin/Medias
public IActionResult Index(bool? real)

View File

@@ -1,4 +1,6 @@
using Aaru.CommonTypes.Metadata;
using Aaru.Server.Database.Models;
using DbContext = Aaru.Server.Database.DbContext;
namespace Aaru.Server.Areas.Admin.Controllers;
@@ -6,9 +8,9 @@ namespace Aaru.Server.Areas.Admin.Controllers;
[Authorize]
public sealed class MmcController : Controller
{
readonly AaruServerContext _context;
readonly DbContext _context;
public MmcController(AaruServerContext context) => _context = context;
public MmcController(DbContext context) => _context = context;
// GET: Admin/Mmc
public IActionResult Index() => View(_context.Mmc.Where(m => m.ModeSense2AData != null)

View File

@@ -1,4 +1,5 @@
using Aaru.CommonTypes.Metadata;
using DbContext = Aaru.Server.Database.DbContext;
namespace Aaru.Server.Areas.Admin.Controllers;
@@ -6,9 +7,9 @@ namespace Aaru.Server.Areas.Admin.Controllers;
[Authorize]
public sealed class MmcFeaturesController : Controller
{
readonly AaruServerContext _context;
readonly DbContext _context;
public MmcFeaturesController(AaruServerContext context) => _context = context;
public MmcFeaturesController(DbContext context) => _context = context;
// GET: Admin/MmcFeatures
public async Task<IActionResult> Index() => View(await _context.MmcFeatures.ToListAsync());

View File

@@ -1,4 +1,5 @@
using Aaru.CommonTypes.Metadata;
using DbContext = Aaru.Server.Database.DbContext;
namespace Aaru.Server.Areas.Admin.Controllers;
@@ -6,9 +7,9 @@ namespace Aaru.Server.Areas.Admin.Controllers;
[Authorize]
public sealed class MmcSdsController : Controller
{
readonly AaruServerContext _context;
readonly DbContext _context;
public MmcSdsController(AaruServerContext context) => _context = context;
public MmcSdsController(DbContext context) => _context = context;
// GET: Admin/MmcSds
public async Task<IActionResult> Index() => View(await _context.MmcSd.ToListAsync());

View File

@@ -1,12 +1,14 @@
using DbContext = Aaru.Server.Database.DbContext;
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin")]
[Authorize]
public sealed class OperatingSystemsController : Controller
{
readonly AaruServerContext _context;
readonly DbContext _context;
public OperatingSystemsController(AaruServerContext context) => _context = context;
public OperatingSystemsController(DbContext context) => _context = context;
// GET: Admin/OperatingSystems
public async Task<IActionResult> Index() =>

View File

@@ -1,12 +1,14 @@
using DbContext = Aaru.Server.Database.DbContext;
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin")]
[Authorize]
public sealed class PartitionsController : Controller
{
readonly AaruServerContext _context;
readonly DbContext _context;
public PartitionsController(AaruServerContext context) => _context = context;
public PartitionsController(DbContext context) => _context = context;
// GET: Admin/Partitions
public async Task<IActionResult> Index() => View(await _context.Partitions.OrderBy(p => p.Name).ToListAsync());

View File

@@ -1,4 +1,5 @@
using Aaru.CommonTypes.Metadata;
using DbContext = Aaru.Server.Database.DbContext;
namespace Aaru.Server.Areas.Admin.Controllers;
@@ -6,9 +7,9 @@ namespace Aaru.Server.Areas.Admin.Controllers;
[Authorize]
public sealed class PcmciasController : Controller
{
readonly AaruServerContext _context;
readonly DbContext _context;
public PcmciasController(AaruServerContext context) => _context = context;
public PcmciasController(DbContext context) => _context = context;
// GET: Admin/Pcmcias
public async Task<IActionResult> Index() => View(await _context.Pcmcia.ToListAsync());

View File

@@ -1,5 +1,7 @@
using Aaru.CommonTypes.Metadata;
using Aaru.Server.Database.Models;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using DbContext = Aaru.Server.Database.DbContext;
namespace Aaru.Server.Areas.Admin.Controllers;
@@ -7,9 +9,9 @@ namespace Aaru.Server.Areas.Admin.Controllers;
[Authorize]
public sealed class ReportsController : Controller
{
readonly AaruServerContext _context;
readonly DbContext _context;
public ReportsController(AaruServerContext context) => _context = context;
public ReportsController(DbContext context) => _context = context;
// GET: Admin/Reports
public async Task<IActionResult> Index() => View(await _context.Reports.OrderBy(r => r.Manufacturer)

Some files were not shown because too many files have changed in this diff Show More