Merge pull request 'fix(wine): fix wine validation' (#36) from payload-validation into staging
Reviewed-on: #36
This commit is contained in:
commit
5484a8d9e9
@ -121,9 +121,11 @@ export const wineValidation = (data: unknown): Joi.ValidationResult =>
|
||||
* Subregion
|
||||
*/
|
||||
// list of supported subregions
|
||||
const subRegions: string[] = Object.keys(
|
||||
const subRegions: string[] = Array.isArray(
|
||||
(regionMap as WineRegion)[providedRegion]
|
||||
)
|
||||
? ((regionMap as WineRegion)[providedRegion] as string[])
|
||||
: Object.keys((regionMap as WineRegion)[providedRegion])
|
||||
|
||||
const providedSubRegion:
|
||||
| string
|
||||
@ -165,13 +167,25 @@ export const wineValidation = (data: unknown): Joi.ValidationResult =>
|
||||
* Village
|
||||
*/
|
||||
// list of supported villages
|
||||
const villages: string[] = Object.keys(
|
||||
const villages: string[] = Array.isArray(
|
||||
(
|
||||
(regionMap as WineRegion)[providedRegion] as {
|
||||
[key: string]: string | { [key: string]: string[] }
|
||||
}
|
||||
)[providedSubRegionName]
|
||||
)
|
||||
? ((
|
||||
(regionMap as WineRegion)[providedRegion] as {
|
||||
[key: string]: string | { [key: string]: string[] }
|
||||
}
|
||||
)[providedSubRegionName] as unknown as string[])
|
||||
: Object.keys(
|
||||
(
|
||||
(regionMap as WineRegion)[providedRegion] as {
|
||||
[key: string]: string | { [key: string]: string[] }
|
||||
}
|
||||
)[providedSubRegionName]
|
||||
)
|
||||
|
||||
const providedVillage: string | { [key: string]: string } = (
|
||||
value[providedRegion] as {
|
||||
|
Loading…
x
Reference in New Issue
Block a user