├── LICENSE.md
├── MetadataServer
├── appsettings.Development.json
├── .config
│ └── dotnet-tools.json
├── Connectors
│ ├── ConnectionStrings.cs
│ ├── IMySqlConnector.cs
│ └── MySqlConnector.cs
├── Models
│ ├── LatestData.cs
│ ├── CommentData.cs
│ ├── TelemetryTimingData.cs
│ ├── TelemetryErrorData.cs
│ ├── EventData.cs
│ ├── EventSummary.cs
│ ├── BuildData.cs
│ └── IssueData.cs
├── appsettings.json
├── MetadataServer.csproj
├── Program.cs
├── ActionConstraints
│ └── ExactQueryParam.cs
├── Controllers
│ ├── LatestController.cs
│ ├── TelemetryController.cs
│ ├── BuildController.cs
│ ├── EventController.cs
│ ├── CommentController.cs
│ ├── ErrorController.cs
│ └── IssuesController.cs
├── Properties
│ └── launchSettings.json
├── Startup.cs
└── Setup.sql
├── README.md
├── UnrealGameSync.sln
└── .gitignore
/LICENSE.md:
--------------------------------------------------------------------------------
1 | Use of the Unreal Engine is governed by the terms of the Unreal® Engine End User License Agreement, which can be found at [https://www.unrealengine.com/eula](https://www.unrealengine.com/eula).
2 |
--------------------------------------------------------------------------------
/MetadataServer/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/MetadataServer/.config/dotnet-tools.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 1,
3 | "isRoot": true,
4 | "tools": {
5 | "dotnet-ef": {
6 | "version": "5.0.6",
7 | "commands": [
8 | "dotnet-ef"
9 | ]
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/MetadataServer/Connectors/ConnectionStrings.cs:
--------------------------------------------------------------------------------
1 | // Copyright CodeWareGames. All Rights Reserved.
2 |
3 | namespace MetadataServer.Connectors
4 | {
5 | public class ConnectionStrings
6 | {
7 | public string MySqlConnection { get; set; }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/MetadataServer/Models/LatestData.cs:
--------------------------------------------------------------------------------
1 | // Copyright Epic Games, Inc. All Rights Reserved.
2 |
3 | namespace MetadataServer.Models
4 | {
5 | public class LatestData
6 | {
7 | public long LastEventId { get; set; }
8 | public long LastCommentId { get; set; }
9 | public long LastBuildId { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/MetadataServer/Models/CommentData.cs:
--------------------------------------------------------------------------------
1 | // Copyright Epic Games, Inc. All Rights Reserved.
2 |
3 | namespace MetadataServer.Models
4 | {
5 | public class CommentData
6 | {
7 | public long Id;
8 | public int ChangeNumber;
9 | public string UserName;
10 | public string Text;
11 | public string Project;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/MetadataServer/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | },
9 | "AllowedHosts": "*",
10 | "ConnectionStrings": {
11 | "MySqlConnection": "server=localhost;UserId=service_account_username;password=service_account_password;"
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/MetadataServer/Models/TelemetryTimingData.cs:
--------------------------------------------------------------------------------
1 | // Copyright Epic Games, Inc. All Rights Reserved.
2 |
3 | using System;
4 |
5 | namespace MetadataServer.Models
6 | {
7 | public class TelemetryTimingData
8 | {
9 | public string Action;
10 | public string Result;
11 | public string UserName;
12 | public string Project;
13 | public DateTime Timestamp;
14 | public float Duration;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/MetadataServer/Models/TelemetryErrorData.cs:
--------------------------------------------------------------------------------
1 | // Copyright Epic Games, Inc. All Rights Reserved.
2 |
3 | using System;
4 |
5 | namespace MetadataServer.Models
6 | {
7 | public class TelemetryErrorData
8 | {
9 | public enum TelemetryErrorType
10 | {
11 | Crash,
12 | }
13 | public int Id;
14 | public TelemetryErrorType Type;
15 | public string Text;
16 | public string UserName;
17 | public string Project;
18 | public DateTime Timestamp;
19 | public string Version;
20 | public string IpAddress;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/MetadataServer/Models/EventData.cs:
--------------------------------------------------------------------------------
1 | // Copyright Epic Games, Inc. All Rights Reserved.
2 |
3 | namespace MetadataServer.Models
4 | {
5 | public class EventData
6 | {
7 | public enum EventType
8 | {
9 | Syncing,
10 |
11 | // Reviews
12 | Compiles,
13 | DoesNotCompile,
14 | Good,
15 | Bad,
16 | Unknown,
17 |
18 | // Starred builds
19 | Starred,
20 | Unstarred,
21 |
22 | // Investigating events
23 | Investigating,
24 | Resolved,
25 | }
26 |
27 | public long Id;
28 | public int Change;
29 | public string UserName;
30 | public EventType Type;
31 | public string Project;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/MetadataServer/MetadataServer.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net5.0
5 | Exe
6 | MetadataServer
7 | UnrealGameSync
8 | Copyright Epic Games, Inc. All Rights Reserved.
9 | Epic Games, Inc
10 |
11 | 9c556f1b-b661-441b-bbbd-c2ab4057dc4b
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/MetadataServer/Program.cs:
--------------------------------------------------------------------------------
1 | // Copyright Epic Games, Inc. All Rights Reserved.
2 | // Modifications Copyright CodeWareGames. All Rights Reserved.
3 |
4 | using Microsoft.AspNetCore.Hosting;
5 | using Microsoft.Extensions.Hosting;
6 |
7 | namespace MetadataServer
8 | {
9 | public class Program
10 | {
11 | public static void Main(string[] args)
12 | {
13 | CreateHostBuilder(args).Build().Run();
14 | }
15 |
16 | public static IHostBuilder CreateHostBuilder(string[] args) =>
17 | Host.CreateDefaultBuilder(args)
18 | .ConfigureWebHostDefaults(webBuilder =>
19 | {
20 | webBuilder.UseStartup();
21 | });
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/MetadataServer/Models/EventSummary.cs:
--------------------------------------------------------------------------------
1 | // Copyright Epic Games, Inc. All Rights Reserved.
2 |
3 | using System.Collections.Generic;
4 |
5 | namespace MetadataServer.Models
6 | {
7 | public class EventSummary
8 | {
9 | public enum ReviewVerdict
10 | {
11 | Unknown,
12 | Good,
13 | Bad,
14 | Mixed,
15 | }
16 |
17 | public int ChangeNumber;
18 | public ReviewVerdict Verdict;
19 | public List SyncEvents = new List();
20 | public List Reviews = new List();
21 | public List CurrentUsers = new List();
22 | public EventData LastStarReview;
23 | public List Builds = new List();
24 | public List Comments = new List();
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/MetadataServer/Models/BuildData.cs:
--------------------------------------------------------------------------------
1 | // Copyright Epic Games, Inc. All Rights Reserved.
2 |
3 | namespace MetadataServer.Models
4 | {
5 | public class BuildData
6 | {
7 | public enum BuildDataResult
8 | {
9 | Starting,
10 | Failure,
11 | Warning,
12 | Success,
13 | Skipped,
14 | }
15 |
16 | public long Id;
17 | public int ChangeNumber;
18 | public string BuildType;
19 | public BuildDataResult Result;
20 | public string Url;
21 | public string Project;
22 | public string ArchivePath;
23 |
24 | public bool IsSuccess
25 | {
26 | get { return Result == BuildDataResult.Success || Result == BuildDataResult.Warning; }
27 | }
28 |
29 | public bool IsFailure
30 | {
31 | get { return Result == BuildDataResult.Failure; }
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/MetadataServer/ActionConstraints/ExactQueryParam.cs:
--------------------------------------------------------------------------------
1 | // Copyright CodeWareGames. All Rights Reserved.
2 |
3 | using System;
4 | using System.Linq;
5 | using Microsoft.AspNetCore.Mvc.ActionConstraints;
6 |
7 | namespace MetadataServer.ActionConstraints
8 | {
9 | public class ExactQueryParamAttribute : Attribute, IActionConstraint
10 | {
11 | private readonly string[] keys;
12 |
13 | public ExactQueryParamAttribute(params string[] keys)
14 | {
15 | this.keys = keys;
16 | }
17 |
18 | public int Order => 0;
19 |
20 | public bool Accept(ActionConstraintContext context)
21 | {
22 | var query = context.RouteContext.HttpContext.Request.Query;
23 | return query.Count == keys.Length && keys.All(key => query.ContainsKey(key));
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | UnrealGameSync
4 |
5 |
6 |
7 | 
8 |
9 | This is a custom version of the MetadataServer (Component of [UnrealGameSync](https://docs.unrealengine.com/en-US/ProductionPipelines/DeployingTheEngine/UnrealGameSync/index.html)) updated to ASP.Net 5 with async/await functionality
10 |
11 | Requirements
12 | ---------------------------
13 | ASP.NET Core Runtime 5 Hosting Bundle or Above.
14 |
15 |
16 | Licensing
17 | ---------------------------
18 |
19 | The source code is governed by the [Unreal Engine End User License Agreement](https://www.unrealengine.com/eula). If you don't agree to those terms, as amended from time to time, you are not permitted to access or use the source code.
20 |
21 |
22 |
--------------------------------------------------------------------------------
/MetadataServer/Controllers/LatestController.cs:
--------------------------------------------------------------------------------
1 | // Copyright Epic Games, Inc. All Rights Reserved.
2 | // Modifications Copyright CodeWareGames. All Rights Reserved.
3 |
4 | using Microsoft.AspNetCore.Mvc;
5 | using System.Threading.Tasks;
6 | using MetadataServer.Connectors;
7 | using MetadataServer.Models;
8 |
9 | namespace MetadataServer.Controllers
10 | {
11 | [Route("api/[controller]")]
12 | [ApiController]
13 | public class LatestController : ControllerBase
14 | {
15 | private readonly IMySqlConnector _MySqlConnector;
16 | public LatestController(IMySqlConnector MySqlConnector)
17 | {
18 | _MySqlConnector = MySqlConnector;
19 | }
20 |
21 | [HttpGet]
22 | public async Task Get(string Project = null)
23 | {
24 | return await _MySqlConnector.GetLastIds(Project);
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/MetadataServer/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json.schemastore.org/launchsettings.json",
3 | "iisSettings": {
4 | "windowsAuthentication": false,
5 | "anonymousAuthentication": true,
6 | "iisExpress": {
7 | "applicationUrl": "http://localhost:40838",
8 | "sslPort": 0
9 | }
10 | },
11 | "profiles": {
12 | "IIS Express": {
13 | "commandName": "IISExpress",
14 | "launchBrowser": true,
15 | "launchUrl": "api/latest",
16 | "environmentVariables": {
17 | "ASPNETCORE_ENVIRONMENT": "Development"
18 | }
19 | },
20 | "MetadataServer": {
21 | "commandName": "Project",
22 | "dotnetRunMessages": "true",
23 | "launchBrowser": true,
24 | "launchUrl": "api/latest",
25 | "applicationUrl": "http://localhost:5000",
26 | "environmentVariables": {
27 | "ASPNETCORE_ENVIRONMENT": "Development"
28 | }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/MetadataServer/Controllers/TelemetryController.cs:
--------------------------------------------------------------------------------
1 | // Copyright Epic Games, Inc. All Rights Reserved.
2 | // Modifications Copyright CodeWareGames. All Rights Reserved.
3 |
4 | using Microsoft.AspNetCore.Mvc;
5 | using System.Threading.Tasks;
6 | using MetadataServer.Connectors;
7 | using MetadataServer.Models;
8 |
9 | namespace MetadataServer.Controllers
10 | {
11 | [Route("api/[controller]")]
12 | [ApiController]
13 | public class TelemetryController : ControllerBase
14 | {
15 | private readonly IMySqlConnector _MySqlConnector;
16 | public TelemetryController(IMySqlConnector MySqlConnector)
17 | {
18 | _MySqlConnector = MySqlConnector;
19 | }
20 |
21 | [HttpPost]
22 | public async Task Post([FromBody] TelemetryTimingData Data, string Version, string IpAddress)
23 | {
24 | return await _MySqlConnector.PostTelemetryData(Data, Version, IpAddress);
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/MetadataServer/Controllers/BuildController.cs:
--------------------------------------------------------------------------------
1 | // Copyright Epic Games, Inc. All Rights Reserved.
2 | // Modifications Copyright CodeWareGames. All Rights Reserved.
3 |
4 | using Microsoft.AspNetCore.Mvc;
5 | using System.Collections.Generic;
6 | using System.Threading.Tasks;
7 | using MetadataServer.Connectors;
8 | using MetadataServer.Models;
9 |
10 | namespace MetadataServer.Controllers
11 | {
12 | [Route("api/[controller]")]
13 | [ApiController]
14 | public class BuildController : ControllerBase
15 | {
16 | private readonly IMySqlConnector _MySqlConnector;
17 | public BuildController(IMySqlConnector MySqlConnector)
18 | {
19 | _MySqlConnector = MySqlConnector;
20 | }
21 |
22 | [HttpGet]
23 | public async Task> Get(string Project, long LastBuildId)
24 | {
25 | return await _MySqlConnector.GetBuilds(Project, LastBuildId);
26 | }
27 |
28 | [HttpPost]
29 | public async Task Post([FromBody]BuildData Build)
30 | {
31 | return await _MySqlConnector.PostBuild(Build);
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/MetadataServer/Controllers/EventController.cs:
--------------------------------------------------------------------------------
1 | // Copyright Epic Games, Inc. All Rights Reserved.
2 | // Modifications Copyright CodeWareGames. All Rights Reserved.
3 |
4 | using Microsoft.AspNetCore.Mvc;
5 | using System.Collections.Generic;
6 | using System.Threading.Tasks;
7 | using MetadataServer.Connectors;
8 | using MetadataServer.Models;
9 |
10 | namespace MetadataServer.Controllers
11 | {
12 | [Route("api/[controller]")]
13 | [ApiController]
14 | public class EventController : ControllerBase
15 | {
16 | private readonly IMySqlConnector _MySqlConnector;
17 | public EventController(IMySqlConnector MySqlConnector)
18 | {
19 | _MySqlConnector = MySqlConnector;
20 | }
21 |
22 | [HttpGet]
23 | public async Task> Get(string Project, long LastEventId)
24 | {
25 | return await _MySqlConnector.GetUserVotes(Project, LastEventId);
26 | }
27 |
28 | [HttpPost]
29 | public async Task Post([FromBody] EventData Event)
30 | {
31 | return await _MySqlConnector.PostEvent(Event);
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/MetadataServer/Controllers/CommentController.cs:
--------------------------------------------------------------------------------
1 | // Copyright Epic Games, Inc. All Rights Reserved.
2 | // Modifications Copyright CodeWareGames. All Rights Reserved.
3 |
4 | using Microsoft.AspNetCore.Mvc;
5 | using System.Collections.Generic;
6 | using System.Threading.Tasks;
7 | using MetadataServer.Connectors;
8 | using MetadataServer.Models;
9 |
10 | namespace MetadataServer.Controllers
11 | {
12 | [Route("api/[controller]")]
13 | [ApiController]
14 | public class CommentController : ControllerBase
15 | {
16 | private readonly IMySqlConnector _MySqlConnector;
17 | public CommentController(IMySqlConnector MySqlConnector)
18 | {
19 | _MySqlConnector = MySqlConnector;
20 | }
21 |
22 | [HttpGet]
23 | public async Task> Get(string Project, long LastCommentId)
24 | {
25 | return await _MySqlConnector.GetComments(Project, LastCommentId);
26 | }
27 |
28 | [HttpPost]
29 | public async Task Post([FromBody] CommentData Comment)
30 | {
31 | return await _MySqlConnector.PostComment(Comment);
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/MetadataServer/Controllers/ErrorController.cs:
--------------------------------------------------------------------------------
1 | // Copyright Epic Games, Inc. All Rights Reserved.
2 | // Modifications Copyright CodeWareGames. All Rights Reserved.
3 |
4 | using Microsoft.AspNetCore.Mvc;
5 | using System.Collections.Generic;
6 | using System.Threading.Tasks;
7 | using MetadataServer.Connectors;
8 | using MetadataServer.Models;
9 |
10 | namespace MetadataServer.Controllers
11 | {
12 | [Route("api/[controller]")]
13 | [ApiController]
14 | public class ErrorController : ControllerBase
15 | {
16 | private readonly IMySqlConnector _MySqlConnector;
17 | public ErrorController(IMySqlConnector MySqlConnector)
18 | {
19 | _MySqlConnector = MySqlConnector;
20 | }
21 |
22 | [HttpGet]
23 | public async Task> Get(int Records = 10)
24 | {
25 | return await _MySqlConnector.GetErrorData(Records);
26 | }
27 |
28 | [HttpPost]
29 | public async Task Post([FromBody] TelemetryErrorData Data, string Version, string IpAddress)
30 | {
31 | return await _MySqlConnector.PostErrorData(Data, Version, IpAddress);
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/UnrealGameSync.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.31205.134
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MetadataServer", "MetadataServer\MetadataServer.csproj", "{C95B3BC3-7911-473B-8D1A-57DB4E142030}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {C95B3BC3-7911-473B-8D1A-57DB4E142030}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {C95B3BC3-7911-473B-8D1A-57DB4E142030}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {C95B3BC3-7911-473B-8D1A-57DB4E142030}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {C95B3BC3-7911-473B-8D1A-57DB4E142030}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {6E1ABADE-6FD3-4895-90AE-8469AAD8094E}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/MetadataServer/Models/IssueData.cs:
--------------------------------------------------------------------------------
1 | // Copyright Epic Games, Inc. All Rights Reserved.
2 |
3 | using System;
4 |
5 | namespace MetadataServer.Models
6 | {
7 | public class IssueWatcherData
8 | {
9 | public string UserName;
10 | }
11 |
12 | public class IssueBuildData
13 | {
14 | public long Id;
15 | public string Stream;
16 | public int Change;
17 | public string JobName;
18 | public string JobUrl;
19 | public string JobStepName;
20 | public string JobStepUrl;
21 | public string ErrorUrl;
22 | public int Outcome;
23 | }
24 |
25 | public class IssueBuildUpdateData
26 | {
27 | public int Outcome;
28 | }
29 |
30 | public class IssueDiagnosticData
31 | {
32 | public long? BuildId;
33 | public string Message;
34 | public string Url;
35 | }
36 |
37 | public class IssueData
38 | {
39 | public long Id;
40 | public DateTime CreatedAt;
41 | public DateTime RetrievedAt;
42 | public string Project;
43 | public string Summary;
44 | public string Owner;
45 | public string NominatedBy;
46 | public DateTime? AcknowledgedAt;
47 | public int FixChange;
48 | public DateTime? ResolvedAt;
49 | public bool bNotify;
50 | }
51 |
52 | public class IssueUpdateData
53 | {
54 | public string Summary;
55 | public string Owner;
56 | public string NominatedBy;
57 | public bool? Acknowledged;
58 | public int? FixChange;
59 | public bool? Resolved;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/MetadataServer/Startup.cs:
--------------------------------------------------------------------------------
1 | // Copyright Epic Games, Inc. All Rights Reserved.
2 | // Modifications Copyright CodeWareGames. All Rights Reserved.
3 |
4 | using Microsoft.AspNetCore.Builder;
5 | using Microsoft.AspNetCore.Hosting;
6 | using Microsoft.Extensions.Configuration;
7 | using Microsoft.Extensions.DependencyInjection;
8 | using Microsoft.Extensions.Hosting;
9 | using MetadataServer.Connectors;
10 |
11 | namespace MetadataServer
12 | {
13 | public class Startup
14 | {
15 | public Startup(IConfiguration configuration)
16 | {
17 | Configuration = configuration;
18 | }
19 |
20 | public IConfiguration Configuration { get; }
21 |
22 | public void ConfigureServices(IServiceCollection services)
23 | {
24 |
25 | services.AddControllers().AddNewtonsoftJson();
26 | services.Configure(Configuration.GetSection("ConnectionStrings"));
27 | services.AddSingleton();
28 | }
29 |
30 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
31 | {
32 | if (env.IsDevelopment())
33 | {
34 | app.UseDeveloperExceptionPage();
35 | }
36 |
37 | app.UseRouting();
38 |
39 | app.UseAuthorization();
40 |
41 | app.UseEndpoints(endpoints =>
42 | {
43 | endpoints.MapControllers();
44 | });
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/MetadataServer/Connectors/IMySqlConnector.cs:
--------------------------------------------------------------------------------
1 | // Copyright Epic Games, Inc. All Rights Reserved.
2 | // Modifications Copyright CodeWareGames. All Rights Reserved.
3 |
4 | using MetadataServer.Models;
5 | using System.Collections.Generic;
6 | using System.Threading.Tasks;
7 |
8 |
9 | namespace MetadataServer.Connectors
10 | {
11 | public interface IMySqlConnector
12 | {
13 | Task GetLastIds(string Project);
14 | Task> GetUserVotes(string Project, long LastEventId);
15 | Task> GetComments(string Project, long LastCommentId);
16 | Task> GetBuilds(string Project, long LastBuildId);
17 | Task> GetErrorData(int Records);
18 | Task PostBuild(BuildData Build);
19 | Task PostEvent(EventData Event);
20 | Task PostComment(CommentData Comment);
21 | Task PostTelemetryData(TelemetryTimingData Data, string Version, string IpAddress);
22 | Task PostErrorData(TelemetryErrorData Data, string Version, string IpAddress);
23 | Task FindOrAddUserId(string Name);
24 | Task AddIssue(IssueData Issue);
25 | Task GetIssue(long IssueId);
26 | Task> GetIssues(bool IncludeResolved, int NumResults);
27 | Task> GetIssues(string UserName);
28 | Task UpdateIssue(long IssueId, IssueUpdateData Issue);
29 | string SanitizeText(string Text, int Length);
30 | Task DeleteIssue(long IssueId);
31 | Task AddDiagnostic(long IssueId, IssueDiagnosticData Diagnostic);
32 | Task> GetDiagnostics(long IssueId);
33 | Task AddWatcher(long IssueId, string UserName);
34 | Task> GetWatchers(long IssueId);
35 | Task RemoveWatcher(long IssueId, string UserName);
36 | Task AddBuild(long IssueId, IssueBuildData Build);
37 | Task> GetBuilds(long IssueId);
38 | Task GetBuild(long BuildId);
39 | Task UpdateBuild(long BuildId, int Outcome);
40 |
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/MetadataServer/Setup.sql:
--------------------------------------------------------------------------------
1 | CREATE DATABASE IF NOT EXISTS ugs_db;
2 |
3 | CREATE TABLE IF NOT EXISTS ugs_db.Projects (
4 | Id INT NOT NULL AUTO_INCREMENT,
5 | `Name` NVARCHAR(128) NOT NULL UNIQUE,
6 | PRIMARY KEY ( Id )
7 | );
8 |
9 | CREATE TABLE IF NOT EXISTS ugs_db.CIS (
10 | Id INT NOT NULL AUTO_INCREMENT,
11 | ChangeNumber INT NOT NULL,
12 | BuildType NCHAR(32) NOT NULL,
13 | Result NCHAR(10) NOT NULL,
14 | Url VARCHAR(512) NOT NULL,
15 | Project VARCHAR(512) NULL,
16 | ProjectId INTEGER NULL,
17 | ArchivePath VARCHAR(512) NULL,
18 | PRIMARY KEY ( Id ),
19 | FOREIGN KEY(ProjectId) REFERENCES Projects(Id)
20 | );
21 |
22 | CREATE TABLE IF NOT EXISTS ugs_db.Comments (
23 | Id INT NOT NULL AUTO_INCREMENT,
24 | ChangeNumber INT NOT NULL,
25 | UserName VARCHAR(128) NOT NULL,
26 | Text VARCHAR(1024) NOT NULL,
27 | Project VARCHAR(128) NOT NULL,
28 | ProjectId INTEGER NULL,
29 | PRIMARY KEY ( Id ),
30 | FOREIGN KEY(ProjectId) REFERENCES Projects(Id)
31 | );
32 |
33 | CREATE TABLE IF NOT EXISTS ugs_db.Errors (
34 | Id INT NOT NULL AUTO_INCREMENT,
35 | Type VARCHAR(50) NOT NULL,
36 | Text VARCHAR(1024) NOT NULL,
37 | UserName NVARCHAR(128) NOT NULL,
38 | Project VARCHAR(128) NOT NULL,
39 | ProjectId INTEGER NULL,
40 | Timestamp DATETIME NOT NULL,
41 | Version VARCHAR(64) NOT NULL,
42 | IpAddress VARCHAR(64) NOT NULL,
43 | PRIMARY KEY ( Id ),
44 | FOREIGN KEY(ProjectId) REFERENCES Projects(Id)
45 | );
46 |
47 | CREATE TABLE IF NOT EXISTS ugs_db.Telemetry_v2 (
48 | Id INT NOT NULL AUTO_INCREMENT,
49 | Action VARCHAR(128) NOT NULL,
50 | Result VARCHAR(128) NOT NULL,
51 | UserName VARCHAR(128) NOT NULL,
52 | Project VARCHAR(128) NOT NULL,
53 | ProjectId INTEGER NULL,
54 | Timestamp DATETIME NOT NULL,
55 | Duration REAL NOT NULL,
56 | Version VARCHAR(64) NOT NULL,
57 | IpAddress VARCHAR(64) NOT NULL,
58 | PRIMARY KEY ( Id ),
59 | FOREIGN KEY(ProjectId) REFERENCES Projects(Id)
60 | );
61 |
62 | CREATE TABLE IF NOT EXISTS ugs_db.UserVotes (
63 | Id INT NOT NULL AUTO_INCREMENT,
64 | Changelist INT NOT NULL,
65 | UserName NVARCHAR(128) NOT NULL,
66 | Verdict NCHAR(32) NOT NULL,
67 | Project NVARCHAR(256) NULL,
68 | ProjectId INTEGER NULL,
69 | PRIMARY KEY ( Id ),
70 | FOREIGN KEY(ProjectId) REFERENCES Projects(Id)
71 | );
72 |
73 | CREATE TABLE IF NOT EXISTS ugs_db.Issues (
74 | Id INT NOT NULL AUTO_INCREMENT,
75 | CreatedAt DATETIME NOT NULL,
76 | Project NVARCHAR(64) NOT NULL,
77 | Summary NVARCHAR(256) NOT NULL,
78 | OwnerId INT NULL,
79 | NominatedById INT NULL,
80 | AcknowledgedAt DATETIME NULL,
81 | FixChange INT NULL,
82 | ResolvedAt DATETIME NULL,
83 | PRIMARY KEY ( Id )
84 | );
85 |
86 | CREATE TABLE IF NOT EXISTS ugs_db.IssueBuilds (
87 | Id INT NOT NULL AUTO_INCREMENT,
88 | IssueId INT NOT NULL,
89 | Stream NVARCHAR(128) NOT NULL,
90 | `Change` INT NOT NULL,
91 | JobName NVARCHAR(1024) NOT NULL,
92 | JobUrl NVARCHAR(1024) NOT NULL,
93 | JobStepName NVARCHAR(1024) NULL,
94 | JobStepUrl NVARCHAR(1024) NULL,
95 | ErrorUrl NVARCHAR(1024) NULL,
96 | Outcome INT NOT NULL,
97 | PRIMARY KEY ( Id ),
98 | FOREIGN KEY(IssueId) REFERENCES Issues(Id)
99 | );
100 |
101 | CREATE TABLE IF NOT EXISTS ugs_db.IssueDiagnostics (
102 | Id INT NOT NULL AUTO_INCREMENT,
103 | IssueId INT NOT NULL,
104 | BuildId INT NULL,
105 | Message NVARCHAR (1024) NOT NULL,
106 | Url NVARCHAR (1024) NULL,
107 | PRIMARY KEY ( Id ),
108 | FOREIGN KEY(IssueId) REFERENCES Issues(Id),
109 | FOREIGN KEY(BuildId) REFERENCES IssueBuilds(Id)
110 | );
111 |
112 | CREATE TABLE IF NOT EXISTS ugs_db.Users (
113 | Id INT NOT NULL AUTO_INCREMENT,
114 | `Name` NVARCHAR(128) NOT NULL UNIQUE,
115 | PRIMARY KEY ( Id )
116 | );
117 |
118 | CREATE TABLE IF NOT EXISTS ugs_db.IssueWatchers (
119 | IssueId INT NOT NULL,
120 | UserId INT NOT NULL,
121 | PRIMARY KEY(IssueId, UserId),
122 | FOREIGN KEY(IssueId) REFERENCES Issues(Id),
123 | FOREIGN KEY(UserId) REFERENCES Users(Id)
124 | );
125 |
126 | CREATE TABLE IF NOT EXISTS ugs_db.Badges (
127 | Id INT NOT NULL AUTO_INCREMENT,
128 | ChangeNumber INT NOT NULL,
129 | BuildType NVARCHAR(32) NOT NULL,
130 | Result NVARCHAR(10) NOT NULL,
131 | Url NVARCHAR(512) NOT NULL,
132 | ProjectId INT NOT NULL,
133 | ArchivePath NVARCHAR(512) NULL,
134 | PRIMARY KEY ( Id ),
135 | FOREIGN KEY(ProjectId) REFERENCES Projects(Id)
136 | );
--------------------------------------------------------------------------------
/MetadataServer/Controllers/IssuesController.cs:
--------------------------------------------------------------------------------
1 | // Copyright Epic Games, Inc. All Rights Reserved.
2 | // Modifications Copyright CodeWareGames. All Rights Reserved.
3 |
4 | using Microsoft.AspNetCore.Mvc;
5 | using System.Collections.Generic;
6 | using System.Threading.Tasks;
7 | using MetadataServer.Connectors;
8 | using MetadataServer.Models;
9 | using MetadataServer.ActionConstraints;
10 |
11 | namespace MetadataServer.Controllers
12 | {
13 | [Route("api/[controller]")]
14 | [ApiController]
15 | public class IssuesController : ControllerBase
16 | {
17 | private readonly IMySqlConnector _MySqlConnector;
18 | public IssuesController(IMySqlConnector MySqlConnector)
19 | {
20 | _MySqlConnector = MySqlConnector;
21 | }
22 |
23 | [HttpGet]
24 | public async Task> Get([FromQuery] bool IncludeResolved = false, [FromQuery] int MaxResults = -1)
25 | {
26 | return await _MySqlConnector.GetIssues(IncludeResolved, MaxResults);
27 | }
28 |
29 | [HttpGet]
30 | [ExactQueryParam("user")]
31 | public async Task> Get([FromQuery] string User)
32 | {
33 | return await _MySqlConnector.GetIssues(User);
34 | }
35 |
36 | [HttpGet]
37 | [Route("{id}")]
38 | public async Task Get(long id)
39 | {
40 | return await _MySqlConnector.GetIssue(id);
41 | }
42 |
43 | [HttpPut]
44 | public async Task Put(long id, IssueUpdateData Issue)
45 | {
46 | return await _MySqlConnector.UpdateIssue(id, Issue);
47 | }
48 |
49 | [HttpPost]
50 | public async Task