From f9799ca51bcef4e7f6a1973b0ad0e6b39d47a320 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 10 Apr 2018 11:07:30 -0400 Subject: [PATCH] Progress --- src/Tgstation.Server.Api/Models/CompileJob.cs | 39 +------------ .../Models/DreamDaemon.cs | 10 +++- .../Models/Internal/CompileJob.cs | 39 +++++++++++++ .../Models/Internal/DreamDaemonSettings.cs | 9 +-- .../Models/Internal/Job.cs | 3 - .../Models/Internal/RepositorySettings.cs | 4 -- .../Models/Internal/RevisionInformation.cs | 13 +++++ .../Models/Internal/TestMerge.cs | 22 +++++++ .../Models/Internal/Token.cs | 47 --------------- src/Tgstation.Server.Api/Models/Job.cs | 2 + src/Tgstation.Server.Api/Models/Repository.cs | 3 + .../Models/RevisionInformation.cs | 12 +--- src/Tgstation.Server.Api/Models/TestMerge.cs | 21 +------ src/Tgstation.Server.Api/Models/Token.cs | 20 +------ .../Tgstation.Server.Api.csproj | 7 +-- .../Components/ITokenClient.cs | 57 ------------------- src/Tgstation.Server.Client/IServerClient.cs | 5 -- .../Core/AuthenticationContext.cs | 2 +- .../Core/IAuthenticationContext.cs | 2 +- .../Models/CompileJob.cs | 13 +++++ .../Models/DatabaseContext.cs | 6 +- .../Models/DbCompileJob.cs | 13 ----- .../Models/DreamDaemonSettings.cs | 6 +- .../Models/DreamMakerSettings.cs | 2 +- .../Models/IDatabaseContext.cs | 4 +- src/Tgstation.Server.Host/Models/Instance.cs | 4 +- src/Tgstation.Server.Host/Models/Job.cs | 4 +- .../Models/RepositorySettings.cs | 2 +- .../Models/RevisionInformation.cs | 4 +- .../Models/ServerSettings.cs | 6 ++ src/Tgstation.Server.Host/Models/TestMerge.cs | 4 +- .../Models/{DbUser.cs => User.cs} | 10 +--- .../Tgstation.Server.Host.csproj | 13 ++--- ...Tgstation.Server.Host.Service.Tests.csproj | 2 +- 34 files changed, 145 insertions(+), 265 deletions(-) create mode 100644 src/Tgstation.Server.Api/Models/Internal/CompileJob.cs create mode 100644 src/Tgstation.Server.Api/Models/Internal/RevisionInformation.cs create mode 100644 src/Tgstation.Server.Api/Models/Internal/TestMerge.cs delete mode 100644 src/Tgstation.Server.Api/Models/Internal/Token.cs delete mode 100644 src/Tgstation.Server.Client/Components/ITokenClient.cs create mode 100644 src/Tgstation.Server.Host/Models/CompileJob.cs delete mode 100644 src/Tgstation.Server.Host/Models/DbCompileJob.cs rename src/Tgstation.Server.Host/Models/{DbUser.cs => User.cs} (55%) diff --git a/src/Tgstation.Server.Api/Models/CompileJob.cs b/src/Tgstation.Server.Api/Models/CompileJob.cs index 4f1592a25e..4478dde763 100644 --- a/src/Tgstation.Server.Api/Models/CompileJob.cs +++ b/src/Tgstation.Server.Api/Models/CompileJob.cs @@ -1,46 +1,11 @@ -using System; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Tgstation.Server.Api.Models +namespace Tgstation.Server.Api.Models { - public class CompileJob + public sealed class CompileJob : Internal.CompileJob { - /// - /// The ID of the job - /// - public long Id { get; set; } - /// /// The that triggered the job /// public User TriggeredBy { get; set; } - - /// - /// When the compilation started - /// - [Required] - public DateTimeOffset StartedAt { get; set; } - - /// - /// When the compilation finished - /// - public DateTimeOffset FinishedAt { get; set; } - - /// - /// If the compiler targeted the primary directory - /// - public bool? TargetedPrimaryDirectory { get; set; } - - /// - /// Textual output of DM - /// - public string Output { get; set; } - - /// - /// Exit code of DM. If , the job was cancelled - /// - public int? ExitCode { get; set; } /// /// Git revision the compiler ran on. Not modifiable diff --git a/src/Tgstation.Server.Api/Models/DreamDaemon.cs b/src/Tgstation.Server.Api/Models/DreamDaemon.cs index b6fff22b40..2c48828bbf 100644 --- a/src/Tgstation.Server.Api/Models/DreamDaemon.cs +++ b/src/Tgstation.Server.Api/Models/DreamDaemon.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using Tgstation.Server.Api.Models.Internal; +using Tgstation.Server.Api.Models.Internal; using Tgstation.Server.Api.Rights; namespace Tgstation.Server.Api.Models @@ -11,6 +9,12 @@ namespace Tgstation.Server.Api.Models [Model(RightsType.DreamDaemon, CanCrud = true, RequiresInstance = true)] public sealed class DreamDaemon : DreamDaemonSettings { + /// + /// When the live revision was compiled + /// + [Permissions(DenyWrite = true, ReadRight = DreamDaemonRights.ReadRevision)] + public CompileJob CompileJob { get; set; } + /// /// The current status of /// diff --git a/src/Tgstation.Server.Api/Models/Internal/CompileJob.cs b/src/Tgstation.Server.Api/Models/Internal/CompileJob.cs new file mode 100644 index 0000000000..b9af1662d6 --- /dev/null +++ b/src/Tgstation.Server.Api/Models/Internal/CompileJob.cs @@ -0,0 +1,39 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace Tgstation.Server.Api.Models.Internal +{ + public class CompileJob + { + /// + /// The ID of the job + /// + public long Id { get; set; } + + /// + /// When the compilation started + /// + [Required] + public DateTimeOffset StartedAt { get; set; } + + /// + /// When the compilation finished + /// + public DateTimeOffset FinishedAt { get; set; } + + /// + /// If the compiler targeted the primary directory + /// + public bool? TargetedPrimaryDirectory { get; set; } + + /// + /// Textual output of DM + /// + public string Output { get; set; } + + /// + /// Exit code of DM. If , the job was cancelled + /// + public int? ExitCode { get; set; } + } +} diff --git a/src/Tgstation.Server.Api/Models/Internal/DreamDaemonSettings.cs b/src/Tgstation.Server.Api/Models/Internal/DreamDaemonSettings.cs index 6288508a43..610d6b59a1 100644 --- a/src/Tgstation.Server.Api/Models/Internal/DreamDaemonSettings.cs +++ b/src/Tgstation.Server.Api/Models/Internal/DreamDaemonSettings.cs @@ -1,16 +1,9 @@ -using System.ComponentModel.DataAnnotations; -using Tgstation.Server.Api.Rights; +using Tgstation.Server.Api.Rights; namespace Tgstation.Server.Api.Models.Internal { public class DreamDaemonSettings { - /// - /// When the live revision was compiled - /// - [Permissions(DenyWrite = true, ReadRight = DreamDaemonRights.ReadRevision)] - public CompileJob CompileJob { get; set; } - /// /// If starts when it's starts /// diff --git a/src/Tgstation.Server.Api/Models/Internal/Job.cs b/src/Tgstation.Server.Api/Models/Internal/Job.cs index 26266a20c5..0effd5cbfc 100644 --- a/src/Tgstation.Server.Api/Models/Internal/Job.cs +++ b/src/Tgstation.Server.Api/Models/Internal/Job.cs @@ -22,9 +22,6 @@ namespace Tgstation.Server.Api.Models.Internal [Required] public DateTimeOffset StartedAt { get; set; } - [Required] - public User StartedBy { get; set; } - /// /// When the stopped /// diff --git a/src/Tgstation.Server.Api/Models/Internal/RepositorySettings.cs b/src/Tgstation.Server.Api/Models/Internal/RepositorySettings.cs index 426ad618d2..1d50db143c 100644 --- a/src/Tgstation.Server.Api/Models/Internal/RepositorySettings.cs +++ b/src/Tgstation.Server.Api/Models/Internal/RepositorySettings.cs @@ -1,5 +1,4 @@ using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; using Tgstation.Server.Api.Rights; namespace Tgstation.Server.Api.Models.Internal @@ -11,9 +10,6 @@ namespace Tgstation.Server.Api.Models.Internal /// [Permissions(WriteRight = RepositoryRights.SetOrigin)] public string Origin { get; set; } - - [Permissions(DenyWrite = true)] - public RevisionInformation RevisionInformation { get; set; } /// /// The name of the committer diff --git a/src/Tgstation.Server.Api/Models/Internal/RevisionInformation.cs b/src/Tgstation.Server.Api/Models/Internal/RevisionInformation.cs new file mode 100644 index 0000000000..5914d3d962 --- /dev/null +++ b/src/Tgstation.Server.Api/Models/Internal/RevisionInformation.cs @@ -0,0 +1,13 @@ +using System.ComponentModel.DataAnnotations; + +namespace Tgstation.Server.Api.Models.Internal +{ + public class RevisionInformation + { + [Required, StringLength(40)] + public string Revision { get; set; } + + [Required, StringLength(40)] + public string OriginRevision { get; set; } + } +} diff --git a/src/Tgstation.Server.Api/Models/Internal/TestMerge.cs b/src/Tgstation.Server.Api/Models/Internal/TestMerge.cs new file mode 100644 index 0000000000..9db2ffcb83 --- /dev/null +++ b/src/Tgstation.Server.Api/Models/Internal/TestMerge.cs @@ -0,0 +1,22 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace Tgstation.Server.Api.Models.Internal +{ + public class TestMerge + { + public long Id { get; set; } + + [Required] + public DateTimeOffset MergedAt { get; set; } + + [Required] + public string TitleAtMerge { get; set; } + + [Required] + public string BodyAtMerge { get; set; } + + [Required] + public string Author { get; set; } + } +} diff --git a/src/Tgstation.Server.Api/Models/Internal/Token.cs b/src/Tgstation.Server.Api/Models/Internal/Token.cs deleted file mode 100644 index 3b1cad7574..0000000000 --- a/src/Tgstation.Server.Api/Models/Internal/Token.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; -using Tgstation.Server.Api.Rights; - -namespace Tgstation.Server.Api.Models.Internal -{ - /// - /// Represents an access token for the server. Read action generates a new one. Update action expires all for user - /// - [Model(RightsType.Token, CanList = true)] - public class Token - { - /// - /// The id of the . Not modifiable - /// - public long Id { get; set; } - - /// - /// The user agent that created the - /// - [Required] - public string ClientUserAgent { get; set; } - - [Required, MinLength(4), MaxLength(16)] - public byte[] IssuedTo { get; set; } - - [Required, MinLength(4), MaxLength(16)] - public byte[] LastUsedBy { get; set; } - - /// - /// When the was originally issued - /// - [Required] - public DateTimeOffset IssuedAt { get; set; } - - /// - /// When the was last used - /// - public DateTimeOffset LastUsedAt { get; set; } - - /// - /// The token . Not modifiable, only appears once - /// - [Required] - public string Value { get; set; } - } -} \ No newline at end of file diff --git a/src/Tgstation.Server.Api/Models/Job.cs b/src/Tgstation.Server.Api/Models/Job.cs index e5c23eaa40..959d546962 100644 --- a/src/Tgstation.Server.Api/Models/Job.cs +++ b/src/Tgstation.Server.Api/Models/Job.cs @@ -15,5 +15,7 @@ /// If the current user has permission to cancel the job /// public bool UserCanCancel { get; set; } + + public User StartedBy { get; set; } } } diff --git a/src/Tgstation.Server.Api/Models/Repository.cs b/src/Tgstation.Server.Api/Models/Repository.cs index 81e796ef00..fbc279d226 100644 --- a/src/Tgstation.Server.Api/Models/Repository.cs +++ b/src/Tgstation.Server.Api/Models/Repository.cs @@ -15,6 +15,9 @@ namespace Tgstation.Server.Api.Models [Permissions(WriteRight = RepositoryRights.SetSha)] public string NewRevision { get; set; } + [Permissions(DenyWrite = true)] + public RevisionInformation RevisionInformation { get; set; } + /// /// The branch or tag HEAD points to /// diff --git a/src/Tgstation.Server.Api/Models/RevisionInformation.cs b/src/Tgstation.Server.Api/Models/RevisionInformation.cs index ea7165b24b..14f5fffa0a 100644 --- a/src/Tgstation.Server.Api/Models/RevisionInformation.cs +++ b/src/Tgstation.Server.Api/Models/RevisionInformation.cs @@ -1,17 +1,9 @@ using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; namespace Tgstation.Server.Api.Models { - public class RevisionInformation - { - [Required, StringLength(40)] - public string Revision { get; set; } - - [Required, StringLength(40)] - public string OriginRevision { get; set; } - + public sealed class RevisionInformation : Internal.RevisionInformation + { public List TestMerges { get; set; } } } diff --git a/src/Tgstation.Server.Api/Models/TestMerge.cs b/src/Tgstation.Server.Api/Models/TestMerge.cs index 1cb64db9ea..706b0b58a8 100644 --- a/src/Tgstation.Server.Api/Models/TestMerge.cs +++ b/src/Tgstation.Server.Api/Models/TestMerge.cs @@ -1,24 +1,7 @@ -using System; -using System.ComponentModel.DataAnnotations; - -namespace Tgstation.Server.Api.Models +namespace Tgstation.Server.Api.Models { - public class TestMerge : TestMergeParameters + public sealed class TestMerge : Internal.TestMerge { - public long Id { get; set; } - - [Required] - public DateTimeOffset MergedAt { get; set; } - public User MergedBy { get; set; } - - [Required] - public string TitleAtMerge { get; set; } - - [Required] - public string BodyAtMerge { get; set; } - - [Required] - public string Author { get; set; } } } \ No newline at end of file diff --git a/src/Tgstation.Server.Api/Models/Token.cs b/src/Tgstation.Server.Api/Models/Token.cs index b709bea3d8..6e806cf9a6 100644 --- a/src/Tgstation.Server.Api/Models/Token.cs +++ b/src/Tgstation.Server.Api/Models/Token.cs @@ -1,22 +1,8 @@ -using System.Net; - -namespace Tgstation.Server.Api.Models +namespace Tgstation.Server.Api.Models { /// - public sealed class Token : Internal.Token + public sealed class Token { - /// - new public IPAddress IssuedTo - { - get => new IPAddress(base.IssuedTo); - set => base.IssuedTo = value.GetAddressBytes(); - } - - /// - new public IPAddress LastUsedBy - { - get => new IPAddress(base.LastUsedBy); - set => base.LastUsedBy = value.GetAddressBytes(); - } + public string Value { get; set; } } } diff --git a/src/Tgstation.Server.Api/Tgstation.Server.Api.csproj b/src/Tgstation.Server.Api/Tgstation.Server.Api.csproj index 51641091d2..77d9900e91 100644 --- a/src/Tgstation.Server.Api/Tgstation.Server.Api.csproj +++ b/src/Tgstation.Server.Api/Tgstation.Server.Api.csproj @@ -20,12 +20,7 @@ - - - - - ..\..\..\..\..\..\Program Files\dotnet\sdk\NuGetFallbackFolder\system.componentmodel.annotations\4.4.0\ref\netstandard2.0\System.ComponentModel.Annotations.dll - + diff --git a/src/Tgstation.Server.Client/Components/ITokenClient.cs b/src/Tgstation.Server.Client/Components/ITokenClient.cs deleted file mode 100644 index 03965132a0..0000000000 --- a/src/Tgstation.Server.Client/Components/ITokenClient.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using Tgstation.Server.Api.Models; -using Tgstation.Server.Api.Rights; - -namespace Tgstation.Server.Client.Components -{ - /// - /// for managing s - /// - public interface ITokenClient: IRightsClient - { - /// - /// Generate a new for the connected user/ipaddress, deleting the current one if applicable - /// - /// The for the operation - /// A resulting in the new - Task Read(CancellationToken cancellationToken); - - /// - /// Gets all active s for the - /// - /// The for the operation - /// A resulting a of active s for the - Task> GetClientInfos(CancellationToken cancellationToken); - - /// - /// Gets all active s for all users - /// - /// The for the operation - /// A resulting a of active s for the keyed by username - Task> GetAllInfos(CancellationToken cancellationToken); - - /// - /// Invalidate the specified active - /// - /// The to invalidate - /// The for the operation - /// A representing the running operation - Task Invalidate(Token token, CancellationToken cancellationToken); - - /// - /// Invalidate all active s for a - /// - /// The for the operation - /// A representing the running operation - Task InvalidateAllClient(CancellationToken cancellationToken); - - /// - /// Invalidate all active s - /// - /// The for the operation - /// A representing the running operation - Task InvalidateAll(CancellationToken cancellationToken); - } -} diff --git a/src/Tgstation.Server.Client/IServerClient.cs b/src/Tgstation.Server.Client/IServerClient.cs index aa0fb7cc39..510d609aeb 100644 --- a/src/Tgstation.Server.Client/IServerClient.cs +++ b/src/Tgstation.Server.Client/IServerClient.cs @@ -30,11 +30,6 @@ namespace Tgstation.Server.Client /// int RequeryRate { get; set; } - /// - /// Access the - /// - ITokenClient Tokens { get; } - /// /// Access the /// diff --git a/src/Tgstation.Server.Host/Core/AuthenticationContext.cs b/src/Tgstation.Server.Host/Core/AuthenticationContext.cs index fe4c5f9b8d..aa8235f1b8 100644 --- a/src/Tgstation.Server.Host/Core/AuthenticationContext.cs +++ b/src/Tgstation.Server.Host/Core/AuthenticationContext.cs @@ -99,7 +99,7 @@ namespace Tgstation.Server.Host.Core public void Dispose() => SystemIdentity.Dispose(); /// - public Task User(CancellationToken cancellationToken) + public Task User(CancellationToken cancellationToken) { throw new NotImplementedException(); } diff --git a/src/Tgstation.Server.Host/Core/IAuthenticationContext.cs b/src/Tgstation.Server.Host/Core/IAuthenticationContext.cs index a198c93ceb..1d2466bbaf 100644 --- a/src/Tgstation.Server.Host/Core/IAuthenticationContext.cs +++ b/src/Tgstation.Server.Host/Core/IAuthenticationContext.cs @@ -20,7 +20,7 @@ namespace Tgstation.Server.Host.Core /// /// The for the operation /// A resulting in the represented by the - Task User(CancellationToken cancellationToken); + Task User(CancellationToken cancellationToken); /// /// The represented by and a given diff --git a/src/Tgstation.Server.Host/Models/CompileJob.cs b/src/Tgstation.Server.Host/Models/CompileJob.cs new file mode 100644 index 0000000000..9e26c011e0 --- /dev/null +++ b/src/Tgstation.Server.Host/Models/CompileJob.cs @@ -0,0 +1,13 @@ +using System.ComponentModel.DataAnnotations; + +namespace Tgstation.Server.Host.Models +{ + sealed class CompileJob : Api.Models.Internal.CompileJob + { + [Required] + public User TriggeredBy { get; set; } + + [Required] + public RevisionInformation RevisionInformation { get; set; } + } +} diff --git a/src/Tgstation.Server.Host/Models/DatabaseContext.cs b/src/Tgstation.Server.Host/Models/DatabaseContext.cs index 677733bc83..5880046f97 100644 --- a/src/Tgstation.Server.Host/Models/DatabaseContext.cs +++ b/src/Tgstation.Server.Host/Models/DatabaseContext.cs @@ -17,7 +17,7 @@ namespace Tgstation.Server.Host.Models public DbSet ServerSettings { get; set; } /// - public DbSet Users { get; set; } + public DbSet Users { get; set; } /// public DbSet Instances { get; set; } @@ -31,9 +31,8 @@ namespace Tgstation.Server.Host.Models public DbSet ChatSettings { get; set; } public DbSet DreamDaemonSettings { get; set; } public DbSet DreamMakerSettings { get; set; } - public DbSet CompileJobs { get; set; } + public DbSet CompileJobs { get; set; } public DbSet Jobs { get; set; } - public DbSet Tokens { get; set; } public DbSet TestMerges { get; set; } public DbSet RevisionInformations { get; set; } public DbSet RepositorySettings { get; set; } @@ -75,6 +74,7 @@ namespace Tgstation.Server.Host.Models modelBuilder.Entity().ToTable(nameof(Logs)); modelBuilder.Entity().HasIndex(x => x.Revision).IsUnique(); + modelBuilder.Entity().HasIndex(x => x.SystemIdentifier).IsUnique(); } /// diff --git a/src/Tgstation.Server.Host/Models/DbCompileJob.cs b/src/Tgstation.Server.Host/Models/DbCompileJob.cs deleted file mode 100644 index 6392c06024..0000000000 --- a/src/Tgstation.Server.Host/Models/DbCompileJob.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace Tgstation.Server.Host.Models -{ - sealed class DbCompileJob : Api.Models.CompileJob - { - [Required] - new public DbUser TriggeredBy { get; set; } - - [Required] - new public RevisionInformation RevisionInformation { get; set; } - } -} diff --git a/src/Tgstation.Server.Host/Models/DreamDaemonSettings.cs b/src/Tgstation.Server.Host/Models/DreamDaemonSettings.cs index f5da5c1243..2573093598 100644 --- a/src/Tgstation.Server.Host/Models/DreamDaemonSettings.cs +++ b/src/Tgstation.Server.Host/Models/DreamDaemonSettings.cs @@ -8,13 +8,13 @@ namespace Tgstation.Server.Host.Models public int? ProcessId { get; set; } - public long InstanceId { get; set; } - public string AccessToken { get; set; } + public long InstanceId { get; set; } + [Required] public Instance Instance { get; set; } - new public DbCompileJob CompileJob { get; set; } + public CompileJob CompileJob { get; set; } } } diff --git a/src/Tgstation.Server.Host/Models/DreamMakerSettings.cs b/src/Tgstation.Server.Host/Models/DreamMakerSettings.cs index 43b58c39e1..fb79315315 100644 --- a/src/Tgstation.Server.Host/Models/DreamMakerSettings.cs +++ b/src/Tgstation.Server.Host/Models/DreamMakerSettings.cs @@ -11,6 +11,6 @@ namespace Tgstation.Server.Host.Models [Required] public Instance Instance { get; set; } - public DbCompileJob CompileJob { get; set; } + public CompileJob CompileJob { get; set; } } } diff --git a/src/Tgstation.Server.Host/Models/IDatabaseContext.cs b/src/Tgstation.Server.Host/Models/IDatabaseContext.cs index 647b50d83c..9330d3d175 100644 --- a/src/Tgstation.Server.Host/Models/IDatabaseContext.cs +++ b/src/Tgstation.Server.Host/Models/IDatabaseContext.cs @@ -10,9 +10,9 @@ namespace Tgstation.Server.Host.Models interface IDatabaseContext { /// - /// The s in the + /// The s in the /// - DbSet Users { get; } + DbSet Users { get; } /// /// The s in the diff --git a/src/Tgstation.Server.Host/Models/Instance.cs b/src/Tgstation.Server.Host/Models/Instance.cs index db1dfddde1..0ecb141755 100644 --- a/src/Tgstation.Server.Host/Models/Instance.cs +++ b/src/Tgstation.Server.Host/Models/Instance.cs @@ -38,9 +38,9 @@ namespace Tgstation.Server.Host.Models public List TestMerges { get; set; } /// - /// The s in the + /// The s in the /// - public List CompileJobs { get; set; } + public List CompileJobs { get; set; } /// /// The in the diff --git a/src/Tgstation.Server.Host/Models/Job.cs b/src/Tgstation.Server.Host/Models/Job.cs index dd70b9bc04..e902cd9b96 100644 --- a/src/Tgstation.Server.Host/Models/Job.cs +++ b/src/Tgstation.Server.Host/Models/Job.cs @@ -5,9 +5,9 @@ namespace Tgstation.Server.Host.Models sealed class Job : Api.Models.Internal.Job { [Required] - new public DbUser StartedBy { get; set; } + public User StartedBy { get; set; } [Required] - Instance Instance { get; set; } + public Instance Instance { get; set; } } } diff --git a/src/Tgstation.Server.Host/Models/RepositorySettings.cs b/src/Tgstation.Server.Host/Models/RepositorySettings.cs index 96412c401f..782ef405db 100644 --- a/src/Tgstation.Server.Host/Models/RepositorySettings.cs +++ b/src/Tgstation.Server.Host/Models/RepositorySettings.cs @@ -11,6 +11,6 @@ namespace Tgstation.Server.Host.Models [Required] public Instance Instance { get; set; } - new public RevisionInformation RevisionInformation { get; set; } + public RevisionInformation RevisionInformation { get; set; } } } diff --git a/src/Tgstation.Server.Host/Models/RevisionInformation.cs b/src/Tgstation.Server.Host/Models/RevisionInformation.cs index 525a243d43..5d5b9a4885 100644 --- a/src/Tgstation.Server.Host/Models/RevisionInformation.cs +++ b/src/Tgstation.Server.Host/Models/RevisionInformation.cs @@ -2,10 +2,10 @@ namespace Tgstation.Server.Host.Models { - sealed class RevisionInformation : Api.Models.RevisionInformation + sealed class RevisionInformation : Api.Models.Internal.RevisionInformation { public long Id { get; set; } - new public List TestMerges { get; set; } + public List TestMerges { get; set; } } } diff --git a/src/Tgstation.Server.Host/Models/ServerSettings.cs b/src/Tgstation.Server.Host/Models/ServerSettings.cs index 8a84475dad..365d9b3aa2 100644 --- a/src/Tgstation.Server.Host/Models/ServerSettings.cs +++ b/src/Tgstation.Server.Host/Models/ServerSettings.cs @@ -5,5 +5,11 @@ namespace Tgstation.Server.Host.Models sealed class ServerSettings : Api.Models.Internal.ServerSettings { public long Id { get; set; } + + /// + /// The value used for the to encrypt JWTs + /// + [Required] + public byte[] TokenSecret { get; set; } } } diff --git a/src/Tgstation.Server.Host/Models/TestMerge.cs b/src/Tgstation.Server.Host/Models/TestMerge.cs index eac3df5d9f..b334c2b844 100644 --- a/src/Tgstation.Server.Host/Models/TestMerge.cs +++ b/src/Tgstation.Server.Host/Models/TestMerge.cs @@ -5,9 +5,9 @@ namespace Tgstation.Server.Host.Models /// /// Represent a merge of a live pull request /// - sealed class TestMerge : Api.Models.TestMerge + sealed class TestMerge : Api.Models.Internal.TestMerge { [Required] - new public DbUser MergedBy { get; set; } + public User MergedBy { get; set; } } } diff --git a/src/Tgstation.Server.Host/Models/DbUser.cs b/src/Tgstation.Server.Host/Models/User.cs similarity index 55% rename from src/Tgstation.Server.Host/Models/DbUser.cs rename to src/Tgstation.Server.Host/Models/User.cs index 401ce517be..149768c00d 100644 --- a/src/Tgstation.Server.Host/Models/DbUser.cs +++ b/src/Tgstation.Server.Host/Models/User.cs @@ -1,25 +1,19 @@ using System.Collections.Generic; -using Tgstation.Server.Api.Models.Internal; namespace Tgstation.Server.Host.Models { /// /// Represents a in the database /// - sealed class DbUser : Api.Models.User + sealed class User : Api.Models.User { public string PasswordHash { get; set; } public string PasswordSalt { get; set; } /// - /// The s for the + /// The s for the /// public List InstanceUsers { get; set; } - - /// - /// The s for the - /// - public List Tokens { get; set; } } } diff --git a/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj b/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj index 33b9c10d67..3b031e0289 100644 --- a/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj +++ b/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj @@ -37,15 +37,14 @@ - - - - - + + + + + - - + diff --git a/tests/Tgstation.Server.Host.Service.Tests/Tgstation.Server.Host.Service.Tests.csproj b/tests/Tgstation.Server.Host.Service.Tests/Tgstation.Server.Host.Service.Tests.csproj index fdbb9cfe04..ccb09b4c3c 100644 --- a/tests/Tgstation.Server.Host.Service.Tests/Tgstation.Server.Host.Service.Tests.csproj +++ b/tests/Tgstation.Server.Host.Service.Tests/Tgstation.Server.Host.Service.Tests.csproj @@ -75,7 +75,7 @@ Tgstation.Server.Host.Service - {5D2D682C-6BF0-439C-850B-6AB945BBEAEA} + {5d2d682c-6bf0-439c-850b-6ab945bbeaea} Tgstation.Server.Host.Watchdog