3384 - add locales to market query (#147)
This commit is contained in:
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user