@chevre/domain 22.7.0-alpha.9 → 22.7.0

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.
Files changed (97) hide show
  1. package/example/src/chevre/aggregateOfferCatalogItemList.ts +36 -0
  2. package/example/src/chevre/aggregation/aggregateOffersOnEvent.ts +1 -1
  3. package/example/src/chevre/aggregation/searchAggregateReservations.ts +1 -1
  4. package/example/src/chevre/deleteDiscontinuedPeople.ts +153 -0
  5. package/example/src/chevre/deleteDiscontinuedPeopleByFetch.ts +38 -0
  6. package/example/src/chevre/findJWTSetting.ts +19 -0
  7. package/example/src/chevre/person/checkUserPoolClients.ts +119 -0
  8. package/example/src/chevre/person/cleanUpCognitoUsers.ts +73 -23
  9. package/example/src/chevre/person/cleanUpCognitoUsersByFetch.ts +162 -0
  10. package/example/src/chevre/person/cleanUpCreditCard.ts +113 -0
  11. package/example/src/chevre/unsetUnnecessaryFields.ts +3 -29
  12. package/example/src/chevre/upsertManyEventsByAdditionalProperty.ts +152 -150
  13. package/lib/chevre/credentials.d.ts +0 -5
  14. package/lib/chevre/credentials.js +0 -13
  15. package/lib/chevre/repo/action.d.ts +4 -20
  16. package/lib/chevre/repo/action.js +61 -160
  17. package/lib/chevre/repo/additionalProperty.js +1 -1
  18. package/lib/chevre/repo/aggregateOffer.js +1 -1
  19. package/lib/chevre/repo/aggregateReservation.d.ts +2 -2
  20. package/lib/chevre/repo/aggregateReservation.js +1 -1
  21. package/lib/chevre/repo/categoryCode.d.ts +6 -2
  22. package/lib/chevre/repo/categoryCode.js +15 -8
  23. package/lib/chevre/repo/comment.js +1 -1
  24. package/lib/chevre/repo/creativeWork.js +1 -1
  25. package/lib/chevre/repo/customer.js +1 -1
  26. package/lib/chevre/repo/emailMessage.js +1 -1
  27. package/lib/chevre/repo/event.d.ts +10 -7
  28. package/lib/chevre/repo/event.js +40 -80
  29. package/lib/chevre/repo/mongoose/schemas/account.js +4 -12
  30. package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +1 -1
  31. package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +18 -23
  32. package/lib/chevre/repo/mongoose/schemas/aggregateReservation.d.ts +0 -1
  33. package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +1 -1
  34. package/lib/chevre/repo/mongoose/schemas/event.js +0 -1
  35. package/lib/chevre/repo/mongoose/schemas/setting.d.ts +26 -0
  36. package/lib/chevre/repo/mongoose/schemas/setting.js +1 -0
  37. package/lib/chevre/repo/offerCatalog.d.ts +9 -0
  38. package/lib/chevre/repo/offerCatalog.js +37 -3
  39. package/lib/chevre/repo/offerCatalogItem.d.ts +9 -0
  40. package/lib/chevre/repo/offerCatalogItem.js +37 -1
  41. package/lib/chevre/repo/offerItemCondition.js +1 -1
  42. package/lib/chevre/repo/ownershipInfo.js +1 -1
  43. package/lib/chevre/repo/person.d.ts +5 -3
  44. package/lib/chevre/repo/person.js +0 -1
  45. package/lib/chevre/repo/priceSpecification.js +1 -1
  46. package/lib/chevre/repo/seller.js +1 -1
  47. package/lib/chevre/repo/setting/jwt.d.ts +10 -0
  48. package/lib/chevre/repo/setting/jwt.js +65 -0
  49. package/lib/chevre/repo/task.js +1 -1
  50. package/lib/chevre/repository.d.ts +7 -0
  51. package/lib/chevre/repository.js +17 -1
  52. package/lib/chevre/service/aggregation/event.d.ts +1 -2
  53. package/lib/chevre/service/aggregation/event.js +1 -3
  54. package/lib/chevre/service/assetTransaction/pay.d.ts +1 -1
  55. package/lib/chevre/service/assetTransaction/pay.js +12 -17
  56. package/lib/chevre/service/assetTransaction/reserve/start/factory/price.js +8 -19
  57. package/lib/chevre/service/code.d.ts +3 -34
  58. package/lib/chevre/service/code.js +18 -136
  59. package/lib/chevre/service/offer/event/authorize/factory.js +19 -14
  60. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.d.ts +0 -5
  61. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.js +43 -39
  62. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +1 -4
  63. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +12 -4
  64. package/lib/chevre/service/offer/event/authorize.d.ts +1 -4
  65. package/lib/chevre/service/offer/event/authorize.js +6 -2
  66. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.d.ts +2 -1
  67. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +10 -4
  68. package/lib/chevre/service/offer/factory.js +22 -5
  69. package/lib/chevre/service/offer.d.ts +7 -9
  70. package/lib/chevre/service/offer.js +25 -24
  71. package/lib/chevre/service/order/deleteOrder.d.ts +4 -0
  72. package/lib/chevre/service/order/deleteOrder.js +48 -5
  73. package/lib/chevre/service/payment/any/factory.d.ts +1 -1
  74. package/lib/chevre/service/payment/any.d.ts +1 -4
  75. package/lib/chevre/service/payment/any.js +35 -22
  76. package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.js +32 -26
  77. package/lib/chevre/service/payment/movieTicket/validation.js +1 -22
  78. package/lib/chevre/service/report/telemetry.js +3 -3
  79. package/lib/chevre/service/reserve/verifyToken4reservation.js +1 -16
  80. package/lib/chevre/service/task/acceptCOAOffer.js +24 -14
  81. package/lib/chevre/service/task/authorizePayment.js +7 -5
  82. package/lib/chevre/service/task/createEvent/createEventSeries.js +5 -2
  83. package/lib/chevre/service/task/deletePerson.js +57 -56
  84. package/lib/chevre/service/task/deleteTransaction.js +2 -0
  85. package/lib/chevre/service/task.d.ts +0 -2
  86. package/lib/chevre/service/transaction/deleteTransaction.d.ts +2 -0
  87. package/lib/chevre/service/transaction/moneyTransfer.d.ts +1 -6
  88. package/lib/chevre/service/transaction/moneyTransfer.js +57 -36
  89. package/package.json +9 -5
  90. package/example/src/chevre/findValidAuthorization.ts +0 -56
  91. package/example/src/chevre/saveAggregateReservation.ts +0 -43
  92. package/lib/chevre/credentials/jwt.d.ts +0 -23
  93. package/lib/chevre/credentials/jwt.js +0 -18
  94. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.d.ts +0 -19
  95. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +0 -145
  96. package/lib/chevre/service/task/aggregateUseActionsOnEvent.d.ts +0 -6
  97. package/lib/chevre/service/task/aggregateUseActionsOnEvent.js +0 -37
@@ -28,19 +28,6 @@ var credentials;
28
28
  }
29
29
  CustomSearch.createInstance = createInstance;
30
30
  })(CustomSearch = credentials.CustomSearch || (credentials.CustomSearch = {}));
31
- let JWT;
32
- (function (JWT) {
33
- let cred;
34
- function createInstance(...params) {
35
- return __awaiter(this, void 0, void 0, function* () {
36
- if (cred === undefined) {
37
- cred = (yield Promise.resolve().then(() => require('./credentials/jwt'))).JWTCredentials;
38
- }
39
- return new cred(...params);
40
- });
41
- }
42
- JWT.createInstance = createInstance;
43
- })(JWT = credentials.JWT || (credentials.JWT = {}));
44
31
  let LINENotify;
45
32
  (function (LINENotify) {
46
33
  let cred;
@@ -23,21 +23,10 @@
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  import { factory as surfrockFactory } from '@surfrock/sdk';
26
- import { Connection, FilterQuery, QueryOptions, UpdateQuery } from 'mongoose';
26
+ import { Connection, FilterQuery, UpdateQuery } from 'mongoose';
27
27
  import * as factory from '../factory';
28
28
  export type IAction4transaction<T extends factory.actionType.AcceptAction | factory.actionType.AuthorizeAction> = T extends factory.actionType.AcceptAction ? factory.action.accept.coaOffer.IAction | factory.action.accept.pay.IAction : T extends factory.actionType.AuthorizeAction ? (factory.action.authorize.offer.eventService.IAction<factory.service.webAPI.Identifier> | factory.action.authorize.offer.moneyTransfer.IAction | factory.action.authorize.offer.product.IAction | factory.action.authorize.paymentMethod.any.IAction) : never;
29
29
  export type IAction<T extends factory.actionType> = T extends factory.actionType.OrderAction ? factory.action.trade.order.IAction : T extends factory.actionType.AcceptAction ? IAction4transaction<factory.actionType.AcceptAction> : T extends factory.actionType.AuthorizeAction ? factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>> : T extends factory.actionType.CheckAction ? (factory.action.check.paymentMethod.movieTicket.IAction | factory.action.check.token.IAction) : T extends factory.actionType.MoneyTransfer ? factory.action.transfer.moneyTransfer.IAction : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IAction<factory.action.update.replace.IAttributes<any, any>> : factory.action.IAction<factory.action.IAttributes<T, any, any>>;
30
- export type IPayAction = factory.action.trade.pay.IAction;
31
- export interface IUseActionCountByOffer {
32
- /**
33
- * 単価オファーID
34
- */
35
- _id: [string];
36
- /**
37
- * 使用アクション数
38
- */
39
- useActionCount?: number;
40
- }
41
30
  interface IAggregationByStatus {
42
31
  actionCount: number;
43
32
  avgDuration: number;
@@ -152,7 +141,7 @@ export declare class ActionRepo {
152
141
  actionStatus?: {
153
142
  $in?: factory.actionStatusType[];
154
143
  };
155
- }): Promise<IPayAction | undefined>;
144
+ }): Promise<factory.action.trade.pay.IAction | undefined>;
156
145
  /**
157
146
  * 取引に対するアクションを検索する
158
147
  */
@@ -220,13 +209,8 @@ export declare class ActionRepo {
220
209
  }): Promise<void>;
221
210
  /**
222
211
  * イベントと入場ゲート指定で予約使用アクションを集計する
212
+ * discontinue(2024-12-26~)
223
213
  */
224
- countUseActionsByEntranceGate(params: {
225
- event: {
226
- id: string;
227
- };
228
- entranceGateIdentifier: string;
229
- }): Promise<IUseActionCountByOffer[]>;
230
214
  searchYkknInfoByCheckRecipe(filter: {
231
215
  limit: number;
232
216
  page: number;
@@ -426,7 +410,7 @@ export declare class ActionRepo {
426
410
  actionStatus: factory.actionStatusType;
427
411
  } & {
428
412
  _id: import("mongoose").Types.ObjectId;
429
- }, QueryOptions<import("mongoose").Document<unknown, {}, {
413
+ }, import("mongoose").QueryOptions<import("mongoose").Document<unknown, {}, {
430
414
  object: any;
431
415
  error?: any;
432
416
  project: Pick<factory.project.IProject, "id" | "typeOf">;
@@ -832,158 +832,62 @@ class ActionRepo {
832
832
  }
833
833
  /**
834
834
  * イベントと入場ゲート指定で予約使用アクションを集計する
835
+ * discontinue(2024-12-26~)
835
836
  */
836
- countUseActionsByEntranceGate(params) {
837
- return __awaiter(this, void 0, void 0, function* () {
838
- return this.actionModel.aggregate([
839
- {
840
- $match: {
841
- actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
842
- }
843
- },
844
- {
845
- $match: {
846
- typeOf: { $eq: factory.actionType.UseAction }
847
- }
848
- },
849
- {
850
- $match: {
851
- 'object.typeOf': {
852
- $exists: true,
853
- $eq: factory.reservationType.EventReservation
854
- }
855
- }
856
- },
857
- {
858
- $match: {
859
- 'object.reservationFor.id': {
860
- $exists: true,
861
- $eq: params.event.id
862
- }
863
- }
864
- },
865
- {
866
- $match: {
867
- 'location.identifier': {
868
- $exists: true,
869
- $eq: params.entranceGateIdentifier
870
- }
871
- }
872
- },
873
- {
874
- $group: {
875
- _id: '$object.id',
876
- object: { $first: '$object' }
877
- }
878
- },
879
- {
880
- $group: {
881
- _id: '$object.reservedTicket.ticketType.id',
882
- useActionCount: {
883
- $sum: 1
884
- }
885
- }
886
- }
887
- ])
888
- .exec();
889
- });
890
- }
891
- // public async searchYkknInfoByCheckMovieTicketResult(
892
- // filter: {
893
- // limit: number;
894
- // page: number;
895
- // /**
896
- // * 認証アクションID
897
- // */
898
- // id: string;
899
- // project: { id: string };
900
- // purpose: { id: string };
901
- // }
902
- // ): Promise<(surfrockFactory.service.auth.purchaseNumberAuth.IValidTicket & {
903
- // knyknrNo: string;
904
- // })[]> {
905
- // const filterQuery: FilterQuery<factory.action.IAction<factory.action.IAttributes<factory.actionType, any, any>>> = {
906
- // _id: { $eq: new Types.ObjectId(filter.id) },
907
- // 'project.id': { $eq: filter.project.id },
908
- // 'purpose.id': { $exists: true, $eq: filter.purpose.id },
909
- // typeOf: { $eq: factory.actionType.CheckAction },
910
- // actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
911
- // };
912
- // const projectStage: { [field: string]: AnyExpression } = {
913
- // _id: 0,
914
- // knyknrNo: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.knyknrNo',
915
- // ykknshTyp: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.ykknInfo.ykknshTyp',
916
- // eishhshkTyp: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.ykknInfo.eishhshkTyp',
917
- // ykknKnshbtsmiNum: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.ykknInfo.ykknKnshbtsmiNum',
918
- // knshknhmbiUnip: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.ykknInfo.knshknhmbiUnip',
919
- // kijUnip: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.ykknInfo.kijUnip'
920
- // };
921
- // const aggregate = this.actionModel.aggregate<surfrockFactory.service.auth.purchaseNumberAuth.IValidTicket & {
922
- // knyknrNo: string;
923
- // }>([
924
- // { $unwind: '$result.purchaseNumberAuthResult.knyknrNoInfoOut' },
925
- // { $unwind: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.ykknInfo' },
926
- // { $match: filterQuery },
927
- // { $project: projectStage }
928
- // ]);
929
- // if (typeof filter.limit === 'number' && filter.limit > 0) {
930
- // const page: number = (typeof filter.page === 'number' && filter.page > 0) ? filter.page : 1;
931
- // aggregate.limit(filter.limit * page)
932
- // .skip(filter.limit * (page - 1));
933
- // }
934
- // return aggregate
935
- // .option({ maxTimeMS: MONGO_MAX_TIME_MS })
936
- // .exec();
937
- // }
938
- // public async searchMkknInfoByCheckMovieTicketResult(
939
- // filter: {
940
- // limit: number;
941
- // page: number;
942
- // /**
943
- // * 認証アクションID
944
- // */
945
- // id: string;
946
- // project: { id: string };
947
- // purpose: { id: string };
948
- // }
949
- // ): Promise<(surfrockFactory.service.auth.purchaseNumberAuth.INvalidTicket & {
950
- // knyknrNo: string;
951
- // })[]> {
952
- // const filterQuery: FilterQuery<factory.action.IAction<factory.action.IAttributes<factory.actionType, any, any>>> = {
953
- // _id: { $eq: new Types.ObjectId(filter.id) },
954
- // 'project.id': { $eq: filter.project.id },
955
- // 'purpose.id': { $exists: true, $eq: filter.purpose.id },
956
- // typeOf: { $eq: factory.actionType.CheckAction },
957
- // actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
958
- // };
959
- // const projectStage: { [field: string]: AnyExpression } = {
960
- // _id: 0,
961
- // knyknrNo: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.knyknrNo',
962
- // mkknshTyp: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo.mkknshTyp',
963
- // mkknKnshbtsmiNum: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo.mkknKnshbtsmiNum',
964
- // mkjyTyp: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo.mkjyTyp',
965
- // yykDt: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo.yykDt',
966
- // shyJeiDt: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo.shyJeiDt',
967
- // shyStCd: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo.shyStCd',
968
- // shyScrnCd: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo.shyScrnCd',
969
- // shySkhnCd: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo.shySkhnCd',
970
- // shySkhnNm: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo.shySkhnNm'
971
- // };
972
- // const aggregate = this.actionModel.aggregate<surfrockFactory.service.auth.purchaseNumberAuth.INvalidTicket & {
973
- // knyknrNo: string;
974
- // }>([
975
- // { $unwind: '$result.purchaseNumberAuthResult.knyknrNoInfoOut' },
976
- // { $unwind: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo' },
977
- // { $match: filterQuery },
978
- // { $project: projectStage }
979
- // ]);
980
- // if (typeof filter.limit === 'number' && filter.limit > 0) {
981
- // const page: number = (typeof filter.page === 'number' && filter.page > 0) ? filter.page : 1;
982
- // aggregate.limit(filter.limit * page)
983
- // .skip(filter.limit * (page - 1));
984
- // }
985
- // return aggregate
986
- // .option({ maxTimeMS: MONGO_MAX_TIME_MS })
837
+ // public async countUseActionsByEntranceGate(params: {
838
+ // event: { id: string };
839
+ // entranceGateIdentifier: string;
840
+ // }): Promise<IUseActionCountByOffer[]> {
841
+ // return this.actionModel.aggregate([
842
+ // {
843
+ // $match: {
844
+ // actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
845
+ // }
846
+ // },
847
+ // {
848
+ // $match: {
849
+ // typeOf: { $eq: factory.actionType.UseAction }
850
+ // }
851
+ // },
852
+ // {
853
+ // $match: {
854
+ // 'object.typeOf': {
855
+ // $exists: true,
856
+ // $eq: factory.reservationType.EventReservation
857
+ // }
858
+ // }
859
+ // },
860
+ // {
861
+ // $match: {
862
+ // 'object.reservationFor.id': {
863
+ // $exists: true,
864
+ // $eq: params.event.id
865
+ // }
866
+ // }
867
+ // },
868
+ // {
869
+ // $match: {
870
+ // 'location.identifier': {
871
+ // $exists: true,
872
+ // $eq: params.entranceGateIdentifier
873
+ // }
874
+ // }
875
+ // },
876
+ // {
877
+ // $group: {
878
+ // _id: '$object.id',
879
+ // object: { $first: '$object' }
880
+ // }
881
+ // },
882
+ // {
883
+ // $group: {
884
+ // _id: '$object.reservedTicket.ticketType.id',
885
+ // useActionCount: {
886
+ // $sum: 1
887
+ // }
888
+ // }
889
+ // }
890
+ // ])
987
891
  // .exec();
988
892
  // }
989
893
  searchYkknInfoByCheckRecipe(filter) {
@@ -1143,11 +1047,10 @@ class ActionRepo {
1143
1047
  $setOnInsert: setOnInsert,
1144
1048
  $set: setKeys
1145
1049
  };
1146
- const options = {
1050
+ return this.actionRecipeModel.updateOne(filter, update, {
1147
1051
  upsert: true,
1148
1052
  includeResultMetadata: true
1149
- };
1150
- return this.actionRecipeModel.updateOne(filter, update, options)
1053
+ })
1151
1054
  .exec();
1152
1055
  });
1153
1056
  }
@@ -1168,11 +1071,10 @@ class ActionRepo {
1168
1071
  $setOnInsert: setOnInsert,
1169
1072
  $set: setKeys
1170
1073
  };
1171
- const options = {
1074
+ return this.actionModel.updateOne(filter, update, {
1172
1075
  upsert: true,
1173
1076
  includeResultMetadata: true
1174
- };
1175
- return this.actionModel.updateOne(filter, update, options)
1077
+ })
1176
1078
  .exec();
1177
1079
  });
1178
1080
  }
@@ -1499,11 +1401,10 @@ class ActionRepo {
1499
1401
  $setOnInsert: setOnInsert,
1500
1402
  $set: setKeys
1501
1403
  };
1502
- const options = {
1404
+ return this.actionRecipeModel.updateOne(filter, update, {
1503
1405
  upsert: true,
1504
1406
  includeResultMetadata: true
1505
- };
1506
- return this.actionRecipeModel.updateOne(filter, update, options)
1407
+ })
1507
1408
  .exec();
1508
1409
  });
1509
1410
  }
@@ -133,7 +133,7 @@ class AdditionalPropertyRepo {
133
133
  */
134
134
  deleteById(params) {
135
135
  return __awaiter(this, void 0, void 0, function* () {
136
- yield this.additionalPropertyModel.findOneAndRemove({ _id: { $eq: params.id } }, { projection: { _id: 1 } })
136
+ yield this.additionalPropertyModel.findOneAndDelete({ _id: { $eq: params.id } }, { projection: { _id: 1 } })
137
137
  .exec();
138
138
  });
139
139
  }
@@ -561,7 +561,7 @@ class AggregateOfferRepo {
561
561
  }
562
562
  deleteById(params) {
563
563
  return __awaiter(this, void 0, void 0, function* () {
564
- yield this.aggregateOfferModel.findOneAndRemove({
564
+ yield this.aggregateOfferModel.findOneAndDelete({
565
565
  _id: { $eq: params.id },
566
566
  'project.id': { $eq: params.project.id }
567
567
  }, { projection: { _id: 1 } })
@@ -32,7 +32,7 @@ export interface IUpdateAggregateReservationParams {
32
32
  aggregateEntranceGate?: factory.event.event.IAggregateEntranceGate;
33
33
  };
34
34
  }
35
- type ISearchWithReservationForIdResult = Pick<IAggregateReservation, 'aggregateEntranceGate' | 'aggregateOffer'> & {
35
+ type ISearchWithReservationForIdResult = Pick<IAggregateReservation, 'aggregateOffer'> & {
36
36
  /**
37
37
  * イベントID
38
38
  */
@@ -70,7 +70,7 @@ export declare class AggregateReservationRepo {
70
70
  /**
71
71
  * 予約集計を検索する
72
72
  */
73
- searchWithReservationForId(params: ISearchConditions, inclusion: ('aggregateEntranceGate' | 'aggregateOffer')[]): Promise<ISearchWithReservationForIdResult[]>;
73
+ searchWithReservationForId(params: ISearchConditions, inclusion: ('aggregateOffer')[]): Promise<ISearchWithReservationForIdResult[]>;
74
74
  /**
75
75
  * 予約集計を保管する
76
76
  */
@@ -82,7 +82,7 @@ class AggregateReservationRepo {
82
82
  projectStage = {
83
83
  _id: 0,
84
84
  id: '$reservationFor.id',
85
- aggregateEntranceGate: 1,
85
+ // aggregateEntranceGate: 1, // discontinue(2024-12-23~)
86
86
  aggregateOffer: 1
87
87
  };
88
88
  }
@@ -22,7 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
- import { AnyExpression, Connection, FilterQuery } from 'mongoose';
25
+ import { AnyExpression, Connection, FilterQuery, Types } from 'mongoose';
26
26
  import * as factory from '../factory';
27
27
  type IKeyOfProjection = keyof factory.categoryCode.ICategoryCode;
28
28
  type IUnset = {
@@ -78,7 +78,11 @@ export declare class CategoryCodeRepo {
78
78
  id: string;
79
79
  };
80
80
  }): Promise<void>;
81
- getCursor(conditions: FilterQuery<factory.categoryCode.ICategoryCode>, projection: any): import("mongoose").Cursor<any, import("mongoose").QueryOptions<any>>;
81
+ getCursor(conditions: FilterQuery<factory.categoryCode.ICategoryCode>, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, {}, factory.categoryCode.ICategoryCode> & factory.categoryCode.ICategoryCode & {
82
+ _id: Types.ObjectId;
83
+ }, import("mongoose").QueryOptions<import("mongoose").Document<unknown, {}, factory.categoryCode.ICategoryCode> & factory.categoryCode.ICategoryCode & {
84
+ _id: Types.ObjectId;
85
+ }>>;
82
86
  unsetUnnecessaryFields(params: {
83
87
  filter: FilterQuery<factory.categoryCode.ICategoryCode>;
84
88
  $unset: any;
@@ -239,22 +239,29 @@ class CategoryCodeRepo {
239
239
  save(params) {
240
240
  return __awaiter(this, void 0, void 0, function* () {
241
241
  let savedId;
242
- let doc;
242
+ // let doc: HydratedDocument<{ _id: Types.ObjectId }> | null;
243
243
  if (typeof params.id !== 'string') {
244
244
  const _a = params.attributes, { id, $unset } = _a, creatingDoc = __rest(_a, ["id", "$unset"]);
245
- doc = (yield this.categoryCodeModel.create(creatingDoc));
246
- savedId = doc.id;
245
+ const createResult = yield this.categoryCodeModel.create(creatingDoc);
246
+ // doc = createResult;
247
+ if (typeof createResult.id !== 'string') {
248
+ throw new factory.errors.Internal(`failed in creating ${creatingDoc.typeOf} unexpectedly`);
249
+ }
250
+ savedId = createResult.id;
247
251
  }
248
252
  else {
249
253
  // 上書き禁止属性を除外(2022-08-24~)
250
254
  const _b = params.attributes, { id, codeValue, inCodeSet, project, typeOf, $unset } = _b, updateFields = __rest(_b, ["id", "codeValue", "inCodeSet", "project", "typeOf", "$unset"]);
251
- doc = yield this.categoryCodeModel.findOneAndUpdate({ _id: { $eq: params.id } }, Object.assign({ $set: updateFields }, ($unset !== undefined) ? { $unset } : undefined), { upsert: false, new: true, projection: { _id: 1 } })
255
+ const doc = yield this.categoryCodeModel.findOneAndUpdate({ _id: { $eq: params.id } }, Object.assign({ $set: updateFields }, ($unset !== undefined) ? { $unset } : undefined), { upsert: false, new: true, projection: { _id: 1 } })
252
256
  .exec();
257
+ if (doc === null) {
258
+ throw new factory.errors.NotFound(this.categoryCodeModel.modelName);
259
+ }
253
260
  savedId = params.id;
254
261
  }
255
- if (doc === null) {
256
- throw new factory.errors.NotFound(this.categoryCodeModel.modelName);
257
- }
262
+ // if (doc === null) {
263
+ // throw new factory.errors.NotFound(this.categoryCodeModel.modelName);
264
+ // }
258
265
  return { id: savedId };
259
266
  });
260
267
  }
@@ -296,7 +303,7 @@ class CategoryCodeRepo {
296
303
  */
297
304
  deleteById(params) {
298
305
  return __awaiter(this, void 0, void 0, function* () {
299
- yield this.categoryCodeModel.findOneAndRemove({ _id: { $eq: params.id } }, { projection: { _id: 1 } })
306
+ yield this.categoryCodeModel.findOneAndDelete({ _id: { $eq: params.id } }, { projection: { _id: 1 } })
300
307
  .exec();
301
308
  });
302
309
  }
@@ -117,7 +117,7 @@ class CommentRepo {
117
117
  */
118
118
  deleteById(params) {
119
119
  return __awaiter(this, void 0, void 0, function* () {
120
- yield this.commentModel.findOneAndRemove({ _id: params.id })
120
+ yield this.commentModel.findOneAndDelete({ _id: { $eq: params.id } }, { projection: { _id: 1 } })
121
121
  .exec();
122
122
  });
123
123
  }
@@ -261,7 +261,7 @@ class CreativeWorkRepo {
261
261
  */
262
262
  deleteMovie(params) {
263
263
  return __awaiter(this, void 0, void 0, function* () {
264
- yield this.creativeWorkModel.findOneAndRemove({ _id: { $eq: params.id } }, { projection: { _id: 1 } })
264
+ yield this.creativeWorkModel.findOneAndDelete({ _id: { $eq: params.id } }, { projection: { _id: 1 } })
265
265
  .exec();
266
266
  });
267
267
  }
@@ -138,7 +138,7 @@ class CustomerRepo {
138
138
  }
139
139
  deleteById(params) {
140
140
  return __awaiter(this, void 0, void 0, function* () {
141
- yield this.customerModel.findOneAndRemove({ _id: { $eq: params.id } }, { projection: { _id: 1 } })
141
+ yield this.customerModel.findOneAndDelete({ _id: { $eq: params.id } }, { projection: { _id: 1 } })
142
142
  .exec();
143
143
  });
144
144
  }
@@ -115,7 +115,7 @@ class EmailMessageRepo {
115
115
  }
116
116
  deleteById(params) {
117
117
  return __awaiter(this, void 0, void 0, function* () {
118
- yield this.emailMessageModel.findOneAndRemove({ _id: params.id })
118
+ yield this.emailMessageModel.findOneAndDelete({ _id: { $eq: params.id } }, { projection: { _id: 1 } })
119
119
  .exec();
120
120
  });
121
121
  }
@@ -70,7 +70,7 @@ interface IAggregateEvent {
70
70
  statuses: IStatus[];
71
71
  }
72
72
  export import IMinimizedIndividualEvent = EventFactory.IMinimizedIndividualEvent;
73
- type IKeyOfProjection<T extends AvailableEventType> = Exclude<keyof factory.event.IEvent<T>, 'id'> | 'aggregateEntranceGate' | 'aggregateOffer' | 'superEvent.location.id' | 'offers.itemOffered' | 'offers.itemOffered.id';
73
+ type IKeyOfProjection<T extends AvailableEventType> = Exclude<keyof factory.event.IEvent<T>, 'id'> | 'aggregateOffer' | 'superEvent.location.id' | 'offers.itemOffered' | 'offers.itemOffered.id';
74
74
  type IKeyOfProjection4publicFields<T extends AvailableEventType> = Exclude<keyof factory.event.IEvent<T>, 'id' | 'offers'>;
75
75
  /**
76
76
  * minimizedEvent検索時のprojection候補
@@ -116,9 +116,12 @@ export declare class EventRepo {
116
116
  */
117
117
  branchCode: string;
118
118
  };
119
- options: {
120
- updateOffersSeller: boolean;
121
- };
119
+ }, options: {
120
+ /**
121
+ * falseの場合setOnInsertのみ
122
+ * trueの場合setのみ
123
+ */
124
+ update: boolean;
122
125
  }): Promise<{
123
126
  bulkWriteResult: BulkWriteResult;
124
127
  modifiedEvents: {
@@ -164,7 +167,7 @@ export declare class EventRepo {
164
167
  /**
165
168
  * イベントを検索する(inclusion projection)
166
169
  */
167
- projectEventFields<T extends AvailableEventType>(params: ISearchConditions<T>, inclusion: IKeyOfProjection<T>[]): Promise<Omit<factory.event.IEvent<T>, 'aggregateEntranceGate' | 'aggregateOffer'>[]>;
170
+ projectEventFields<T extends AvailableEventType>(params: ISearchConditions<T>, inclusion: IKeyOfProjection<T>[]): Promise<Omit<factory.event.IEvent<T>, 'aggregateOffer'>[]>;
168
171
  /**
169
172
  * apiで公開属性を検索する(2024-10-13~)
170
173
  */
@@ -181,7 +184,7 @@ export declare class EventRepo {
181
184
  * offers.seller.makesOfferをavailableAtOrFromでfilterする
182
185
  */
183
186
  sellerMakesOfferAvailableAtIn?: string[];
184
- }): Promise<Omit<factory.event.IEvent<T>, 'aggregateEntranceGate' | 'aggregateOffer'>[]>;
187
+ }): Promise<Omit<factory.event.IEvent<T>, 'aggregateOffer'>[]>;
185
188
  /**
186
189
  * IDのみで検索する
187
190
  * projectionなし
@@ -200,7 +203,7 @@ export declare class EventRepo {
200
203
  $eq: string;
201
204
  };
202
205
  };
203
- }): Promise<Omit<factory.event.IEvent<T>, 'aggregateEntranceGate' | 'aggregateOffer'>>;
206
+ }): Promise<Omit<factory.event.IEvent<T>, 'aggregateOffer'>>;
204
207
  searchEventIds<T extends AvailableEventType>(params: ISearchConditions<T>): Promise<string[]>;
205
208
  /**
206
209
  * 特定イベントから指定フィールドのみ取得する