fix(wine): fix wine validation #36
@ -121,9 +121,11 @@ export const wineValidation = (data: unknown): Joi.ValidationResult =>
|
|||||||
* Subregion
|
* Subregion
|
||||||
*/
|
*/
|
||||||
// list of supported subregions
|
// list of supported subregions
|
||||||
const subRegions: string[] = Object.keys(
|
const subRegions: string[] = Array.isArray(
|
||||||
(regionMap as WineRegion)[providedRegion]
|
(regionMap as WineRegion)[providedRegion]
|
||||||
)
|
)
|
||||||
|
? ((regionMap as WineRegion)[providedRegion] as string[])
|
||||||
|
: Object.keys((regionMap as WineRegion)[providedRegion])
|
||||||
|
|
||||||
const providedSubRegion:
|
const providedSubRegion:
|
||||||
| string
|
| string
|
||||||
@ -165,13 +167,25 @@ export const wineValidation = (data: unknown): Joi.ValidationResult =>
|
|||||||
* Village
|
* Village
|
||||||
*/
|
*/
|
||||||
// list of supported villages
|
// list of supported villages
|
||||||
const villages: string[] = Object.keys(
|
const villages: string[] = Array.isArray(
|
||||||
(
|
(
|
||||||
(regionMap as WineRegion)[providedRegion] as {
|
(regionMap as WineRegion)[providedRegion] as {
|
||||||
[key: string]: string | { [key: string]: string[] }
|
[key: string]: string | { [key: string]: string[] }
|
||||||
}
|
}
|
||||||
)[providedSubRegionName]
|
)[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 } = (
|
const providedVillage: string | { [key: string]: string } = (
|
||||||
value[providedRegion] as {
|
value[providedRegion] as {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user