Files
SocialPub/PrivaPub/Services/ClientToServer/Public/DataService.cs
T

21 lines
903 B
C#
Raw Normal View History

2023-02-19 00:43:43 +01:00
using PrivaPub.Models.Data;
using PrivaPub.StaticServices;
2023-02-18 08:52:17 +01:00
2023-02-19 00:43:43 +01:00
namespace PrivaPub.Services.ClientToServer.Public
2023-02-18 08:52:17 +01:00
{
public class DataService(
DbEntities dbCollections,
AppConfigurationService appConfigurationService) : IDataService
2023-02-18 08:52:17 +01:00
{
// the build's ref (its tag, or the branch a manual deploy ran from), as /build.json and NodeInfo name it
2023-02-18 08:52:17 +01:00
public string GetCurrentVersion() =>
string.IsNullOrEmpty(BuildInfo.Ref) ? BuildInfo.Commit : BuildInfo.Ref;
2023-02-18 08:52:17 +01:00
2023-02-19 00:43:43 +01:00
public async Task<IEnumerable<Language>> GetLanguages(CancellationToken cancellationToken)
2023-02-18 08:52:17 +01:00
{
return (await dbCollections.Languages
.Match(l => appConfigurationService.AppConfiguration.SupportedLanguages.Contains(l.International2Code))
2023-02-19 00:43:43 +01:00
.ExecuteAsync(cancellationToken)).OrderBy(l => l.NativeName).ToArray();
2023-02-18 08:52:17 +01:00
}
}
}