aretherecookies-mobile/js/records/ImageRecord.js
2020-04-17 22:50:23 -05:00

26 lines
500 B
JavaScript

import { Record, OrderedSet } from 'immutable';
export type ImageRaw = {
url: string,
username: string,
date: number,
food_item_id: string,
};
const ImageRecord = Record({
url: '',
username: '',
date: Date.now(),
productId: '',
});
export type ImageFragment = { id: string, images: OrderedSet<typeof ImageRecord> };
export const buildImageRecord = (imageRaw: ImageRaw) => {
return new ImageRecord({
...imageRaw,
productId: imageRaw.food_item_id,
});
};
export default ImageRecord;