44 lines
819 B
JavaScript
44 lines
819 B
JavaScript
import { List, Record } from 'immutable';
|
|
|
|
export default class Item extends Record({
|
|
bidCount: 0,
|
|
bidIncrement: 10,
|
|
catalogNumber: null,
|
|
currentPrice: 0,
|
|
description: null,
|
|
donor: null,
|
|
end: null,
|
|
estimatedValue: null,
|
|
eventId: null,
|
|
hideAfterEnd: false,
|
|
hideBeforeStart: false,
|
|
id: null,
|
|
images: new List(),
|
|
isShippable: false,
|
|
notifyOnAvailable: false,
|
|
quantityAvailable: 1,
|
|
soldCount: 0,
|
|
start: null,
|
|
startingPrice: null,
|
|
subtitle: null,
|
|
title: null,
|
|
type: null,
|
|
shippingCost: 0,
|
|
}) {
|
|
get isSoldOut() {
|
|
return this.quantityAvailable > this.soldCount;
|
|
}
|
|
|
|
get totalWithShipping() {
|
|
return this.currentPrice + this.shippingCost;
|
|
}
|
|
}
|
|
|
|
Item.fromJS = (data = {}) => {
|
|
return new Item({
|
|
id: data._id,
|
|
...data,
|
|
images: List(data.images),
|
|
});
|
|
};
|