@vini-wine/admin-core-models 1.1.1 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { CurrencyCodeEnum, UploadVisibilityTypeEnum, ContactPointTypeEnum, CountryEnum, OrganisationStatusEnum, UserOrganisationStatusEnum, GenderEnum, LocaleEnum, UserStatusEnum, ImageVariationEnum, ImageTypeEnum, TimezoneEnum, DateTimeFormatEnum, CurrencyRateSourceEnum, OfferAlertFilterCriteriaFieldEnum, FilterOperatorEnum, UploadStatusEnum, UploadTypeEnum, NotificationTypeEnum, NotificationChannelEnum, VintageRatingEnum, VintageScoreAuthorEnum, PackageEnum, OfferAlertTimelineActionEnum, OfferRequestStatusEnum, OfferRequestOptionEnum, OfferRequestOptionStatusEnum, OfferRequestTimelineActionEnum, OrganisationUserInvitationStatusEnum } from '@vini-wine/core-enums';
2
- import { CountryDto, RegionDto, WineTypeDto, WineryDto, WineDto } from '@vini-wine/core-dtos';
2
+ import { PriceDto, VatTaxDto, SupplierDto, OrganisationDto, CountryDto, SellerDto, RegionDto, WineTypeDto, WineryDto, WineDto, VintageDto, VintageProductDto, OfferDto } from '@vini-wine/core-dtos';
3
3
 
4
4
  interface PriceModel {
5
5
  priceMicros: number;
@@ -8,6 +8,7 @@ interface PriceModel {
8
8
  id: UploadVisibilityTypeEnum;
9
9
  };
10
10
  }
11
+ declare const createPriceDtoFromAdminPriceModel: (price: PriceModel) => PriceDto;
11
12
 
12
13
  interface B2bMarketPriceModel {
13
14
  price: PriceModel | null;
@@ -39,6 +40,7 @@ interface VatTaxModel {
39
40
  countryCode: CountryEnum;
40
41
  value: string;
41
42
  }
43
+ declare const createVatTaxDtoFromAdminVatTaxModel: (vatTax: VatTaxModel) => VatTaxDto;
42
44
 
43
45
  interface SupplierModel extends UUID {
44
46
  isCustomer: boolean;
@@ -50,6 +52,7 @@ interface SupplierModel extends UUID {
50
52
  contactPoints?: ContactPointModel[] | [];
51
53
  primarySalesContactPoint?: ContactPointModel | null;
52
54
  }
55
+ declare const createSupplierDtoFromAdminSupplierModel: (supplier: SupplierModel) => SupplierDto;
53
56
 
54
57
  interface OrganisationStatusModel {
55
58
  id: OrganisationStatusEnum;
@@ -156,6 +159,7 @@ interface OrganisationModel extends UUID {
156
159
  defaultTimezone: TimezoneEnum;
157
160
  status: OrganisationStatusModel;
158
161
  }
162
+ declare const createOrganisationDtoFromAdminOrganisationModel: (organisation: OrganisationModel) => OrganisationDto;
159
163
 
160
164
  interface ContactPointModel extends UUID {
161
165
  email: string | null;
@@ -171,7 +175,7 @@ interface CountryModel {
171
175
  codeAlpha3: string;
172
176
  codeUn: string;
173
177
  }
174
- declare const loadCountryDtoFromAdminCountryModel: (country: CountryModel) => CountryDto;
178
+ declare const createCountryDtoFromAdminCountryModel: (country: CountryModel) => CountryDto;
175
179
 
176
180
  interface CurrencyRateModel {
177
181
  currencyCode: CurrencyCodeEnum;
@@ -278,6 +282,7 @@ interface NotificationTypeModel {
278
282
  interface SellerModel extends UUID {
279
283
  organisation?: OrganisationModel;
280
284
  }
285
+ declare const createSellerDtoFromAdminSellerModel: (seller: SellerModel) => SellerDto;
281
286
 
282
287
  interface RegionModel extends UUID {
283
288
  country: CountryModel;
@@ -287,19 +292,19 @@ interface RegionModel extends UUID {
287
292
  images?: ImageModel[];
288
293
  name: string;
289
294
  }
290
- declare const loadRegionDtoFromAdminRegionModel: (region: RegionModel) => RegionDto;
295
+ declare const createRegionDtoFromAdminRegionModel: (region: RegionModel) => RegionDto;
291
296
 
292
297
  interface WineTypeModel extends UUID {
293
298
  mappedItems?: any;
294
299
  name: string;
295
300
  }
296
- declare const loadWineTypeDtoFromAdminWineTypeModel: (wineType: WineTypeModel) => WineTypeDto;
301
+ declare const createWineTypeDtoFromAdminWineTypeModel: (wineType: WineTypeModel) => WineTypeDto;
297
302
 
298
303
  interface WineryModel extends UUID {
299
304
  mappedItems?: any;
300
305
  name: string;
301
306
  }
302
- declare const loadWineryDtoFromAdminWineryModel: (winery: WineryModel) => WineryDto;
307
+ declare const createWineryDtoFromAdminWineryModel: (winery: WineryModel) => WineryDto;
303
308
 
304
309
  interface WineModel extends UUID {
305
310
  region?: RegionModel;
@@ -308,7 +313,7 @@ interface WineModel extends UUID {
308
313
  mappedItems?: any;
309
314
  name: string;
310
315
  }
311
- declare const loadWineDtoFromAdminWineModel: (wine: WineModel) => WineDto;
316
+ declare const createWineDtoFromAdminWineModel: (wine: WineModel) => WineDto;
312
317
 
313
318
  interface VintageRatingModel {
314
319
  numberOfRatings: number;
@@ -336,13 +341,14 @@ interface VintageModel extends UUID {
336
341
  scores?: VintageScoreModel[];
337
342
  images?: ImageModel[];
338
343
  }
344
+ declare const createVintageDtoFromAdminVintageModel: (vintage: VintageModel) => VintageDto;
339
345
 
340
346
  interface VintageProductModel extends UUID {
341
- name: string;
342
347
  milliliters: number;
343
348
  vintage?: VintageModel;
344
349
  b2bMarketPrice?: B2bMarketPriceModel | null;
345
350
  }
351
+ declare const createVintageProductDtoFromAdminVintageProductModel: (vintageProduct: VintageProductModel) => VintageProductDto;
346
352
 
347
353
  interface OfferModel extends UUID {
348
354
  price: PriceModel | null;
@@ -355,6 +361,7 @@ interface OfferModel extends UUID {
355
361
  package: PackageEnum | null;
356
362
  createdAt: Date;
357
363
  }
364
+ declare const createOfferDtoFromAdminOfferModel: (offer: OfferModel) => OfferDto;
358
365
 
359
366
  interface OfferAlertTimelineModel {
360
367
  actionCreatedAt: Date;
@@ -443,4 +450,4 @@ interface OrganisationUserInvitationModel {
443
450
  acceptedAt: Date | null;
444
451
  }
445
452
 
446
- export { type B2bMarketPriceModel, type ContactPointModel, type ContactTypeModel, type CountryModel, type CurrencyRateModel, type CustomerModel, type FilterCriteriaModel, type GenderModel, type ImageModel, type ImageTypeModel, type ImageVariationModel, type ImportFileHeaderModel, type ImportResolvedFileHeaderValueModel, type MarginMarketModel, type MarginOrganisationModel, type NotificationChannelModel, type NotificationModel, type NotificationTypeModel, type OfferAlertModel, type OfferAlertTimelineModel, type OfferModel, type OfferRequestModel, type OfferRequestOptionModel, type OfferRequestStatusModel, type OfferRequestTimelineModel, type OrganisationModel, type OrganisationUserInvitationModel, type OrganisationUserInvitationStatusModel, type PermissionModel, type PersonModel, type PostalAddressModel, type PriceModel, type RegionModel, type RoleModel, type SellerModel, type SupplierModel, type TelephoneModel, type UploadModel, type UploadVisibilityTypeModel, type UserAccountModel, type UserOrganisationModel, type UserOrganisationStatusModel, type UserStatusModel, type VatTaxModel, type VintageModel, type VintageProductModel, type VintageRatingModel, type VintageScoreAuthorModel, type VintageScoreModel, type WineModel, type WineTypeModel, type WineryModel, loadCountryDtoFromAdminCountryModel, loadRegionDtoFromAdminRegionModel, loadWineDtoFromAdminWineModel, loadWineTypeDtoFromAdminWineTypeModel, loadWineryDtoFromAdminWineryModel };
453
+ export { type B2bMarketPriceModel, type ContactPointModel, type ContactTypeModel, type CountryModel, type CurrencyRateModel, type CustomerModel, type FilterCriteriaModel, type GenderModel, type ImageModel, type ImageTypeModel, type ImageVariationModel, type ImportFileHeaderModel, type ImportResolvedFileHeaderValueModel, type MarginMarketModel, type MarginOrganisationModel, type NotificationChannelModel, type NotificationModel, type NotificationTypeModel, type OfferAlertModel, type OfferAlertTimelineModel, type OfferModel, type OfferRequestModel, type OfferRequestOptionModel, type OfferRequestStatusModel, type OfferRequestTimelineModel, type OrganisationModel, type OrganisationUserInvitationModel, type OrganisationUserInvitationStatusModel, type PermissionModel, type PersonModel, type PostalAddressModel, type PriceModel, type RegionModel, type RoleModel, type SellerModel, type SupplierModel, type TelephoneModel, type UploadModel, type UploadVisibilityTypeModel, type UserAccountModel, type UserOrganisationModel, type UserOrganisationStatusModel, type UserStatusModel, type VatTaxModel, type VintageModel, type VintageProductModel, type VintageRatingModel, type VintageScoreAuthorModel, type VintageScoreModel, type WineModel, type WineTypeModel, type WineryModel, createCountryDtoFromAdminCountryModel, createOfferDtoFromAdminOfferModel, createOrganisationDtoFromAdminOrganisationModel, createPriceDtoFromAdminPriceModel, createRegionDtoFromAdminRegionModel, createSellerDtoFromAdminSellerModel, createSupplierDtoFromAdminSupplierModel, createVatTaxDtoFromAdminVatTaxModel, createVintageDtoFromAdminVintageModel, createVintageProductDtoFromAdminVintageProductModel, createWineDtoFromAdminWineModel, createWineTypeDtoFromAdminWineTypeModel, createWineryDtoFromAdminWineryModel };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { CurrencyCodeEnum, UploadVisibilityTypeEnum, ContactPointTypeEnum, CountryEnum, OrganisationStatusEnum, UserOrganisationStatusEnum, GenderEnum, LocaleEnum, UserStatusEnum, ImageVariationEnum, ImageTypeEnum, TimezoneEnum, DateTimeFormatEnum, CurrencyRateSourceEnum, OfferAlertFilterCriteriaFieldEnum, FilterOperatorEnum, UploadStatusEnum, UploadTypeEnum, NotificationTypeEnum, NotificationChannelEnum, VintageRatingEnum, VintageScoreAuthorEnum, PackageEnum, OfferAlertTimelineActionEnum, OfferRequestStatusEnum, OfferRequestOptionEnum, OfferRequestOptionStatusEnum, OfferRequestTimelineActionEnum, OrganisationUserInvitationStatusEnum } from '@vini-wine/core-enums';
2
- import { CountryDto, RegionDto, WineTypeDto, WineryDto, WineDto } from '@vini-wine/core-dtos';
2
+ import { PriceDto, VatTaxDto, SupplierDto, OrganisationDto, CountryDto, SellerDto, RegionDto, WineTypeDto, WineryDto, WineDto, VintageDto, VintageProductDto, OfferDto } from '@vini-wine/core-dtos';
3
3
 
4
4
  interface PriceModel {
5
5
  priceMicros: number;
@@ -8,6 +8,7 @@ interface PriceModel {
8
8
  id: UploadVisibilityTypeEnum;
9
9
  };
10
10
  }
11
+ declare const createPriceDtoFromAdminPriceModel: (price: PriceModel) => PriceDto;
11
12
 
12
13
  interface B2bMarketPriceModel {
13
14
  price: PriceModel | null;
@@ -39,6 +40,7 @@ interface VatTaxModel {
39
40
  countryCode: CountryEnum;
40
41
  value: string;
41
42
  }
43
+ declare const createVatTaxDtoFromAdminVatTaxModel: (vatTax: VatTaxModel) => VatTaxDto;
42
44
 
43
45
  interface SupplierModel extends UUID {
44
46
  isCustomer: boolean;
@@ -50,6 +52,7 @@ interface SupplierModel extends UUID {
50
52
  contactPoints?: ContactPointModel[] | [];
51
53
  primarySalesContactPoint?: ContactPointModel | null;
52
54
  }
55
+ declare const createSupplierDtoFromAdminSupplierModel: (supplier: SupplierModel) => SupplierDto;
53
56
 
54
57
  interface OrganisationStatusModel {
55
58
  id: OrganisationStatusEnum;
@@ -156,6 +159,7 @@ interface OrganisationModel extends UUID {
156
159
  defaultTimezone: TimezoneEnum;
157
160
  status: OrganisationStatusModel;
158
161
  }
162
+ declare const createOrganisationDtoFromAdminOrganisationModel: (organisation: OrganisationModel) => OrganisationDto;
159
163
 
160
164
  interface ContactPointModel extends UUID {
161
165
  email: string | null;
@@ -171,7 +175,7 @@ interface CountryModel {
171
175
  codeAlpha3: string;
172
176
  codeUn: string;
173
177
  }
174
- declare const loadCountryDtoFromAdminCountryModel: (country: CountryModel) => CountryDto;
178
+ declare const createCountryDtoFromAdminCountryModel: (country: CountryModel) => CountryDto;
175
179
 
176
180
  interface CurrencyRateModel {
177
181
  currencyCode: CurrencyCodeEnum;
@@ -278,6 +282,7 @@ interface NotificationTypeModel {
278
282
  interface SellerModel extends UUID {
279
283
  organisation?: OrganisationModel;
280
284
  }
285
+ declare const createSellerDtoFromAdminSellerModel: (seller: SellerModel) => SellerDto;
281
286
 
282
287
  interface RegionModel extends UUID {
283
288
  country: CountryModel;
@@ -287,19 +292,19 @@ interface RegionModel extends UUID {
287
292
  images?: ImageModel[];
288
293
  name: string;
289
294
  }
290
- declare const loadRegionDtoFromAdminRegionModel: (region: RegionModel) => RegionDto;
295
+ declare const createRegionDtoFromAdminRegionModel: (region: RegionModel) => RegionDto;
291
296
 
292
297
  interface WineTypeModel extends UUID {
293
298
  mappedItems?: any;
294
299
  name: string;
295
300
  }
296
- declare const loadWineTypeDtoFromAdminWineTypeModel: (wineType: WineTypeModel) => WineTypeDto;
301
+ declare const createWineTypeDtoFromAdminWineTypeModel: (wineType: WineTypeModel) => WineTypeDto;
297
302
 
298
303
  interface WineryModel extends UUID {
299
304
  mappedItems?: any;
300
305
  name: string;
301
306
  }
302
- declare const loadWineryDtoFromAdminWineryModel: (winery: WineryModel) => WineryDto;
307
+ declare const createWineryDtoFromAdminWineryModel: (winery: WineryModel) => WineryDto;
303
308
 
304
309
  interface WineModel extends UUID {
305
310
  region?: RegionModel;
@@ -308,7 +313,7 @@ interface WineModel extends UUID {
308
313
  mappedItems?: any;
309
314
  name: string;
310
315
  }
311
- declare const loadWineDtoFromAdminWineModel: (wine: WineModel) => WineDto;
316
+ declare const createWineDtoFromAdminWineModel: (wine: WineModel) => WineDto;
312
317
 
313
318
  interface VintageRatingModel {
314
319
  numberOfRatings: number;
@@ -336,13 +341,14 @@ interface VintageModel extends UUID {
336
341
  scores?: VintageScoreModel[];
337
342
  images?: ImageModel[];
338
343
  }
344
+ declare const createVintageDtoFromAdminVintageModel: (vintage: VintageModel) => VintageDto;
339
345
 
340
346
  interface VintageProductModel extends UUID {
341
- name: string;
342
347
  milliliters: number;
343
348
  vintage?: VintageModel;
344
349
  b2bMarketPrice?: B2bMarketPriceModel | null;
345
350
  }
351
+ declare const createVintageProductDtoFromAdminVintageProductModel: (vintageProduct: VintageProductModel) => VintageProductDto;
346
352
 
347
353
  interface OfferModel extends UUID {
348
354
  price: PriceModel | null;
@@ -355,6 +361,7 @@ interface OfferModel extends UUID {
355
361
  package: PackageEnum | null;
356
362
  createdAt: Date;
357
363
  }
364
+ declare const createOfferDtoFromAdminOfferModel: (offer: OfferModel) => OfferDto;
358
365
 
359
366
  interface OfferAlertTimelineModel {
360
367
  actionCreatedAt: Date;
@@ -443,4 +450,4 @@ interface OrganisationUserInvitationModel {
443
450
  acceptedAt: Date | null;
444
451
  }
445
452
 
446
- export { type B2bMarketPriceModel, type ContactPointModel, type ContactTypeModel, type CountryModel, type CurrencyRateModel, type CustomerModel, type FilterCriteriaModel, type GenderModel, type ImageModel, type ImageTypeModel, type ImageVariationModel, type ImportFileHeaderModel, type ImportResolvedFileHeaderValueModel, type MarginMarketModel, type MarginOrganisationModel, type NotificationChannelModel, type NotificationModel, type NotificationTypeModel, type OfferAlertModel, type OfferAlertTimelineModel, type OfferModel, type OfferRequestModel, type OfferRequestOptionModel, type OfferRequestStatusModel, type OfferRequestTimelineModel, type OrganisationModel, type OrganisationUserInvitationModel, type OrganisationUserInvitationStatusModel, type PermissionModel, type PersonModel, type PostalAddressModel, type PriceModel, type RegionModel, type RoleModel, type SellerModel, type SupplierModel, type TelephoneModel, type UploadModel, type UploadVisibilityTypeModel, type UserAccountModel, type UserOrganisationModel, type UserOrganisationStatusModel, type UserStatusModel, type VatTaxModel, type VintageModel, type VintageProductModel, type VintageRatingModel, type VintageScoreAuthorModel, type VintageScoreModel, type WineModel, type WineTypeModel, type WineryModel, loadCountryDtoFromAdminCountryModel, loadRegionDtoFromAdminRegionModel, loadWineDtoFromAdminWineModel, loadWineTypeDtoFromAdminWineTypeModel, loadWineryDtoFromAdminWineryModel };
453
+ export { type B2bMarketPriceModel, type ContactPointModel, type ContactTypeModel, type CountryModel, type CurrencyRateModel, type CustomerModel, type FilterCriteriaModel, type GenderModel, type ImageModel, type ImageTypeModel, type ImageVariationModel, type ImportFileHeaderModel, type ImportResolvedFileHeaderValueModel, type MarginMarketModel, type MarginOrganisationModel, type NotificationChannelModel, type NotificationModel, type NotificationTypeModel, type OfferAlertModel, type OfferAlertTimelineModel, type OfferModel, type OfferRequestModel, type OfferRequestOptionModel, type OfferRequestStatusModel, type OfferRequestTimelineModel, type OrganisationModel, type OrganisationUserInvitationModel, type OrganisationUserInvitationStatusModel, type PermissionModel, type PersonModel, type PostalAddressModel, type PriceModel, type RegionModel, type RoleModel, type SellerModel, type SupplierModel, type TelephoneModel, type UploadModel, type UploadVisibilityTypeModel, type UserAccountModel, type UserOrganisationModel, type UserOrganisationStatusModel, type UserStatusModel, type VatTaxModel, type VintageModel, type VintageProductModel, type VintageRatingModel, type VintageScoreAuthorModel, type VintageScoreModel, type WineModel, type WineTypeModel, type WineryModel, createCountryDtoFromAdminCountryModel, createOfferDtoFromAdminOfferModel, createOrganisationDtoFromAdminOrganisationModel, createPriceDtoFromAdminPriceModel, createRegionDtoFromAdminRegionModel, createSellerDtoFromAdminSellerModel, createSupplierDtoFromAdminSupplierModel, createVatTaxDtoFromAdminVatTaxModel, createVintageDtoFromAdminVintageModel, createVintageProductDtoFromAdminVintageProductModel, createWineDtoFromAdminWineModel, createWineTypeDtoFromAdminWineTypeModel, createWineryDtoFromAdminWineryModel };
package/dist/index.js CHANGED
@@ -20,32 +20,79 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
- loadCountryDtoFromAdminCountryModel: () => loadCountryDtoFromAdminCountryModel,
24
- loadRegionDtoFromAdminRegionModel: () => loadRegionDtoFromAdminRegionModel,
25
- loadWineDtoFromAdminWineModel: () => loadWineDtoFromAdminWineModel,
26
- loadWineTypeDtoFromAdminWineTypeModel: () => loadWineTypeDtoFromAdminWineTypeModel,
27
- loadWineryDtoFromAdminWineryModel: () => loadWineryDtoFromAdminWineryModel
23
+ createCountryDtoFromAdminCountryModel: () => createCountryDtoFromAdminCountryModel,
24
+ createOfferDtoFromAdminOfferModel: () => createOfferDtoFromAdminOfferModel,
25
+ createOrganisationDtoFromAdminOrganisationModel: () => createOrganisationDtoFromAdminOrganisationModel,
26
+ createPriceDtoFromAdminPriceModel: () => createPriceDtoFromAdminPriceModel,
27
+ createRegionDtoFromAdminRegionModel: () => createRegionDtoFromAdminRegionModel,
28
+ createSellerDtoFromAdminSellerModel: () => createSellerDtoFromAdminSellerModel,
29
+ createSupplierDtoFromAdminSupplierModel: () => createSupplierDtoFromAdminSupplierModel,
30
+ createVatTaxDtoFromAdminVatTaxModel: () => createVatTaxDtoFromAdminVatTaxModel,
31
+ createVintageDtoFromAdminVintageModel: () => createVintageDtoFromAdminVintageModel,
32
+ createVintageProductDtoFromAdminVintageProductModel: () => createVintageProductDtoFromAdminVintageProductModel,
33
+ createWineDtoFromAdminWineModel: () => createWineDtoFromAdminWineModel,
34
+ createWineTypeDtoFromAdminWineTypeModel: () => createWineTypeDtoFromAdminWineTypeModel,
35
+ createWineryDtoFromAdminWineryModel: () => createWineryDtoFromAdminWineryModel
28
36
  });
29
37
  module.exports = __toCommonJS(src_exports);
30
38
 
31
39
  // src/models/country.ts
32
- var loadCountryDtoFromAdminCountryModel = (country) => {
40
+ var createCountryDtoFromAdminCountryModel = (country) => {
33
41
  return {
34
42
  codeAlpha2: country.codeAlpha2
35
43
  };
36
44
  };
37
45
 
46
+ // src/models/vatTax.ts
47
+ var createVatTaxDtoFromAdminVatTaxModel = (vatTax) => {
48
+ return {
49
+ countryCode: vatTax.countryCode,
50
+ value: vatTax.value
51
+ };
52
+ };
53
+
54
+ // src/models/organisation.ts
55
+ var createOrganisationDtoFromAdminOrganisationModel = (organisation) => {
56
+ return {
57
+ defaultTimezone: organisation.defaultTimezone,
58
+ legalName: organisation.legalName,
59
+ name: organisation.name,
60
+ uuid: organisation.uuid,
61
+ vatTax: createVatTaxDtoFromAdminVatTaxModel(organisation.vatTax)
62
+ };
63
+ };
64
+
65
+ // src/models/supplier.ts
66
+ var createSupplierDtoFromAdminSupplierModel = (supplier) => {
67
+ return {
68
+ name: supplier.name,
69
+ uuid: supplier.uuid,
70
+ supplierOrganisation: supplier.supplierOrganisation ? createOrganisationDtoFromAdminOrganisationModel(
71
+ supplier.supplierOrganisation
72
+ ) : void 0
73
+ };
74
+ };
75
+
76
+ // src/models/seller.ts
77
+ var createSellerDtoFromAdminSellerModel = (seller) => {
78
+ var _a;
79
+ return {
80
+ uuid: seller.uuid,
81
+ name: (_a = seller.organisation) == null ? void 0 : _a.name
82
+ };
83
+ };
84
+
38
85
  // src/models/region.ts
39
- var loadRegionDtoFromAdminRegionModel = (region) => {
86
+ var createRegionDtoFromAdminRegionModel = (region) => {
40
87
  return {
41
88
  uuid: region.uuid,
42
89
  name: region.name,
43
- country: loadCountryDtoFromAdminCountryModel(region.country)
90
+ country: createCountryDtoFromAdminCountryModel(region.country)
44
91
  };
45
92
  };
46
93
 
47
94
  // src/models/wineType.ts
48
- var loadWineTypeDtoFromAdminWineTypeModel = (wineType) => {
95
+ var createWineTypeDtoFromAdminWineTypeModel = (wineType) => {
49
96
  return {
50
97
  uuid: wineType.uuid,
51
98
  name: wineType.name
@@ -53,7 +100,7 @@ var loadWineTypeDtoFromAdminWineTypeModel = (wineType) => {
53
100
  };
54
101
 
55
102
  // src/models/winery.ts
56
- var loadWineryDtoFromAdminWineryModel = (winery) => {
103
+ var createWineryDtoFromAdminWineryModel = (winery) => {
57
104
  return {
58
105
  uuid: winery.uuid,
59
106
  name: winery.name
@@ -61,21 +108,79 @@ var loadWineryDtoFromAdminWineryModel = (winery) => {
61
108
  };
62
109
 
63
110
  // src/models/wine.ts
64
- var loadWineDtoFromAdminWineModel = (wine) => {
111
+ var createWineDtoFromAdminWineModel = (wine) => {
65
112
  return {
66
113
  uuid: wine.uuid,
67
114
  name: wine.name,
68
- wineType: wine.wineType ? loadWineTypeDtoFromAdminWineTypeModel(wine.wineType) : void 0,
69
- region: wine.region ? loadRegionDtoFromAdminRegionModel(wine.region) : void 0,
70
- winery: wine.winery ? loadWineryDtoFromAdminWineryModel(wine.winery) : void 0
115
+ wineType: wine.wineType ? createWineTypeDtoFromAdminWineTypeModel(wine.wineType) : void 0,
116
+ region: wine.region ? createRegionDtoFromAdminRegionModel(wine.region) : void 0,
117
+ winery: wine.winery ? createWineryDtoFromAdminWineryModel(wine.winery) : void 0
118
+ };
119
+ };
120
+
121
+ // src/models/vintage.ts
122
+ var createVintageDtoFromAdminVintageModel = (vintage) => {
123
+ return {
124
+ uuid: vintage.uuid,
125
+ year: vintage.year,
126
+ wine: vintage.wine ? createWineDtoFromAdminWineModel(vintage.wine) : void 0
127
+ };
128
+ };
129
+
130
+ // src/models/vintageProduct.ts
131
+ var createVintageProductDtoFromAdminVintageProductModel = (vintageProduct) => {
132
+ return {
133
+ uuid: vintageProduct.uuid,
134
+ milliliters: vintageProduct.milliliters,
135
+ vintage: vintageProduct.vintage ? createVintageDtoFromAdminVintageModel(vintageProduct.vintage) : void 0
136
+ };
137
+ };
138
+
139
+ // src/models/price.ts
140
+ var createPriceDtoFromAdminPriceModel = (price) => {
141
+ return {
142
+ priceMicros: price.priceMicros,
143
+ currency: price.currency
144
+ };
145
+ };
146
+
147
+ // src/models/offer.ts
148
+ var createOfferDtoFromAdminOfferModel = (offer) => {
149
+ const vintageProducts = [];
150
+ if (offer.vintageProducts && offer.vintageProducts.length) {
151
+ for (let i = 0; i < offer.vintageProducts.length; i += 1) {
152
+ vintageProducts.push(
153
+ createVintageProductDtoFromAdminVintageProductModel(
154
+ offer.vintageProducts[i]
155
+ )
156
+ );
157
+ }
158
+ }
159
+ return {
160
+ createdAt: offer.createdAt,
161
+ package: offer.package,
162
+ price: offer.price ? createPriceDtoFromAdminPriceModel(offer.price) : null,
163
+ quantity: offer.quantity,
164
+ seller: offer.seller ? createSellerDtoFromAdminSellerModel(offer.seller) : void 0,
165
+ supplier: offer.supplier ? createSupplierDtoFromAdminSupplierModel(offer.supplier) : void 0,
166
+ shippedFromCountry: offer.shippedFromCountry ? createCountryDtoFromAdminCountryModel(offer.shippedFromCountry) : void 0,
167
+ vintageProducts
71
168
  };
72
169
  };
73
170
  // Annotate the CommonJS export names for ESM import in node:
74
171
  0 && (module.exports = {
75
- loadCountryDtoFromAdminCountryModel,
76
- loadRegionDtoFromAdminRegionModel,
77
- loadWineDtoFromAdminWineModel,
78
- loadWineTypeDtoFromAdminWineTypeModel,
79
- loadWineryDtoFromAdminWineryModel
172
+ createCountryDtoFromAdminCountryModel,
173
+ createOfferDtoFromAdminOfferModel,
174
+ createOrganisationDtoFromAdminOrganisationModel,
175
+ createPriceDtoFromAdminPriceModel,
176
+ createRegionDtoFromAdminRegionModel,
177
+ createSellerDtoFromAdminSellerModel,
178
+ createSupplierDtoFromAdminSupplierModel,
179
+ createVatTaxDtoFromAdminVatTaxModel,
180
+ createVintageDtoFromAdminVintageModel,
181
+ createVintageProductDtoFromAdminVintageProductModel,
182
+ createWineDtoFromAdminWineModel,
183
+ createWineTypeDtoFromAdminWineTypeModel,
184
+ createWineryDtoFromAdminWineryModel
80
185
  });
81
186
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/models/country.ts","../src/models/region.ts","../src/models/wineType.ts","../src/models/winery.ts","../src/models/wine.ts"],"sourcesContent":["import { B2bMarketPriceModel } from \"./models/b2bMarketPrice\";\nimport { ContactPointModel } from \"./models/contactPoint\";\nimport { ContactTypeModel } from \"./models/contactType\";\nimport { CountryModel } from \"./models/country\";\nimport { CurrencyRateModel } from \"./models/currencyRate\";\nimport { CustomerModel } from \"./models/customer\";\nimport { FilterCriteriaModel } from \"./models/filterCriteria\";\nimport { GenderModel } from \"./models/gender\";\nimport { ImageModel } from \"./models/image\";\nimport { ImageTypeModel } from \"./models/imageType\";\nimport { ImageVariationModel } from \"./models/imageVariation\";\nimport { ImportFileHeaderModel } from \"./models/importFileHeader\";\nimport { ImportResolvedFileHeaderValueModel } from \"./models/importResolvedFileHeaderValue\";\nimport { MarginMarketModel } from \"./models/marginMarket\";\nimport { MarginOrganisationModel } from \"./models/marginOrganisation\";\nimport { NotificationModel } from \"./models/notification\";\nimport { NotificationChannelModel } from \"./models/notificationChannel\";\nimport { NotificationTypeModel } from \"./models/notificationType\";\nimport { OfferModel } from \"./models/offer\";\nimport { OfferAlertModel } from \"./models/offerAlert\";\nimport { OfferAlertTimelineModel } from \"./models/offerAlertTimeline\";\nimport { OfferRequestModel } from \"./models/offerRequest\";\nimport { OfferRequestOptionModel } from \"./models/offerRequestOption\";\nimport { OfferRequestStatusModel } from \"./models/offerRequestStatus\";\nimport { OfferRequestTimelineModel } from \"./models/offerRequestTimeline\";\nimport { OrganisationModel } from \"./models/organisation\";\nimport { OrganisationUserInvitationStatusModel } from \"./models/organisationUserInvitationStatus\";\nimport { PermissionModel } from \"./models/permission\";\nimport { PersonModel } from \"./models/person\";\nimport { PostalAddressModel } from \"./models/postalAddress\";\nimport { PriceModel } from \"./models/price\";\nimport { RegionModel } from \"./models/region\";\nimport { RoleModel } from \"./models/role\";\nimport { SellerModel } from \"./models/seller\";\nimport { SupplierModel } from \"./models/supplier\";\nimport { TelephoneModel } from \"./models/telephone\";\nimport { UploadModel } from \"./models/upload\";\nimport { UploadVisibilityTypeModel } from \"./models/uploadVisibilityType\";\nimport { UserAccountModel } from \"./models/userAccount\";\nimport { OrganisationUserInvitationModel } from \"./models/organisationUserInvitation\";\nimport { UserOrganisationModel } from \"./models/userOrganisation\";\nimport { UserOrganisationStatusModel } from \"./models/userOrganisationStatus\";\nimport { UserStatusModel } from \"./models/userStatus\";\nimport { VatTaxModel } from \"./models/vatTax\";\nimport { VintageModel } from \"./models/vintage\";\nimport { VintageProductModel } from \"./models/vintageProduct\";\nimport { VintageRatingModel } from \"./models/vintageRating\";\nimport { VintageScoreModel } from \"./models/vintageScore\";\nimport { VintageScoreAuthorModel } from \"./models/vintageScoreAuthor\";\nimport { WineModel } from \"./models/wine\";\nimport { WineryModel } from \"./models/winery\";\nimport { WineTypeModel } from \"./models/wineType\";\n\n// transformers from models to dto\nimport { loadCountryDtoFromAdminCountryModel } from \"./models/country\";\nimport { loadRegionDtoFromAdminRegionModel } from \"./models/region\";\nimport { loadWineDtoFromAdminWineModel } from \"./models/wine\";\nimport { loadWineryDtoFromAdminWineryModel } from \"./models/winery\";\nimport { loadWineTypeDtoFromAdminWineTypeModel } from \"./models/wineType\";\n\nexport {\n B2bMarketPriceModel,\n ContactPointModel,\n ContactTypeModel,\n CountryModel,\n CurrencyRateModel,\n CustomerModel,\n FilterCriteriaModel,\n GenderModel,\n ImageModel,\n ImageTypeModel,\n ImageVariationModel,\n ImportFileHeaderModel,\n ImportResolvedFileHeaderValueModel,\n MarginMarketModel,\n MarginOrganisationModel,\n NotificationModel,\n NotificationChannelModel,\n NotificationTypeModel,\n OfferModel,\n OfferAlertModel,\n OfferAlertTimelineModel,\n OfferRequestModel,\n OfferRequestOptionModel,\n OfferRequestStatusModel,\n OfferRequestTimelineModel,\n OrganisationModel,\n OrganisationUserInvitationStatusModel,\n PermissionModel,\n PersonModel,\n PostalAddressModel,\n PriceModel,\n RegionModel,\n RoleModel,\n SellerModel,\n SupplierModel,\n TelephoneModel,\n UploadModel,\n UploadVisibilityTypeModel,\n UserAccountModel,\n OrganisationUserInvitationModel,\n UserOrganisationModel,\n UserOrganisationStatusModel,\n UserStatusModel,\n VatTaxModel,\n VintageModel,\n VintageProductModel,\n VintageRatingModel,\n VintageScoreModel,\n VintageScoreAuthorModel,\n WineModel,\n WineryModel,\n WineTypeModel,\n\n // transformers from models to dto\n loadCountryDtoFromAdminCountryModel,\n loadRegionDtoFromAdminRegionModel,\n loadWineDtoFromAdminWineModel,\n loadWineryDtoFromAdminWineryModel,\n loadWineTypeDtoFromAdminWineTypeModel,\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 loadCountryDtoFromAdminCountryModel = (\n country: CountryModel,\n): CountryDto => {\n return {\n codeAlpha2: country.codeAlpha2,\n };\n};\n","import { UUID } from \"../generic/uuid\";\nimport { CountryModel, loadCountryDtoFromAdminCountryModel } 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 loadRegionDtoFromAdminRegionModel = (\n region: RegionModel,\n): RegionDto => {\n return {\n uuid: region.uuid,\n name: region.name,\n country: loadCountryDtoFromAdminCountryModel(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 loadWineTypeDtoFromAdminWineTypeModel = (\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 loadWineryDtoFromAdminWineryModel = (\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 { loadRegionDtoFromAdminRegionModel, RegionModel } from \"./region\";\nimport {\n loadWineTypeDtoFromAdminWineTypeModel,\n WineTypeModel,\n} from \"./wineType\";\nimport { loadWineryDtoFromAdminWineryModel, 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 loadWineDtoFromAdminWineModel = (wine: WineModel): WineDto => {\n return {\n uuid: wine.uuid,\n name: wine.name,\n wineType: wine.wineType\n ? loadWineTypeDtoFromAdminWineTypeModel(wine.wineType)\n : undefined,\n region: wine.region\n ? loadRegionDtoFromAdminRegionModel(wine.region)\n : undefined,\n winery: wine.winery\n ? loadWineryDtoFromAdminWineryModel(wine.winery)\n : undefined,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACUO,IAAM,sCAAsC,CACjD,YACe;AACf,SAAO;AAAA,IACL,YAAY,QAAQ;AAAA,EACtB;AACF;;;ACGO,IAAM,oCAAoC,CAC/C,WACc;AACd,SAAO;AAAA,IACL,MAAM,OAAO;AAAA,IACb,MAAM,OAAO;AAAA,IACb,SAAS,oCAAoC,OAAO,OAAO;AAAA,EAC7D;AACF;;;AChBO,IAAM,wCAAwC,CACnD,aACgB;AAChB,SAAO;AAAA,IACL,MAAM,SAAS;AAAA,IACf,MAAM,SAAS;AAAA,EACjB;AACF;;;ACPO,IAAM,oCAAoC,CAC/C,WACc;AACd,SAAO;AAAA,IACL,MAAM,OAAO;AAAA,IACb,MAAM,OAAO;AAAA,EACf;AACF;;;ACGO,IAAM,gCAAgC,CAAC,SAA6B;AACzE,SAAO;AAAA,IACL,MAAM,KAAK;AAAA,IACX,MAAM,KAAK;AAAA,IACX,UAAU,KAAK,WACX,sCAAsC,KAAK,QAAQ,IACnD;AAAA,IACJ,QAAQ,KAAK,SACT,kCAAkC,KAAK,MAAM,IAC7C;AAAA,IACJ,QAAQ,KAAK,SACT,kCAAkC,KAAK,MAAM,IAC7C;AAAA,EACN;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/index.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/price.ts","../src/models/offer.ts"],"sourcesContent":["import { B2bMarketPriceModel } from \"./models/b2bMarketPrice\";\nimport { ContactPointModel } from \"./models/contactPoint\";\nimport { ContactTypeModel } from \"./models/contactType\";\nimport { CountryModel } from \"./models/country\";\nimport { CurrencyRateModel } from \"./models/currencyRate\";\nimport { CustomerModel } from \"./models/customer\";\nimport { FilterCriteriaModel } from \"./models/filterCriteria\";\nimport { GenderModel } from \"./models/gender\";\nimport { ImageModel } from \"./models/image\";\nimport { ImageTypeModel } from \"./models/imageType\";\nimport { ImageVariationModel } from \"./models/imageVariation\";\nimport { ImportFileHeaderModel } from \"./models/importFileHeader\";\nimport { ImportResolvedFileHeaderValueModel } from \"./models/importResolvedFileHeaderValue\";\nimport { MarginMarketModel } from \"./models/marginMarket\";\nimport { MarginOrganisationModel } from \"./models/marginOrganisation\";\nimport { NotificationModel } from \"./models/notification\";\nimport { NotificationChannelModel } from \"./models/notificationChannel\";\nimport { NotificationTypeModel } from \"./models/notificationType\";\nimport { OfferModel } from \"./models/offer\";\nimport { OfferAlertModel } from \"./models/offerAlert\";\nimport { OfferAlertTimelineModel } from \"./models/offerAlertTimeline\";\nimport { OfferRequestModel } from \"./models/offerRequest\";\nimport { OfferRequestOptionModel } from \"./models/offerRequestOption\";\nimport { OfferRequestStatusModel } from \"./models/offerRequestStatus\";\nimport { OfferRequestTimelineModel } from \"./models/offerRequestTimeline\";\nimport { OrganisationModel } from \"./models/organisation\";\nimport { OrganisationUserInvitationStatusModel } from \"./models/organisationUserInvitationStatus\";\nimport { PermissionModel } from \"./models/permission\";\nimport { PersonModel } from \"./models/person\";\nimport { PostalAddressModel } from \"./models/postalAddress\";\nimport { PriceModel } from \"./models/price\";\nimport { RegionModel } from \"./models/region\";\nimport { RoleModel } from \"./models/role\";\nimport { SellerModel } from \"./models/seller\";\nimport { SupplierModel } from \"./models/supplier\";\nimport { TelephoneModel } from \"./models/telephone\";\nimport { UploadModel } from \"./models/upload\";\nimport { UploadVisibilityTypeModel } from \"./models/uploadVisibilityType\";\nimport { UserAccountModel } from \"./models/userAccount\";\nimport { OrganisationUserInvitationModel } from \"./models/organisationUserInvitation\";\nimport { UserOrganisationModel } from \"./models/userOrganisation\";\nimport { UserOrganisationStatusModel } from \"./models/userOrganisationStatus\";\nimport { UserStatusModel } from \"./models/userStatus\";\nimport { VatTaxModel } from \"./models/vatTax\";\nimport { VintageModel } from \"./models/vintage\";\nimport { VintageProductModel } from \"./models/vintageProduct\";\nimport { VintageRatingModel } from \"./models/vintageRating\";\nimport { VintageScoreModel } from \"./models/vintageScore\";\nimport { VintageScoreAuthorModel } from \"./models/vintageScoreAuthor\";\nimport { WineModel } from \"./models/wine\";\nimport { WineryModel } from \"./models/winery\";\nimport { WineTypeModel } from \"./models/wineType\";\n\n// transformers from models to dto\nimport { createCountryDtoFromAdminCountryModel } from \"./models/country\";\nimport { createOfferDtoFromAdminOfferModel } from \"./models/offer\";\nimport { createOrganisationDtoFromAdminOrganisationModel } from \"./models/organisation\";\nimport { createPriceDtoFromAdminPriceModel } from \"./models/price\";\nimport { createRegionDtoFromAdminRegionModel } from \"./models/region\";\nimport { createSellerDtoFromAdminSellerModel } from \"./models/seller\";\nimport { createSupplierDtoFromAdminSupplierModel } from \"./models/supplier\";\nimport { createVatTaxDtoFromAdminVatTaxModel } from \"./models/vatTax\";\nimport { createVintageDtoFromAdminVintageModel } from \"./models/vintage\";\nimport { createVintageProductDtoFromAdminVintageProductModel } from \"./models/vintageProduct\";\nimport { createWineDtoFromAdminWineModel } from \"./models/wine\";\nimport { createWineryDtoFromAdminWineryModel } from \"./models/winery\";\nimport { createWineTypeDtoFromAdminWineTypeModel } from \"./models/wineType\";\n\nexport {\n B2bMarketPriceModel,\n ContactPointModel,\n ContactTypeModel,\n CountryModel,\n CurrencyRateModel,\n CustomerModel,\n FilterCriteriaModel,\n GenderModel,\n ImageModel,\n ImageTypeModel,\n ImageVariationModel,\n ImportFileHeaderModel,\n ImportResolvedFileHeaderValueModel,\n MarginMarketModel,\n MarginOrganisationModel,\n NotificationModel,\n NotificationChannelModel,\n NotificationTypeModel,\n OfferModel,\n OfferAlertModel,\n OfferAlertTimelineModel,\n OfferRequestModel,\n OfferRequestOptionModel,\n OfferRequestStatusModel,\n OfferRequestTimelineModel,\n OrganisationModel,\n OrganisationUserInvitationStatusModel,\n PermissionModel,\n PersonModel,\n PostalAddressModel,\n PriceModel,\n RegionModel,\n RoleModel,\n SellerModel,\n SupplierModel,\n TelephoneModel,\n UploadModel,\n UploadVisibilityTypeModel,\n UserAccountModel,\n OrganisationUserInvitationModel,\n UserOrganisationModel,\n UserOrganisationStatusModel,\n UserStatusModel,\n VatTaxModel,\n VintageModel,\n VintageProductModel,\n VintageRatingModel,\n VintageScoreModel,\n VintageScoreAuthorModel,\n WineModel,\n WineryModel,\n WineTypeModel,\n\n // transformers from models to dto\n createCountryDtoFromAdminCountryModel,\n createOfferDtoFromAdminOfferModel,\n createOrganisationDtoFromAdminOrganisationModel,\n createPriceDtoFromAdminPriceModel,\n createRegionDtoFromAdminRegionModel,\n createSellerDtoFromAdminSellerModel,\n createSupplierDtoFromAdminSupplierModel,\n createVatTaxDtoFromAdminVatTaxModel,\n createVintageDtoFromAdminVintageModel,\n createVintageProductDtoFromAdminVintageProductModel,\n createWineDtoFromAdminWineModel,\n createWineryDtoFromAdminWineryModel,\n createWineTypeDtoFromAdminWineTypeModel,\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\";\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 numUserOrganisations?: number;\n numSuppliers?: number;\n numSuppliedSuppliers?: number;\n numUploads?: number;\n avatar?: ImageModel | null;\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\";\n\nexport interface SupplierModel extends UUID {\n // transform\n isCustomer: boolean;\n name: string;\n createdAt: Date;\n\n // available includes\n supplierOrganisation?: OrganisationModel;\n organisation?: OrganisationModel;\n primaryLogisticsContactPoint?: ContactPointModel | null;\n contactPoints?: ContactPointModel[] | [];\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 { UUID } from \"../generic/uuid\";\nimport { OrganisationModel } from \"./organisation\";\nimport { SellerDto } from \"@vini-wine/core-dtos\";\n\nexport interface SellerModel extends UUID {\n // available includes\n organisation?: OrganisationModel;\n}\n\nexport const createSellerDtoFromAdminSellerModel = (\n seller: SellerModel,\n): SellerDto => {\n return {\n uuid: seller.uuid,\n name: seller.organisation?.name,\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 // available includes\n wine?: WineModel;\n mappedExternal1Rating?: VintageRatingModel | null;\n scores?: VintageScoreModel[];\n images?: ImageModel[];\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 { B2bMarketPriceModel } 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 };\n};\n","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 };\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 { 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 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 };\n};\n"],"mappings":"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","names":[]}
package/dist/index.mjs CHANGED
@@ -1,21 +1,60 @@
1
1
  // src/models/country.ts
2
- var loadCountryDtoFromAdminCountryModel = (country) => {
2
+ var createCountryDtoFromAdminCountryModel = (country) => {
3
3
  return {
4
4
  codeAlpha2: country.codeAlpha2
5
5
  };
6
6
  };
7
7
 
8
+ // src/models/vatTax.ts
9
+ var createVatTaxDtoFromAdminVatTaxModel = (vatTax) => {
10
+ return {
11
+ countryCode: vatTax.countryCode,
12
+ value: vatTax.value
13
+ };
14
+ };
15
+
16
+ // src/models/organisation.ts
17
+ var createOrganisationDtoFromAdminOrganisationModel = (organisation) => {
18
+ return {
19
+ defaultTimezone: organisation.defaultTimezone,
20
+ legalName: organisation.legalName,
21
+ name: organisation.name,
22
+ uuid: organisation.uuid,
23
+ vatTax: createVatTaxDtoFromAdminVatTaxModel(organisation.vatTax)
24
+ };
25
+ };
26
+
27
+ // src/models/supplier.ts
28
+ var createSupplierDtoFromAdminSupplierModel = (supplier) => {
29
+ return {
30
+ name: supplier.name,
31
+ uuid: supplier.uuid,
32
+ supplierOrganisation: supplier.supplierOrganisation ? createOrganisationDtoFromAdminOrganisationModel(
33
+ supplier.supplierOrganisation
34
+ ) : void 0
35
+ };
36
+ };
37
+
38
+ // src/models/seller.ts
39
+ var createSellerDtoFromAdminSellerModel = (seller) => {
40
+ var _a;
41
+ return {
42
+ uuid: seller.uuid,
43
+ name: (_a = seller.organisation) == null ? void 0 : _a.name
44
+ };
45
+ };
46
+
8
47
  // src/models/region.ts
9
- var loadRegionDtoFromAdminRegionModel = (region) => {
48
+ var createRegionDtoFromAdminRegionModel = (region) => {
10
49
  return {
11
50
  uuid: region.uuid,
12
51
  name: region.name,
13
- country: loadCountryDtoFromAdminCountryModel(region.country)
52
+ country: createCountryDtoFromAdminCountryModel(region.country)
14
53
  };
15
54
  };
16
55
 
17
56
  // src/models/wineType.ts
18
- var loadWineTypeDtoFromAdminWineTypeModel = (wineType) => {
57
+ var createWineTypeDtoFromAdminWineTypeModel = (wineType) => {
19
58
  return {
20
59
  uuid: wineType.uuid,
21
60
  name: wineType.name
@@ -23,7 +62,7 @@ var loadWineTypeDtoFromAdminWineTypeModel = (wineType) => {
23
62
  };
24
63
 
25
64
  // src/models/winery.ts
26
- var loadWineryDtoFromAdminWineryModel = (winery) => {
65
+ var createWineryDtoFromAdminWineryModel = (winery) => {
27
66
  return {
28
67
  uuid: winery.uuid,
29
68
  name: winery.name
@@ -31,20 +70,78 @@ var loadWineryDtoFromAdminWineryModel = (winery) => {
31
70
  };
32
71
 
33
72
  // src/models/wine.ts
34
- var loadWineDtoFromAdminWineModel = (wine) => {
73
+ var createWineDtoFromAdminWineModel = (wine) => {
35
74
  return {
36
75
  uuid: wine.uuid,
37
76
  name: wine.name,
38
- wineType: wine.wineType ? loadWineTypeDtoFromAdminWineTypeModel(wine.wineType) : void 0,
39
- region: wine.region ? loadRegionDtoFromAdminRegionModel(wine.region) : void 0,
40
- winery: wine.winery ? loadWineryDtoFromAdminWineryModel(wine.winery) : void 0
77
+ wineType: wine.wineType ? createWineTypeDtoFromAdminWineTypeModel(wine.wineType) : void 0,
78
+ region: wine.region ? createRegionDtoFromAdminRegionModel(wine.region) : void 0,
79
+ winery: wine.winery ? createWineryDtoFromAdminWineryModel(wine.winery) : void 0
80
+ };
81
+ };
82
+
83
+ // src/models/vintage.ts
84
+ var createVintageDtoFromAdminVintageModel = (vintage) => {
85
+ return {
86
+ uuid: vintage.uuid,
87
+ year: vintage.year,
88
+ wine: vintage.wine ? createWineDtoFromAdminWineModel(vintage.wine) : void 0
89
+ };
90
+ };
91
+
92
+ // src/models/vintageProduct.ts
93
+ var createVintageProductDtoFromAdminVintageProductModel = (vintageProduct) => {
94
+ return {
95
+ uuid: vintageProduct.uuid,
96
+ milliliters: vintageProduct.milliliters,
97
+ vintage: vintageProduct.vintage ? createVintageDtoFromAdminVintageModel(vintageProduct.vintage) : void 0
98
+ };
99
+ };
100
+
101
+ // src/models/price.ts
102
+ var createPriceDtoFromAdminPriceModel = (price) => {
103
+ return {
104
+ priceMicros: price.priceMicros,
105
+ currency: price.currency
106
+ };
107
+ };
108
+
109
+ // src/models/offer.ts
110
+ var createOfferDtoFromAdminOfferModel = (offer) => {
111
+ const vintageProducts = [];
112
+ if (offer.vintageProducts && offer.vintageProducts.length) {
113
+ for (let i = 0; i < offer.vintageProducts.length; i += 1) {
114
+ vintageProducts.push(
115
+ createVintageProductDtoFromAdminVintageProductModel(
116
+ offer.vintageProducts[i]
117
+ )
118
+ );
119
+ }
120
+ }
121
+ return {
122
+ createdAt: offer.createdAt,
123
+ package: offer.package,
124
+ price: offer.price ? createPriceDtoFromAdminPriceModel(offer.price) : null,
125
+ quantity: offer.quantity,
126
+ seller: offer.seller ? createSellerDtoFromAdminSellerModel(offer.seller) : void 0,
127
+ supplier: offer.supplier ? createSupplierDtoFromAdminSupplierModel(offer.supplier) : void 0,
128
+ shippedFromCountry: offer.shippedFromCountry ? createCountryDtoFromAdminCountryModel(offer.shippedFromCountry) : void 0,
129
+ vintageProducts
41
130
  };
42
131
  };
43
132
  export {
44
- loadCountryDtoFromAdminCountryModel,
45
- loadRegionDtoFromAdminRegionModel,
46
- loadWineDtoFromAdminWineModel,
47
- loadWineTypeDtoFromAdminWineTypeModel,
48
- loadWineryDtoFromAdminWineryModel
133
+ createCountryDtoFromAdminCountryModel,
134
+ createOfferDtoFromAdminOfferModel,
135
+ createOrganisationDtoFromAdminOrganisationModel,
136
+ createPriceDtoFromAdminPriceModel,
137
+ createRegionDtoFromAdminRegionModel,
138
+ createSellerDtoFromAdminSellerModel,
139
+ createSupplierDtoFromAdminSupplierModel,
140
+ createVatTaxDtoFromAdminVatTaxModel,
141
+ createVintageDtoFromAdminVintageModel,
142
+ createVintageProductDtoFromAdminVintageProductModel,
143
+ createWineDtoFromAdminWineModel,
144
+ createWineTypeDtoFromAdminWineTypeModel,
145
+ createWineryDtoFromAdminWineryModel
49
146
  };
50
147
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/models/country.ts","../src/models/region.ts","../src/models/wineType.ts","../src/models/winery.ts","../src/models/wine.ts"],"sourcesContent":["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 loadCountryDtoFromAdminCountryModel = (\n country: CountryModel,\n): CountryDto => {\n return {\n codeAlpha2: country.codeAlpha2,\n };\n};\n","import { UUID } from \"../generic/uuid\";\nimport { CountryModel, loadCountryDtoFromAdminCountryModel } 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 loadRegionDtoFromAdminRegionModel = (\n region: RegionModel,\n): RegionDto => {\n return {\n uuid: region.uuid,\n name: region.name,\n country: loadCountryDtoFromAdminCountryModel(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 loadWineTypeDtoFromAdminWineTypeModel = (\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 loadWineryDtoFromAdminWineryModel = (\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 { loadRegionDtoFromAdminRegionModel, RegionModel } from \"./region\";\nimport {\n loadWineTypeDtoFromAdminWineTypeModel,\n WineTypeModel,\n} from \"./wineType\";\nimport { loadWineryDtoFromAdminWineryModel, 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 loadWineDtoFromAdminWineModel = (wine: WineModel): WineDto => {\n return {\n uuid: wine.uuid,\n name: wine.name,\n wineType: wine.wineType\n ? loadWineTypeDtoFromAdminWineTypeModel(wine.wineType)\n : undefined,\n region: wine.region\n ? loadRegionDtoFromAdminRegionModel(wine.region)\n : undefined,\n winery: wine.winery\n ? loadWineryDtoFromAdminWineryModel(wine.winery)\n : undefined,\n };\n};\n"],"mappings":";AAUO,IAAM,sCAAsC,CACjD,YACe;AACf,SAAO;AAAA,IACL,YAAY,QAAQ;AAAA,EACtB;AACF;;;ACGO,IAAM,oCAAoC,CAC/C,WACc;AACd,SAAO;AAAA,IACL,MAAM,OAAO;AAAA,IACb,MAAM,OAAO;AAAA,IACb,SAAS,oCAAoC,OAAO,OAAO;AAAA,EAC7D;AACF;;;AChBO,IAAM,wCAAwC,CACnD,aACgB;AAChB,SAAO;AAAA,IACL,MAAM,SAAS;AAAA,IACf,MAAM,SAAS;AAAA,EACjB;AACF;;;ACPO,IAAM,oCAAoC,CAC/C,WACc;AACd,SAAO;AAAA,IACL,MAAM,OAAO;AAAA,IACb,MAAM,OAAO;AAAA,EACf;AACF;;;ACGO,IAAM,gCAAgC,CAAC,SAA6B;AACzE,SAAO;AAAA,IACL,MAAM,KAAK;AAAA,IACX,MAAM,KAAK;AAAA,IACX,UAAU,KAAK,WACX,sCAAsC,KAAK,QAAQ,IACnD;AAAA,IACJ,QAAQ,KAAK,SACT,kCAAkC,KAAK,MAAM,IAC7C;AAAA,IACJ,QAAQ,KAAK,SACT,kCAAkC,KAAK,MAAM,IAC7C;AAAA,EACN;AACF;","names":[]}
1
+ {"version":3,"sources":["../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/price.ts","../src/models/offer.ts"],"sourcesContent":["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\";\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 numUserOrganisations?: number;\n numSuppliers?: number;\n numSuppliedSuppliers?: number;\n numUploads?: number;\n avatar?: ImageModel | null;\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\";\n\nexport interface SupplierModel extends UUID {\n // transform\n isCustomer: boolean;\n name: string;\n createdAt: Date;\n\n // available includes\n supplierOrganisation?: OrganisationModel;\n organisation?: OrganisationModel;\n primaryLogisticsContactPoint?: ContactPointModel | null;\n contactPoints?: ContactPointModel[] | [];\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 { UUID } from \"../generic/uuid\";\nimport { OrganisationModel } from \"./organisation\";\nimport { SellerDto } from \"@vini-wine/core-dtos\";\n\nexport interface SellerModel extends UUID {\n // available includes\n organisation?: OrganisationModel;\n}\n\nexport const createSellerDtoFromAdminSellerModel = (\n seller: SellerModel,\n): SellerDto => {\n return {\n uuid: seller.uuid,\n name: seller.organisation?.name,\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 // available includes\n wine?: WineModel;\n mappedExternal1Rating?: VintageRatingModel | null;\n scores?: VintageScoreModel[];\n images?: ImageModel[];\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 { B2bMarketPriceModel } 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 };\n};\n","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 };\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 { 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 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 };\n};\n"],"mappings":"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","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vini-wine/admin-core-models",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "Core package for Vini models related to the admin API.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",