mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Changes I forgot to include
This commit is contained in:
parent
220382a3a8
commit
eef41fc908
71
Wabbajack.BuildServer.Test/NexusCacheTests.cs
Normal file
71
Wabbajack.BuildServer.Test/NexusCacheTests.cs
Normal file
@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Wabbajack.BuildServer.Model.Models;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Lib;
|
||||
using Wabbajack.Lib.NexusApi;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
using Xunit.Priority;
|
||||
|
||||
namespace Wabbajack.BuildServer.Test
|
||||
{
|
||||
public class NexusCacheTests : ABuildServerSystemTest
|
||||
{
|
||||
public NexusCacheTests(ITestOutputHelper output, SingletonAdaptor<BuildServerFixture> fixture) : base(output, fixture)
|
||||
{
|
||||
}
|
||||
|
||||
[Fact, Priority(2)]
|
||||
public async Task CanIngestNexusCacheExports()
|
||||
{
|
||||
await @"sql\nexus_export.json".RelativeTo(AbsolutePath.EntryPoint).CopyToAsync("nexus_export.json".RelativeTo(Fixture.ServerTempFolder));
|
||||
var result = await _authedClient.GetStringAsync(MakeURL("nexus_cache/ingest"));
|
||||
|
||||
Assert.Equal("15237", result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestCanGetModInfo()
|
||||
{
|
||||
var sqlService = Fixture.GetService<SqlService>();
|
||||
var modId = long.MaxValue >> 1;
|
||||
await sqlService.AddNexusModInfo(Game.SkyrimSpecialEdition, modId, DateTime.Now,
|
||||
new ModInfo {author = "Buzz", uploaded_by = "bille"});
|
||||
|
||||
var api = await NexusApiClient.Get();
|
||||
|
||||
var modInfoResponse = await api.GetModInfo(Game.SkyrimSpecialEdition, modId);
|
||||
|
||||
Assert.Equal("Buzz", modInfoResponse.author);
|
||||
Assert.Equal("bille", modInfoResponse.uploaded_by);
|
||||
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestCanGetModFiles()
|
||||
{
|
||||
var sqlService = Fixture.GetService<SqlService>();
|
||||
var modId = long.MaxValue >> 1;
|
||||
var fileId = long.MaxValue >> 2;
|
||||
await sqlService.AddNexusModFiles(Game.SkyrimSpecialEdition, modId, DateTime.Now,
|
||||
new NexusApiClient.GetModFilesResponse {files = new List<NexusFileInfo>
|
||||
{
|
||||
new NexusFileInfo
|
||||
{
|
||||
file_name = "blerg"
|
||||
}
|
||||
}});
|
||||
|
||||
var api = await NexusApiClient.Get();
|
||||
|
||||
var modInfoResponse = await api.GetModFiles(Game.SkyrimSpecialEdition, modId);
|
||||
|
||||
Assert.Single(modInfoResponse.files);
|
||||
Assert.Equal("blerg", modInfoResponse.files.First().file_name);
|
||||
}
|
||||
}
|
||||
}
|
@ -56,6 +56,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="sql\DownloadStates" />
|
||||
<Folder Include="sql\NexusCache" />
|
||||
<Folder Include="sql\NotifyStates" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -269,6 +269,66 @@ FROM
|
||||
LEFT JOIN dbo.ArchiveContent ac on af.Child = ac.Child
|
||||
LEFT JOIN dbo.IndexedFile idx on af.Child = idx.Hash
|
||||
GO
|
||||
|
||||
/****** Object: Table [dbo].[NexusFileInfos] Script Date: 4/1/2020 2:41:00 PM ******/
|
||||
CREATE TABLE [dbo].[NexusFileInfos](
|
||||
[Game] [int] NOT NULL,
|
||||
[ModId] [bigint] NOT NULL,
|
||||
[FileId] [bigint] NOT NULL,
|
||||
[LastChecked] [datetime] NOT NULL,
|
||||
[Data] [nvarchar](max) NOT NULL,
|
||||
CONSTRAINT [PK_NexusFileInfos] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[Game] ASC,
|
||||
[ModId] ASC,
|
||||
[FileId] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
|
||||
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
||||
GO
|
||||
|
||||
/****** Object: Table [dbo].[NexusModFiles] Script Date: 4/1/2020 2:41:04 PM ******/
|
||||
|
||||
CREATE TABLE [dbo].[NexusModFiles](
|
||||
[Game] [int] NOT NULL,
|
||||
[ModId] [bigint] NOT NULL,
|
||||
[LastChecked] [datetime] NOT NULL,
|
||||
[Data] [nvarchar](max) NOT NULL,
|
||||
CONSTRAINT [PK_NexusModFiles] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[Game] ASC,
|
||||
[ModId] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
|
||||
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
||||
GO
|
||||
|
||||
/****** Object: Table [dbo].[NexusModInfos] Script Date: 4/1/2020 2:41:07 PM ******/
|
||||
|
||||
CREATE TABLE [dbo].[NexusModInfos](
|
||||
[Game] [int] NOT NULL,
|
||||
[ModId] [bigint] NOT NULL,
|
||||
[LastChecked] [datetime] NOT NULL,
|
||||
[Data] [nvarchar](max) NOT NULL,
|
||||
CONSTRAINT [PK_NexusModInfos] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[Game] ASC,
|
||||
[ModId] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
|
||||
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
||||
GO
|
||||
|
||||
/****** Object: Table [dbo].[ModLists] Script Date: 4/2/2020 3:59:19 PM ******/
|
||||
CREATE TABLE [dbo].[ModLists](
|
||||
[MachineURL] [nvarchar](50) NOT NULL,
|
||||
[Summary] [nvarchar](max) NOT NULL,
|
||||
[Metadata] [nvarchar](max) NOT NULL,
|
||||
[DetailedStatus] [nvarchar](max) NOT NULL,
|
||||
CONSTRAINT [PK_ModLists] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[MachineURL] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
|
||||
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
||||
GO
|
||||
|
||||
/****** Object: Table [dbo].[Metrics] Script Date: 3/28/2020 4:58:59 PM ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
|
@ -1,12 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using CsvHelper;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MongoDB.Driver;
|
||||
using Newtonsoft.Json;
|
||||
using Wabbajack.BuildServer.Model.Models;
|
||||
using Wabbajack.BuildServer.Models;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Lib;
|
||||
using Wabbajack.Lib.NexusApi;
|
||||
|
||||
namespace Wabbajack.BuildServer.Controllers
|
||||
@ -16,8 +24,13 @@ namespace Wabbajack.BuildServer.Controllers
|
||||
[Route("/v1/games/")]
|
||||
public class NexusCache : AControllerBase<NexusCache>
|
||||
{
|
||||
public NexusCache(ILogger<NexusCache> logger, DBContext db, SqlService sql) : base(logger, db, sql)
|
||||
private AppSettings _settings;
|
||||
private static long CachedCount = 0;
|
||||
private static long ForwardCount = 0;
|
||||
|
||||
public NexusCache(ILogger<NexusCache> logger, DBContext db, SqlService sql, AppSettings settings) : base(logger, db, sql)
|
||||
{
|
||||
_settings = settings;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BunnyCDN.Net.Storage" Version="1.0.2" />
|
||||
<PackageReference Include="CsvHelper" Version="15.0.3" />
|
||||
<PackageReference Include="Dapper" Version="2.0.30" />
|
||||
<PackageReference Include="FluentFTP" Version="32.2.2" />
|
||||
<PackageReference Include="graphiql" Version="1.2.0" />
|
||||
|
Loading…
Reference in New Issue
Block a user