{"version":3,"sources":["../src/models/price.ts","../src/models/b2bMarketPrice.ts","../src/models/country.ts","../src/models/vatTax.ts","../src/models/organisation.ts","../src/models/supplier.ts","../src/models/seller.ts","../src/models/region.ts","../src/models/wineType.ts","../src/models/winery.ts","../src/models/wine.ts","../src/models/vintage.ts","../src/models/vintageProduct.ts","../src/models/upload.ts","../src/models/offer.ts"],"sourcesContent":["import {\n  CurrencyCodeEnum,\n  UploadVisibilityTypeEnum,\n} from \"@vini-wine/core-enums\";\nimport { PriceDto } from \"@vini-wine/core-dtos\";\n\nexport interface PriceModel {\n  // transform\n  priceMicros: number;\n  currency: CurrencyCodeEnum;\n  visibility: { id: UploadVisibilityTypeEnum };\n}\n\nexport const createPriceDtoFromAdminPriceModel = (\n  price: PriceModel,\n): PriceDto => {\n  return {\n    priceMicros: price.priceMicros,\n    currency: price.currency,\n    visibility: {\n      id: price.visibility ? price.visibility.id : null,\n    },\n  };\n};\n","import { createPriceDtoFromAdminPriceModel, PriceModel } from \"./price\";\nimport { B2bMarketPriceDto } from \"@vini-wine/core-dtos\";\n\nexport interface B2bMarketPriceModel {\n  // default includes\n  price: PriceModel | null;\n\n  // transform\n  updatedAt: Date;\n}\n\nexport const createB2BMarketPriceDtoFromAdminB2BMarketPriceModel = (\n  b2bMarketPrice: B2bMarketPriceModel,\n): B2bMarketPriceDto => {\n  return {\n    price: b2bMarketPrice.price\n      ? createPriceDtoFromAdminPriceModel(b2bMarketPrice.price)\n      : null,\n    updatedAt: b2bMarketPrice.updatedAt,\n  };\n};\n","import { CountryEnum } from \"@vini-wine/core-enums\";\nimport { CountryDto } from \"@vini-wine/core-dtos\";\n\nexport interface CountryModel {\n  // transform\n  codeAlpha2: CountryEnum;\n  codeAlpha3: string;\n  codeUn: string;\n}\n\nexport const createCountryDtoFromAdminCountryModel = (\n  country: CountryModel,\n): CountryDto => {\n  return {\n    codeAlpha2: country.codeAlpha2,\n  };\n};\n","import { CountryEnum } from \"@vini-wine/core-enums\";\nimport { VatTaxDto } from \"@vini-wine/core-dtos\";\n\nexport interface VatTaxModel {\n  countryCode: CountryEnum;\n  value: string;\n}\n\nexport const createVatTaxDtoFromAdminVatTaxModel = (\n  vatTax: VatTaxModel,\n): VatTaxDto => {\n  return {\n    countryCode: vatTax.countryCode,\n    value: vatTax.value,\n  };\n};\n","import { UUID } from \"../generic/uuid\";\nimport { PostalAddressModel } from \"./postalAddress\";\nimport { createVatTaxDtoFromAdminVatTaxModel, VatTaxModel } from \"./vatTax\";\nimport { SupplierModel } from \"./supplier\";\nimport { OrganisationStatusModel } from \"./organisationStatus\";\nimport { UserAccountModel } from \"./userAccount\";\nimport { ImageModel } from \"./image\";\nimport { UserOrganisationModel } from \"./userOrganisation\";\nimport { TimezoneEnum } from \"@vini-wine/core-enums\";\nimport { OrganisationDto } from \"@vini-wine/core-dtos\";\nimport { IntegrationExactModel } from \"./integrationExact\";\nimport { PermissionModel } from \"./permission\";\nimport { PlanModel } from \"./plan\";\n\nexport interface OrganisationModel extends UUID {\n  // available includes\n  suppliers?: Partial<SupplierModel>[];\n  billingPostalAddress?: PostalAddressModel;\n  defaultShippingPostalAddress?: PostalAddressModel | null;\n  organisationOwner?: Partial<UserAccountModel>;\n  registeredBy?: Partial<UserAccountModel>;\n  userOrganisations?: UserOrganisationModel[];\n  avatar?: ImageModel | null;\n  integrationExact?: IntegrationExactModel | null;\n  permissions?: PermissionModel[];\n  plan?: PlanModel;\n\n  // transform\n  name: string;\n  legalName: string;\n  vatTax: VatTaxModel;\n  createdAt: Date;\n  defaultTimezone: TimezoneEnum;\n  status: OrganisationStatusModel;\n}\n\nexport const createOrganisationDtoFromAdminOrganisationModel = (\n  organisation: OrganisationModel,\n): OrganisationDto => {\n  return {\n    defaultTimezone: organisation.defaultTimezone,\n    legalName: organisation.legalName,\n    name: organisation.name,\n    uuid: organisation.uuid,\n    vatTax: createVatTaxDtoFromAdminVatTaxModel(organisation.vatTax),\n  };\n};\n","import { UUID } from \"../generic/uuid\";\nimport {\n  createOrganisationDtoFromAdminOrganisationModel,\n  OrganisationModel,\n} from \"./organisation\";\nimport { ContactPointModel } from \"./contactPoint\";\nimport { SupplierDto } from \"@vini-wine/core-dtos\";\nimport { SupplierStatusEnum } from \"@vini-wine/core-enums\";\n\nexport interface SupplierModel extends UUID {\n  // transform\n  isCustomer: boolean;\n  name: string;\n  createdAt: Date;\n  status: {\n    id: SupplierStatusEnum;\n  };\n\n  // available includes\n  supplierOrganisation?: OrganisationModel;\n  organisation?: OrganisationModel;\n  primaryLogisticsContactPoint?: ContactPointModel | null;\n  primarySalesContactPoint?: ContactPointModel | null;\n}\n\nexport const createSupplierDtoFromAdminSupplierModel = (\n  supplier: SupplierModel,\n): SupplierDto => {\n  return {\n    name: supplier.name,\n    uuid: supplier.uuid,\n    supplierOrganisation: supplier.supplierOrganisation\n      ? createOrganisationDtoFromAdminOrganisationModel(\n          supplier.supplierOrganisation,\n        )\n      : undefined,\n  };\n};\n","import {\n  createOrganisationDtoFromAdminOrganisationModel,\n  OrganisationModel,\n} from \"./organisation\";\nimport { SellerDto } from \"@vini-wine/core-dtos\";\n\nexport interface SellerModel {\n  // available includes\n  organisation?: OrganisationModel;\n}\n\nexport const createSellerDtoFromAdminSellerModel = (\n  seller: SellerModel,\n): SellerDto => {\n  return {\n    uuid: seller.organisation ? seller.organisation.uuid : \"Not found\",\n    name: seller.organisation?.name,\n    organisation: seller.organisation\n      ? createOrganisationDtoFromAdminOrganisationModel(seller.organisation)\n      : undefined,\n  };\n};\n","import { UUID } from \"../generic/uuid\";\nimport { CountryModel, createCountryDtoFromAdminCountryModel } from \"./country\";\nimport { ImageModel } from \"./image\";\nimport { RegionDto } from \"@vini-wine/core-dtos\";\n\nexport interface RegionModel extends UUID {\n  // default includes\n  country: CountryModel;\n\n  // available includes\n  mappedItems?: any;\n  parentRegion?: RegionModel | null;\n  subRegions?: RegionModel[];\n  images?: ImageModel[];\n\n  // transform\n  name: string;\n}\n\nexport const createRegionDtoFromAdminRegionModel = (\n  region: RegionModel,\n): RegionDto => {\n  return {\n    uuid: region.uuid,\n    name: region.name,\n    country: createCountryDtoFromAdminCountryModel(region.country),\n  };\n};\n","import { UUID } from \"../generic/uuid\";\nimport { WineTypeDto } from \"@vini-wine/core-dtos\";\n\nexport interface WineTypeModel extends UUID {\n  // available includes\n  mappedItems?: any;\n\n  // transform\n  name: string;\n}\n\nexport const createWineTypeDtoFromAdminWineTypeModel = (\n  wineType: WineTypeModel,\n): WineTypeDto => {\n  return {\n    uuid: wineType.uuid,\n    name: wineType.name,\n  };\n};\n","import { UUID } from \"../generic/uuid\";\nimport { WineryDto } from \"@vini-wine/core-dtos\";\n\nexport interface WineryModel extends UUID {\n  // available includes\n  mappedItems?: any;\n\n  // transform\n  name: string;\n}\n\nexport const createWineryDtoFromAdminWineryModel = (\n  winery: WineryModel,\n): WineryDto => {\n  return {\n    uuid: winery.uuid,\n    name: winery.name,\n  };\n};\n","import { UUID } from \"../generic/uuid\";\n\nimport { createRegionDtoFromAdminRegionModel, RegionModel } from \"./region\";\nimport {\n  createWineTypeDtoFromAdminWineTypeModel,\n  WineTypeModel,\n} from \"./wineType\";\nimport { createWineryDtoFromAdminWineryModel, WineryModel } from \"./winery\";\nimport { WineDto } from \"@vini-wine/core-dtos\";\n\nexport interface WineModel extends UUID {\n  // available includes\n  region?: RegionModel;\n  wineType?: WineTypeModel;\n  winery?: WineryModel;\n  mappedItems?: any;\n\n  // transform\n  name: string;\n}\n\nexport const createWineDtoFromAdminWineModel = (wine: WineModel): WineDto => {\n  return {\n    uuid: wine.uuid,\n    name: wine.name,\n    wineType: wine.wineType\n      ? createWineTypeDtoFromAdminWineTypeModel(wine.wineType)\n      : undefined,\n    region: wine.region\n      ? createRegionDtoFromAdminRegionModel(wine.region)\n      : undefined,\n    winery: wine.winery\n      ? createWineryDtoFromAdminWineryModel(wine.winery)\n      : undefined,\n  };\n};\n","import { UUID } from \"../generic/uuid\";\nimport { createWineDtoFromAdminWineModel, WineModel } from \"./wine\";\nimport { VintageRatingModel } from \"./vintageRating\";\nimport { VintageScoreModel } from \"./vintageScore\";\nimport { ImageModel } from \"./image\";\nimport { VintageDto } from \"@vini-wine/core-dtos\";\n\nexport interface VintageModel extends UUID {\n  // transform\n  year: number;\n\n  // default includes\n  bottleImage: ImageModel | null;\n\n  // available includes\n  wine?: WineModel;\n  mappedExternal1Rating?: VintageRatingModel | null;\n  scores?: VintageScoreModel[];\n  labelImage?: ImageModel | null;\n}\n\nexport const createVintageDtoFromAdminVintageModel = (\n  vintage: VintageModel,\n): VintageDto => {\n  return {\n    uuid: vintage.uuid,\n    year: vintage.year,\n    wine: vintage.wine\n      ? createWineDtoFromAdminWineModel(vintage.wine)\n      : undefined,\n  };\n};\n","import { UUID } from \"../generic/uuid\";\nimport { createVintageDtoFromAdminVintageModel, VintageModel } from \"./vintage\";\nimport {\n  B2bMarketPriceModel,\n  createB2BMarketPriceDtoFromAdminB2BMarketPriceModel,\n} from \"./b2bMarketPrice\";\nimport { VintageProductDto } from \"@vini-wine/core-dtos\";\n\nexport interface VintageProductModel extends UUID {\n  // transform\n  milliliters: number;\n\n  // available includes\n  vintage?: VintageModel;\n  b2bMarketPrice?: B2bMarketPriceModel | null;\n}\n\nexport const createVintageProductDtoFromAdminVintageProductModel = (\n  vintageProduct: VintageProductModel,\n): VintageProductDto => {\n  return {\n    uuid: vintageProduct.uuid,\n    milliliters: vintageProduct.milliliters,\n    vintage: vintageProduct.vintage\n      ? createVintageDtoFromAdminVintageModel(vintageProduct.vintage)\n      : undefined,\n    b2bMarketPrice: vintageProduct.b2bMarketPrice\n      ? createB2BMarketPriceDtoFromAdminB2BMarketPriceModel(\n          vintageProduct.b2bMarketPrice,\n        )\n      : undefined,\n  };\n};\n","import { UUID } from \"../generic/uuid\";\nimport { UploadStatusEnum, UploadTypeEnum } from \"@vini-wine/core-enums\";\nimport { OrganisationModel } from \"./organisation\";\nimport { SupplierModel } from \"./supplier\";\nimport { UserAccountModel } from \"./userAccount\";\nimport { UploadVisibilityTypeModel } from \"./uploadVisibilityType\";\nimport { ImportFileHeaderModel } from \"./importFileHeader\";\nimport { UploadDto } from \"@vini-wine/core-dtos\";\n\nexport interface UploadModel extends UUID {\n  // transform\n  status: {\n    id: UploadStatusEnum;\n    statusUpdatedAt: Date;\n  };\n  type: {\n    id: UploadTypeEnum;\n  };\n  name: string;\n  validFrom: Date;\n  validUntil: Date;\n  numItems: number;\n  createdAt: Date;\n\n  // default includes\n  organisation: OrganisationModel;\n  organisationSupplier: SupplierModel;\n\n  // available includes\n  createdUser?: UserAccountModel;\n  visibilityTypes?: UploadVisibilityTypeModel[];\n  importFileHeaders?: ImportFileHeaderModel[];\n  statusUpdatedBy?: UserAccountModel | null;\n}\n\nexport const createUploadDtoFromAdminUploadModel = (\n  upload: UploadModel,\n): UploadDto => {\n  return {\n    uuid: upload.uuid,\n    name: upload.name,\n  };\n};\n","import { UUID } from \"../generic/uuid\";\nimport {\n  createSupplierDtoFromAdminSupplierModel,\n  SupplierModel,\n} from \"./supplier\";\nimport { createSellerDtoFromAdminSellerModel, SellerModel } from \"./seller\";\nimport {\n  createVintageProductDtoFromAdminVintageProductModel,\n  VintageProductModel,\n} from \"./vintageProduct\";\nimport { createPriceDtoFromAdminPriceModel, PriceModel } from \"./price\";\nimport { createUploadDtoFromAdminUploadModel, UploadModel } from \"./upload\";\nimport { PackageEnum } from \"@vini-wine/core-enums\";\nimport { CountryModel, createCountryDtoFromAdminCountryModel } from \"./country\";\nimport { OfferDto, VintageProductDto } from \"@vini-wine/core-dtos\";\n\nexport interface OfferModel extends UUID {\n  // default includes\n  price: PriceModel | null;\n\n  // available includes\n  supplier?: SupplierModel | null;\n  seller?: SellerModel;\n  vintageProducts?: VintageProductModel[];\n  upload?: UploadModel;\n  shippedFromCountry?: CountryModel | null;\n\n  // transform\n  quantity: number;\n  package: PackageEnum | null;\n  createdAt: Date;\n}\n\nexport const createOfferDtoFromAdminOfferModel = (\n  offer: OfferModel,\n): OfferDto => {\n  const vintageProducts: VintageProductDto[] = [];\n  if (offer.vintageProducts && offer.vintageProducts.length) {\n    for (let i = 0; i < offer.vintageProducts.length; i += 1) {\n      vintageProducts.push(\n        createVintageProductDtoFromAdminVintageProductModel(\n          offer.vintageProducts[i],\n        ),\n      );\n    }\n  }\n\n  return {\n    uuid: offer.uuid,\n    createdAt: offer.createdAt,\n    package: offer.package,\n    price: offer.price ? createPriceDtoFromAdminPriceModel(offer.price) : null,\n    quantity: offer.quantity,\n    seller: offer.seller\n      ? createSellerDtoFromAdminSellerModel(offer.seller)\n      : undefined,\n    supplier: offer.supplier\n      ? createSupplierDtoFromAdminSupplierModel(offer.supplier)\n      : undefined,\n    shippedFromCountry: offer.shippedFromCountry\n      ? createCountryDtoFromAdminCountryModel(offer.shippedFromCountry)\n      : undefined,\n    vintageProducts,\n    upload: offer.upload\n      ? createUploadDtoFromAdminUploadModel(offer.upload)\n      : undefined,\n  };\n};\n"],"mappings":";AAaO,IAAM,oCAAoC,CAC/C,UACa;AACb,SAAO;AAAA,IACL,aAAa,MAAM;AAAA,IACnB,UAAU,MAAM;AAAA,IAChB,YAAY;AAAA,MACV,IAAI,MAAM,aAAa,MAAM,WAAW,KAAK;AAAA,IAC/C;AAAA,EACF;AACF;;;ACZO,IAAM,sDAAsD,CACjE,mBACsB;AACtB,SAAO;AAAA,IACL,OAAO,eAAe,QAClB,kCAAkC,eAAe,KAAK,IACtD;AAAA,IACJ,WAAW,eAAe;AAAA,EAC5B;AACF;;;ACVO,IAAM,wCAAwC,CACnD,YACe;AACf,SAAO;AAAA,IACL,YAAY,QAAQ;AAAA,EACtB;AACF;;;ACRO,IAAM,sCAAsC,CACjD,WACc;AACd,SAAO;AAAA,IACL,aAAa,OAAO;AAAA,IACpB,OAAO,OAAO;AAAA,EAChB;AACF;;;ACqBO,IAAM,kDAAkD,CAC7D,iBACoB;AACpB,SAAO;AAAA,IACL,iBAAiB,aAAa;AAAA,IAC9B,WAAW,aAAa;AAAA,IACxB,MAAM,aAAa;AAAA,IAC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