This commit is contained in:
@@ -189,7 +189,7 @@ namespace AyaNova.Api.Controllers
|
||||
{
|
||||
if (serverState.IsClosed)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
var l = await TranslationBiz.GetSubsetStaticAsync(inObj, id);
|
||||
var l = await TranslationBiz.GetSpecifiedTranslationSubsetStaticAsync(inObj, id);
|
||||
return Ok(ApiOkResponse.Response(l));
|
||||
}
|
||||
|
||||
|
||||
@@ -246,19 +246,47 @@ namespace AyaNova.Biz
|
||||
|
||||
#endif
|
||||
|
||||
//Get the keys for a list of keys provided
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Get subset for currently logged in user's translation id
|
||||
// Standard used by translationcontroller for logged in user
|
||||
//
|
||||
//
|
||||
internal async Task<List<KeyValuePair<string, string>>> GetSubsetAsync(List<string> param)
|
||||
{
|
||||
|
||||
#if (DEBUG)
|
||||
TrackRequestedKey(param);
|
||||
#endif
|
||||
var ret = await ct.TranslationItem.Where(z => z.TranslationId == UserTranslationId && param.Contains(z.Key)).ToDictionaryAsync(z => z.Key, z => z.Display);
|
||||
var ret = await ct.TranslationItem.Where(z => z.TranslationId == UserTranslationId && param.Contains(z.Key)).AsNoTracking().ToDictionaryAsync(z => z.Key, z => z.Display);
|
||||
return ret.ToList();
|
||||
}
|
||||
|
||||
//Get the keys for a list of keys provided, static format for calling from other internal classes
|
||||
//and remotely when fetching for things like Password reset where the user isn't logged in yet but we know their translation id
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Get subset for specified translation ID
|
||||
// called from controller and Used when user is not logged in
|
||||
// e.g. when resetting their password
|
||||
//
|
||||
internal static async Task<List<KeyValuePair<string, string>>> GetSpecifiedTranslationSubsetStaticAsync(List<string> param, long translationId)
|
||||
{
|
||||
#if (DEBUG)
|
||||
TrackRequestedKey(param);
|
||||
#endif
|
||||
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||
{
|
||||
if (!await ct.Translation.AnyAsync(e => e.Id == translationId))
|
||||
translationId = ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID;
|
||||
var ret = await ct.TranslationItem.Where(z => z.TranslationId == translationId && param.Contains(z.Key)).AsNoTracking().ToDictionaryAsync(z => z.Key, z => z.Display);
|
||||
return ret.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Get subset for specified translation ID statically
|
||||
// called from internal code differs from
|
||||
// GetSpecifiedTranslationSubsetStaticAsync above only in return signature
|
||||
// and used for internal classes to call
|
||||
//
|
||||
internal static async Task<Dictionary<string, string>> GetSubsetStaticAsync(List<string> param, long translationId)
|
||||
{
|
||||
#if (DEBUG)
|
||||
|
||||
Reference in New Issue
Block a user