This commit is contained in:
Jose Conde
2025-09-29 16:02:00 +02:00
parent dc57da8136
commit 5e16f781b4
74 changed files with 1621 additions and 1856 deletions

View File

@@ -0,0 +1,81 @@
using ModVersionChecker.enums;
using System.Text.Json.Serialization;
namespace ModVersionChecker.repository.api.dto
{
public class AppResponse
{
public AppResponse() { }
[JsonPropertyName("id")]
public string Id { get; set; } = string.Empty;
[JsonPropertyName("uid")]
public string Uid { get; set; } = string.Empty;
[JsonPropertyName("name")]
public string Name { get; set; } = string.Empty;
[JsonPropertyName("type")]
public string Type { get; set; } = string.Empty;
[JsonPropertyName("source")]
public string Source { get; set; } = string.Empty;
[JsonPropertyName("params")]
public Dictionary<string, string> Params { get; set; } = new Dictionary<string, string>();
[JsonPropertyName("fields")]
public Dictionary<string, string> Fields { get; set; } = new Dictionary<string, string>();
[JsonPropertyName("downloadUrl")]
public string DownloadUrl { get; set; } = string.Empty;
[JsonPropertyName("currentVersion")]
public string CurrentVersion { get; set; } = string.Empty;
[JsonPropertyName("latestVersion")]
public string LatestVersion { get; set; } = string.Empty;
[JsonPropertyName("status")]
[JsonConverter(typeof(JsonStringEnumConverter))]
public AppStatus Status { get; set; } = AppStatus.NONE;
[JsonPropertyName("createdAt")]
public long CreatedAt { get; set; } = 0;
[JsonPropertyName("updatedAt")]
public long UpdatedAt { get; set; } = 0;
[JsonPropertyName("lastCheckedAt")]
public long LastCheckedAt { get; set; } = 0;
[JsonPropertyName("active")]
public bool Active { get; set; } = false;
public static App toModel(AppResponse appResponse)
{
if (appResponse == null)
{
return new App();
}
return new App()
{
Id = appResponse.Id,
Uid = appResponse.Uid,
Name = appResponse.Name,
Type = appResponse.Type,
Source = appResponse.Source,
Params = appResponse.Params,
Fields = appResponse.Fields,
DownloadUrl = appResponse.DownloadUrl,
CurrentVersion = appResponse.CurrentVersion,
LatestVersion = appResponse.LatestVersion,
Status = appResponse.Status,
LastCheckedAt = appResponse.LastCheckedAt,
};
}
}
}

View File

@@ -0,0 +1,15 @@
using System.Text.Json.Serialization;
namespace ModVersionChecker.repository.api.dto
{
public class AppVersionsResponse
{
public AppVersionsResponse() { }
[JsonPropertyName("id")]
public string Id { get; set; } = string.Empty;
[JsonPropertyName("latestVersion")]
public string LatestVersion { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace ModVersionChecker.repository.api.dto
{
public class AuthenticationResponse
{
[JsonPropertyName("accessToken")]
public string AccessToken { get; set; } = string.Empty;
[JsonPropertyName("refreshToken")]
public string RefreshToken { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace ModVersionChecker.repository.api.dto
{
public class FieldResponse
{
[JsonPropertyName("name")]
public string Name { get; set; } = string.Empty;
[JsonPropertyName("label")]
public string Label { get; set; } = string.Empty;
[JsonPropertyName("description")]
public string Description { get; set; } = string.Empty;
[JsonPropertyName("type")]
public string Type { get; set; } = string.Empty;
[JsonPropertyName("required")]
public bool Required { get; set; } = false;
[JsonPropertyName("controlType")]
public string ControlType { get; set; } = string.Empty;
[JsonPropertyName("defaultValue")]
public string DefaultValue { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace ModVersionChecker.repository.api.dto
{
public class JwtTokenResponse
{
public JwtTokenResponse() { }
public string Token { get; set; } = string.Empty;
[JsonPropertyName("exp")]
public long ExpireAt { get; set; } = 0;
[JsonPropertyName("iat")]
public long IssuedAt { get; set; } = 0;
[JsonPropertyName("sub")]
public string Subject { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,19 @@
using System.Text.Json.Serialization;
namespace ModVersionChecker.repository.api.dto
{
public class SourceResponse
{
[JsonPropertyName("id")]
public string Id { get; set; } = string.Empty;
[JsonPropertyName("name")]
public string Name { get; set; } = string.Empty;
[JsonPropertyName("type")]
public string Type { get; set; } = string.Empty;
[JsonPropertyName("defaults")]
public Dictionary<string, string> Defaults { get; set; } = new Dictionary<string, string>();
}
}

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace ModVersionChecker.repository.api.dto
{
public class TypeResponse
{
public string Id { get; set; } = String.Empty;
[JsonPropertyName("name")]
public string Name { get; set; } = string.Empty;
[JsonPropertyName("shortName")]
public string ShortName { get; set; } = string.Empty;
[JsonPropertyName("configFields")]
public List<FieldResponse> ConfigFields { get; set; } = new List<FieldResponse>();
[JsonPropertyName("appFields")]
public List<FieldResponse> AppFields { get; set; } = new List<FieldResponse>();
}
}