@chevre/domain 22.14.0-alpha.23 → 22.14.0-alpha.24

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.
@@ -753,13 +753,7 @@ class EventRepo {
753
753
  positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PUBLIC_PROJECT_FIELDS.includes(key));
754
754
  projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
755
755
  if (includeOffers) {
756
- projection = Object.assign(Object.assign(Object.assign({}, projection), { 'offers.typeOf': 1,
757
- // 'offers.availabilityEnds': 1,
758
- // 'offers.availabilityStarts': 1,
759
- 'offers.eligibleQuantity': 1, 'offers.itemOffered': 1, 'offers.offeredThrough': 1,
760
- // 'offers.validFrom': 1,
761
- // 'offers.validThrough': 1,
762
- 'offers.unacceptedPaymentMethod': 1, 'offers.seller.typeOf': 1, 'offers.seller.id': 1, 'offers.seller.name': 1 }), (includeSellerMakesOffer)
756
+ projection = Object.assign(Object.assign(Object.assign({}, projection), { 'offers.typeOf': 1, 'offers.eligibleQuantity': 1, 'offers.itemOffered': 1, 'offers.identifier': 1, 'offers.offeredThrough': 1, 'offers.unacceptedPaymentMethod': 1, 'offers.seller.typeOf': 1, 'offers.seller.id': 1, 'offers.seller.name': 1 }), (includeSellerMakesOffer)
763
757
  ? Object.assign({}, (Array.isArray(sellerMakesOfferAvailableAtIn))
764
758
  ? {
765
759
  'offers.seller.makesOffer': {
@@ -1,32 +1,9 @@
1
1
  import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
2
2
  import * as factory from '../../../factory';
3
- interface IProductOffer {
4
- project: {
5
- id: string;
6
- typeOf: factory.organizationType.Project;
7
- };
8
- typeOf: factory.offerType.Offer;
9
- /**
10
- * プロダクトオファーコード
11
- */
12
- identifier: string;
13
- itemOffered: {
14
- typeOf: factory.offerType.AggregateOffer;
15
- /**
16
- * プロダクトオファーコレクションコード
17
- */
18
- identifier: string;
19
- };
20
- availability: factory.itemAvailability.InStock | factory.itemAvailability.OutOfStock;
21
- validFrom: Date;
22
- validThrough: Date;
23
- acceptedPaymentMethod?: {
24
- typeOf: 'PaymentMethod';
25
- identifier: string;
26
- };
27
- validForMemberTier?: Pick<factory.issuer.IMemberProgramTier, 'identifier' | 'typeOf'>;
28
- }
29
- type IDocType = IProductOffer;
3
+ type IDocType = Omit<factory.productOffer.IProductOffer, 'acceptedPaymentMethod' | 'validForMemberTier'> & {
4
+ acceptedPaymentMethod?: factory.productOffer.IAcceptedPaymentMethod;
5
+ validForMemberTier?: factory.productOffer.IValidForMemberTier;
6
+ };
30
7
  type IModel = Model<IDocType>;
31
8
  type ISchemaDefinition = SchemaDefinition<IDocType>;
32
9
  type ISchema = Schema<IDocType, IModel, {}, {}, {}, {}, ISchemaDefinition, IDocType>;
@@ -2,45 +2,10 @@ import type { BulkWriteResult } from 'mongodb';
2
2
  import { Connection, FilterQuery } from 'mongoose';
3
3
  import * as factory from '../factory';
4
4
  import { IDocType } from './mongoose/schemas/productOffer';
5
- export { IDocType as IProductOffer };
6
- interface ISearchConditions {
7
- limit?: number;
8
- page?: number;
9
- sort?: {
10
- validFrom?: factory.sortType;
11
- };
12
- project?: {
13
- id?: {
14
- $eq?: string;
15
- };
16
- };
17
- id?: {
18
- $eq?: string;
19
- };
20
- itemOffered?: {
21
- identifier?: {
22
- $eq?: string;
23
- };
24
- };
25
- validForMemberTier?: {
26
- identifier?: {
27
- $eq?: string;
28
- };
29
- };
30
- validFrom?: {
31
- $lte?: Date;
32
- };
33
- validThrough?: {
34
- $gte?: Date;
35
- };
36
- }
37
- export type ISavingOffer = Pick<IDocType, 'identifier' | 'itemOffered' | 'project' | 'typeOf' | 'validFrom' | 'validThrough' | 'availability' | 'validForMemberTier' | 'acceptedPaymentMethod'> & {
38
- id?: never;
39
- };
40
5
  type IUnset = {
41
6
  [key in keyof IDocType]?: 1;
42
7
  };
43
- type IDocWithId = IDocType & {
8
+ type IDocWithId = factory.productOffer.IProductOffer & {
44
9
  id: string;
45
10
  };
46
11
  type IKeyOfProjection = keyof IDocType;
@@ -50,8 +15,8 @@ type IKeyOfProjection = keyof IDocType;
50
15
  export declare class ProductOfferRepo {
51
16
  private readonly productOfferModel;
52
17
  constructor(connection: Connection);
53
- static CREATE_MONGO_CONDITIONS(params: ISearchConditions): FilterQuery<IDocType>[];
54
- findProductOffers(params: ISearchConditions, inclusion: IKeyOfProjection[]): Promise<IDocWithId[]>;
18
+ static CREATE_MONGO_CONDITIONS(params: factory.productOffer.ISearchConditions): FilterQuery<IDocType>[];
19
+ findProductOffers(params: factory.productOffer.ISearchConditions, inclusion: IKeyOfProjection[]): Promise<IDocWithId[]>;
55
20
  /**
56
21
  * オファーコードとオファーコレクションコードをキーにして冪等置換
57
22
  */
@@ -73,3 +38,4 @@ export declare class ProductOfferRepo {
73
38
  }[];
74
39
  } | void>;
75
40
  }
41
+ export {};
@@ -32,7 +32,7 @@ class ProductOfferRepo {
32
32
  this.productOfferModel = connection.model(productOffer_1.modelName, (0, productOffer_1.createSchema)());
33
33
  }
34
34
  static CREATE_MONGO_CONDITIONS(params) {
35
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
35
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
36
36
  const andConditions = [];
37
37
  const idEq = (_a = params.id) === null || _a === void 0 ? void 0 : _a.$eq;
38
38
  if (typeof idEq === 'string') {
@@ -42,19 +42,27 @@ class ProductOfferRepo {
42
42
  if (typeof projectIdEq === 'string') {
43
43
  andConditions.push({ 'project.id': { $eq: projectIdEq } });
44
44
  }
45
- const itemOfferedIdentifierEq = (_e = (_d = params.itemOffered) === null || _d === void 0 ? void 0 : _d.identifier) === null || _e === void 0 ? void 0 : _e.$eq;
45
+ const identifierEq = (_d = params.identifier) === null || _d === void 0 ? void 0 : _d.$eq;
46
+ if (typeof identifierEq === 'string') {
47
+ andConditions.push({ identifier: { $eq: identifierEq } });
48
+ }
49
+ const identifierIn = (_e = params.identifier) === null || _e === void 0 ? void 0 : _e.$in;
50
+ if (Array.isArray(identifierIn)) {
51
+ andConditions.push({ identifier: { $in: identifierIn } });
52
+ }
53
+ const itemOfferedIdentifierEq = (_g = (_f = params.itemOffered) === null || _f === void 0 ? void 0 : _f.identifier) === null || _g === void 0 ? void 0 : _g.$eq;
46
54
  if (typeof itemOfferedIdentifierEq === 'string') {
47
55
  andConditions.push({ 'itemOffered.identifier': { $eq: itemOfferedIdentifierEq } });
48
56
  }
49
- const validForMemberTierIdentifierEq = (_g = (_f = params.validForMemberTier) === null || _f === void 0 ? void 0 : _f.identifier) === null || _g === void 0 ? void 0 : _g.$eq;
57
+ const validForMemberTierIdentifierEq = (_j = (_h = params.validForMemberTier) === null || _h === void 0 ? void 0 : _h.identifier) === null || _j === void 0 ? void 0 : _j.$eq;
50
58
  if (typeof validForMemberTierIdentifierEq === 'string') {
51
59
  andConditions.push({ 'validForMemberTier.identifier': { $exists: true, $eq: validForMemberTierIdentifierEq } });
52
60
  }
53
- const validFromLte = (_h = params.validFrom) === null || _h === void 0 ? void 0 : _h.$lte;
61
+ const validFromLte = (_k = params.validFrom) === null || _k === void 0 ? void 0 : _k.$lte;
54
62
  if (validFromLte instanceof Date) {
55
63
  andConditions.push({ validFrom: { $lte: validFromLte } });
56
64
  }
57
- const validThroughGte = (_j = params.validThrough) === null || _j === void 0 ? void 0 : _j.$gte;
65
+ const validThroughGte = (_l = params.validThrough) === null || _l === void 0 ? void 0 : _l.$gte;
58
66
  if (validThroughGte instanceof Date) {
59
67
  andConditions.push({ validThrough: { $gte: validThroughGte } });
60
68
  }
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "dependencies": {
12
12
  "@aws-sdk/client-cognito-identity-provider": "3.600.0",
13
13
  "@aws-sdk/credential-providers": "3.600.0",
14
- "@chevre/factory": "4.399.0-alpha.20",
14
+ "@chevre/factory": "4.399.0-alpha.21",
15
15
  "@cinerino/sdk": "12.2.0",
16
16
  "@motionpicture/coa-service": "9.6.0",
17
17
  "@motionpicture/gmo-service": "5.4.0-alpha.1",
@@ -115,5 +115,5 @@
115
115
  "postversion": "git push origin --tags",
116
116
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
117
117
  },
118
- "version": "22.14.0-alpha.23"
118
+ "version": "22.14.0-alpha.24"
119
119
  }