import { utc as moment, Moment } from 'moment'; export interface NetworkProductModule { product_module_id: string; organization_id: string; sandbox: boolean; live: boolean; draft_id: string; created_at: string; restricted: boolean; key: string; name: string; created_by: { type: string; id: string; }; owned_by_organization_id: string; live_id: string; } export interface ProductModule { productModuleId: string; organizationId: string; ownedByOrganizationId: string; sandbox: boolean; live: boolean; draftId: string; liveId: string; restricted: boolean; key: string; name: string; createdAt: Moment; createdBy: { type: string; id: string; }; } export const productModuleFromNetwork = (networkProductModule: NetworkProductModule): ProductModule => { return { productModuleId: networkProductModule.product_module_id, organizationId: networkProductModule.organization_id, ownedByOrganizationId: networkProductModule.owned_by_organization_id, sandbox: networkProductModule.sandbox, live: networkProductModule.live, draftId: networkProductModule.draft_id, liveId: networkProductModule.live_id, restricted: networkProductModule.restricted, key: networkProductModule.key, name: networkProductModule.name, createdAt: moment(networkProductModule.created_at), createdBy: networkProductModule.created_by, }; };