mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-29 05:00:43 +10:00
Support deleted listings in prop types
This commit is contained in:
parent
f12ee05578
commit
6f60c70107
1 changed files with 15 additions and 9 deletions
|
|
@ -22,7 +22,7 @@ import Decimal from 'decimal.js';
|
|||
import { types as sdkTypes } from './sdkLoader';
|
||||
|
||||
const { UUID, LatLng, LatLngBounds, Money } = sdkTypes;
|
||||
const { arrayOf, bool, func, instanceOf, number, oneOf, shape, string } = PropTypes;
|
||||
const { arrayOf, bool, func, instanceOf, number, oneOf, oneOfType, shape, string } = PropTypes;
|
||||
|
||||
// Fixed value
|
||||
export const value = val => oneOf([val]);
|
||||
|
|
@ -105,18 +105,24 @@ export const image = shape({
|
|||
}),
|
||||
});
|
||||
|
||||
const listingAttributes = shape({
|
||||
title: string.isRequired,
|
||||
description: string.isRequired,
|
||||
address: string.isRequired,
|
||||
geolocation: latlng.isRequired,
|
||||
open: bool.isRequired,
|
||||
price: money,
|
||||
});
|
||||
|
||||
const deletedListingAttributes = shape({
|
||||
deleted: value(true).isRequired,
|
||||
});
|
||||
|
||||
// Denormalised listing object
|
||||
export const listing = shape({
|
||||
id: uuid.isRequired,
|
||||
type: value('listing').isRequired,
|
||||
attributes: shape({
|
||||
title: string.isRequired,
|
||||
description: string.isRequired,
|
||||
address: string.isRequired,
|
||||
geolocation: latlng.isRequired,
|
||||
open: bool.isRequired,
|
||||
price: money,
|
||||
}),
|
||||
attributes: oneOfType([listingAttributes, deletedListingAttributes]).isRequired,
|
||||
author: user,
|
||||
images: arrayOf(image),
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue