3384 - add locales to market query (#147)

This commit is contained in:
Anders Gustafsson
2023-03-02 12:56:38 +01:00
committed by GitHub
parent c475c1c860
commit c66a18478b
3 changed files with 27 additions and 1 deletions
+19
View File
@@ -73,6 +73,25 @@ export class MarketLocaleAPI extends SQLDataSource {
);
}
async getLocalesForMarketId(marketId: number): Promise<Locale> {
ScopeAccess.validate(this.user).all([Scopes.LOCALES_READ]);
return (
this.knex
.select(
'market_id',
'locales.id',
'value',
'fallback_id',
'locales.name',
)
.from('market_locales')
.leftJoin('locales', 'locales.id', 'market_locales.locale_id')
.where('market_id', marketId)
// @ts-ignore
.cache(MINUTE * 5)
);
}
async getLocaleByValue(value: string): Promise<Locale> {
ScopeAccess.validate(this.user).all([Scopes.LOCALES_READ]);
return (