@chevre/domain 24.1.0-alpha.0 → 24.1.0-alpha.10

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 (37) hide show
  1. package/README.md +0 -2
  2. package/lib/chevre/repo/acceptedOffer.d.ts +1 -1
  3. package/lib/chevre/repo/acceptedOffer.js +10 -10
  4. package/lib/chevre/repo/accountingReport.d.ts +9 -2
  5. package/lib/chevre/repo/accountingReport.js +30 -28
  6. package/lib/chevre/repo/aggregateReservation.d.ts +6 -0
  7. package/lib/chevre/repo/aggregateReservation.js +9 -0
  8. package/lib/chevre/repo/factory/reservation/createMongoConditions.js +155 -180
  9. package/lib/chevre/repo/mongoose/schemas/accountingReport.js +10 -9
  10. package/lib/chevre/repo/mongoose/schemas/order.js +108 -108
  11. package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +1 -0
  12. package/lib/chevre/repo/mongoose/schemas/reservation.js +117 -117
  13. package/lib/chevre/repo/order.d.ts +2 -1
  14. package/lib/chevre/repo/order.js +171 -170
  15. package/lib/chevre/repo/project.d.ts +0 -3
  16. package/lib/chevre/repo/project.js +0 -10
  17. package/lib/chevre/repo/reservation.d.ts +2 -0
  18. package/lib/chevre/service/aggregation/event/aggregateOffers.js +17 -26
  19. package/lib/chevre/service/order/createAccountingReportIfNotExist.d.ts +1 -3
  20. package/lib/chevre/service/order/createAccountingReportIfNotExist.js +67 -72
  21. package/lib/chevre/service/reserve/useReservation.d.ts +1 -1
  22. package/lib/chevre/service/reserve/useReservation.js +20 -24
  23. package/lib/chevre/service/task/createAccountingReport.js +11 -9
  24. package/lib/chevre/service/task/onResourceDeleted.js +7 -8
  25. package/lib/chevre/service/task/onResourceUpdated.js +7 -8
  26. package/lib/chevre/service/task/useReservation.d.ts +2 -2
  27. package/lib/chevre/service/task/useReservation.js +6 -18
  28. package/lib/chevre/service/taskHandler.js +1 -0
  29. package/package.json +2 -2
  30. package/lib/chevre/repo/mongoose/schemas/productModel.d.ts +0 -33
  31. package/lib/chevre/repo/mongoose/schemas/productModel.js +0 -57
  32. package/lib/chevre/repo/productModel.d.ts +0 -27
  33. package/lib/chevre/repo/productModel.js +0 -170
  34. package/lib/chevre/service/task/onResourceUpdated/onCategoryCodeUpdated.d.ts +0 -15
  35. package/lib/chevre/service/task/onResourceUpdated/onCategoryCodeUpdated.js +0 -16
  36. package/lib/chevre/service/task/onResourceUpdated/syncCategoryCode.d.ts +0 -15
  37. package/lib/chevre/service/task/onResourceUpdated/syncCategoryCode.js +0 -47
@@ -19,84 +19,79 @@ function createAccountingReportIfNotExist(params) {
19
19
  }
20
20
  // 最適化(2023-06-30~)
21
21
  function createOrder4report(params) {
22
- if (!Array.isArray(params.acceptedOffers)) {
23
- throw new factory_1.factory.errors.ArgumentNull('order.acceptedOffers');
24
- }
25
- const numItems = params.acceptedOffers.length;
26
- // 必要な属性についてDate型に変換(でないと検索クエリを効率的に使えない)
27
- const acceptedOffers = (Array.isArray(params.acceptedOffers))
28
- ? params.acceptedOffers.map((o) => {
29
- if (o.itemOffered.typeOf === factory_1.factory.reservationType.EventReservation) {
30
- let itemOffered = o.itemOffered;
31
- const reservationFor = itemOffered.reservationFor;
32
- itemOffered = {
33
- ...itemOffered,
34
- reservationFor: {
35
- ...reservationFor,
36
- ...(reservationFor.doorTime !== undefined)
37
- ? {
38
- doorTime: (0, moment_timezone_1.default)(reservationFor.doorTime)
39
- .toDate()
40
- }
41
- : undefined,
42
- ...(reservationFor.endDate !== undefined)
43
- ? {
44
- endDate: (0, moment_timezone_1.default)(reservationFor.endDate)
45
- .toDate()
46
- }
47
- : undefined,
48
- ...(reservationFor.startDate !== undefined)
49
- ? {
50
- startDate: (0, moment_timezone_1.default)(reservationFor.startDate)
51
- .toDate()
52
- }
53
- : undefined
54
- }
55
- };
56
- return {
57
- ...o,
58
- itemOffered
59
- };
60
- }
61
- else {
62
- return o;
63
- }
64
- })
65
- : [];
66
- const customer = {
67
- // ...createMaskedCustomer(params),
68
- id: params.customer.id,
69
- typeOf: params.customer.typeOf,
70
- additionalProperty: (Array.isArray(params.customer.additionalProperty))
71
- ? params.customer.additionalProperty
72
- : [],
73
- identifier: (Array.isArray(params.customer.identifier))
74
- ? params.customer.identifier
75
- : []
76
- };
22
+ // if (!Array.isArray(params.acceptedOffers)) {
23
+ // throw new factory.errors.ArgumentNull('order.acceptedOffers');
24
+ // }
25
+ // const numItems: number = params.acceptedOffers.length;
26
+ // // 必要な属性についてDate型に変換(でないと検索クエリを効率的に使えない)
27
+ // const acceptedOffers = (Array.isArray(params.acceptedOffers))
28
+ // ? params.acceptedOffers.map((o) => {
29
+ // if (o.itemOffered.typeOf === factory.reservationType.EventReservation) {
30
+ // let itemOffered = o.itemOffered;
31
+ // const reservationFor = itemOffered.reservationFor;
32
+ // itemOffered = {
33
+ // ...itemOffered,
34
+ // reservationFor: {
35
+ // ...reservationFor,
36
+ // ...(reservationFor.doorTime !== undefined)
37
+ // ? {
38
+ // doorTime: moment(reservationFor.doorTime)
39
+ // .toDate()
40
+ // }
41
+ // : undefined,
42
+ // ...(reservationFor.endDate !== undefined)
43
+ // ? {
44
+ // endDate: moment(reservationFor.endDate)
45
+ // .toDate()
46
+ // }
47
+ // : undefined,
48
+ // ...(reservationFor.startDate !== undefined)
49
+ // ? {
50
+ // startDate: moment(reservationFor.startDate)
51
+ // .toDate()
52
+ // }
53
+ // : undefined
54
+ // }
55
+ // } as factory.order.IReservation;
56
+ // return {
57
+ // ...o,
58
+ // itemOffered
59
+ // };
60
+ // } else {
61
+ // return o;
62
+ // }
63
+ // })
64
+ // : [];
65
+ // const customer: factory.report.accountingReport.IOptimizedCustomer = {
66
+ // id: params.customer.id,
67
+ // typeOf: params.customer.typeOf,
68
+ // additionalProperty: (Array.isArray(params.customer.additionalProperty))
69
+ // ? params.customer.additionalProperty
70
+ // : [],
71
+ // identifier: (Array.isArray(params.customer.identifier))
72
+ // ? params.customer.identifier
73
+ // : []
74
+ // };
77
75
  return {
78
- // ...params,
79
- confirmationNumber: params.confirmationNumber,
80
76
  id: params.id,
81
77
  orderNumber: params.orderNumber,
82
- orderedItem: params.orderedItem,
83
- paymentMethods: params.paymentMethods,
84
- price: params.price,
85
- priceCurrency: params.priceCurrency,
86
- seller: params.seller,
78
+ paymentMethods: params.paymentMethods.map(({ paymentMethodId }) => ({ paymentMethodId })),
79
+ seller: {
80
+ id: params.seller.id,
81
+ name: params.seller.name,
82
+ typeOf: params.seller.typeOf
83
+ },
87
84
  typeOf: params.typeOf,
88
- customer,
89
85
  orderDate: (0, moment_timezone_1.default)(params.orderDate)
90
86
  .toDate(),
91
- acceptedOffers,
92
- numItems,
93
- ...(typeof params.broker?.typeOf === 'string') ? { broker: params.broker } : undefined
94
- // ...(params.dateReturned !== null && params.dateReturned !== undefined)
95
- // ? {
96
- // dateReturned: moment(params.dateReturned)
97
- // .toDate()
98
- // }
99
- // : undefined
87
+ // confirmationNumber: params.confirmationNumber, // discontinue(2026-05-06~)
88
+ // price: params.price, // discontinue(2026-05-06~)
89
+ // priceCurrency: params.priceCurrency, // discontinue(2026-05-06~)
90
+ // customer, // discontinue(2026-05-06~)
91
+ // numItems, // discontinue(2026-05-06~)
92
+ // orderedItem: params.orderedItem, // discontinue(2026-05-06~)
93
+ // acceptedOffers, // discontinue(2026-05-06~)
94
+ // ...(typeof params.broker?.typeOf === 'string') ? { broker: params.broker } : undefined // discontinue(2026-05-06~)
100
95
  };
101
96
  }
102
97
  function createAccountingReport(params) {
@@ -20,7 +20,7 @@ export declare function useReservation(params: {
20
20
  */
21
21
  id: string;
22
22
  };
23
- instrument?: Pick<factory.action.consume.use.reservation.ITicketAsInstrument, 'ticketToken'> | factory.action.consume.use.reservation.IInstrument[];
23
+ instrument: factory.action.consume.use.reservation.IInstrument[];
24
24
  location?: {
25
25
  identifier?: string;
26
26
  };
@@ -16,7 +16,6 @@ function useReservation(params) {
16
16
  return async (repos) => {
17
17
  const reservationId = params.object.id;
18
18
  let ticketToken;
19
- // const ticketToken = params?.instrument?.ticketToken;
20
19
  if (Array.isArray(params.instrument)) {
21
20
  for (const eachInstrument of params.instrument) {
22
21
  if (eachInstrument.typeOf === 'Ticket' && typeof eachInstrument.ticketToken === 'string') {
@@ -24,9 +23,8 @@ function useReservation(params) {
24
23
  break;
25
24
  }
26
25
  }
27
- }
28
- else {
29
- ticketToken = params?.instrument?.ticketToken;
26
+ // } else {
27
+ // ticketToken = params?.instrument?.ticketToken;
30
28
  }
31
29
  // if (params.verifyToken === true) {} // タスク作成前に検証済なので検証不要
32
30
  // confirmReservationが間に合わない可能性を考慮する(2023-06-01~)
@@ -34,36 +32,34 @@ function useReservation(params) {
34
32
  // 予約検索
35
33
  const reservation = await repos.reservation.findReservationById({
36
34
  id: reservationId,
37
- inclusion: ['issuedThrough', 'project', 'reservationFor', 'reservationNumber', 'reservedTicket', 'typeOf']
35
+ inclusion: [
36
+ // 'issuedThrough',
37
+ // 'reservedTicket',
38
+ 'project', 'reservationFor', 'reservationNumber', 'typeOf'
39
+ ]
38
40
  });
39
- if (typeof reservation.issuedThrough.id !== 'string') {
40
- // COA予約では予約使用アクションを想定していないので、興行idは必ず存在するはず
41
- throw new factory_1.factory.errors.Internal('reservation.issuedThrough.id must be string');
42
- }
43
- const { reservedTicket } = reservation;
44
- // optimize(2024-05-07~)
41
+ // if (typeof reservation.issuedThrough.id !== 'string') {
42
+ // // COA予約では予約使用アクションを想定していないので、興行idは必ず存在するはず
43
+ // throw new factory.errors.Internal('reservation.issuedThrough.id must be string');
44
+ // }
45
+ // const { reservedTicket } = reservation;
46
+ // optimize(2026-05-06~)
45
47
  const reservationAsObject = {
46
48
  id: reservation.id,
47
49
  reservationNumber: reservation.reservationNumber,
48
50
  typeOf: reservation.typeOf,
49
- issuedThrough: { id: reservation.issuedThrough.id, typeOf: reservation.issuedThrough.typeOf },
50
51
  reservationFor: { id: reservation.reservationFor.id, typeOf: reservation.reservationFor.typeOf },
51
- reservedTicket: {
52
- typeOf: reservedTicket.typeOf,
53
- // discontinue ticketType(2026-03-25~)
54
- // ticketType: {
55
- // identifier: reservedTicket.ticketType.identifier,
56
- // typeOf: reservedTicket.ticketType.typeOf,
57
- // ...(typeof reservedTicket.ticketType.id === 'string') ? { id: reservedTicket.ticketType.id } : undefined
58
- // },
59
- ...(typeof reservedTicket.identifier === 'string') ? { identifier: reservedTicket.identifier } : undefined,
60
- ...(typeof reservedTicket.ticketedSeat?.typeOf === 'string') ? { ticketedSeat: reservedTicket.ticketedSeat } : undefined
61
- }
52
+ // discontinue issuedThrough,reservedTicket(2026-05-06~)
53
+ // issuedThrough: { id: reservation.issuedThrough.id, typeOf: reservation.issuedThrough.typeOf },
54
+ // reservedTicket: {
55
+ // typeOf: reservedTicket.typeOf,
56
+ // ...(typeof reservedTicket.identifier === 'string') ? { identifier: reservedTicket.identifier } : undefined,
57
+ // ...(typeof reservedTicket.ticketedSeat?.typeOf === 'string') ? { ticketedSeat: reservedTicket.ticketedSeat } : undefined
58
+ // }
62
59
  };
63
60
  // extend instrument to array(2025-02-18~)
64
61
  const instrument = [
65
62
  {
66
- // ...(typeof token === 'string') ? { token } : undefined, // discontinue token(2024-10-03~)
67
63
  ...(typeof ticketToken === 'string') ? { ticketToken } : undefined,
68
64
  typeOf: 'Ticket'
69
65
  },
@@ -27,9 +27,12 @@ function createAccountingReport(params) {
27
27
  orderNumber: data.object.mainEntity.orderNumber,
28
28
  project: { id: params.project.id },
29
29
  inclusion: [
30
- 'orderNumber', 'project', 'customer', 'confirmationNumber',
31
- 'paymentMethods', 'orderedItem', 'price', 'priceCurrency', 'seller', 'broker', 'typeOf', 'orderDate'
32
- ] // explicit projection(2024-07-25~)
30
+ 'orderNumber', 'project', 'paymentMethods', 'seller', 'typeOf', 'orderDate'
31
+ // 'customer', 'confirmationNumber',
32
+ // 'orderedItem',
33
+ // 'broker',
34
+ // 'price', 'priceCurrency',
35
+ ]
33
36
  });
34
37
  const simpleOrder = {
35
38
  typeOf: order.typeOf,
@@ -37,7 +40,6 @@ function createAccountingReport(params) {
37
40
  orderDate: order.orderDate
38
41
  };
39
42
  const actionObject = {
40
- // ...params,
41
43
  mainEntity: { orderNumber: simpleOrder.orderNumber },
42
44
  typeOf: 'Report'
43
45
  };
@@ -51,13 +53,13 @@ function createAccountingReport(params) {
51
53
  };
52
54
  const action = await repos.action.start(actionAttributes);
53
55
  try {
54
- const acceptedOffers = await repos.acceptedOffer.searchAcceptedOffersByOrderNumber({
55
- orderNumber: { $eq: data.object.mainEntity.orderNumber },
56
- project: { id: { $eq: params.project.id } }
57
- });
56
+ // const acceptedOffers = await repos.acceptedOffer.searchAcceptedOffersByOrderNumber({
57
+ // orderNumber: { $eq: data.object.mainEntity.orderNumber },
58
+ // project: { id: { $eq: params.project.id } }
59
+ // });
58
60
  await (0, createAccountingReportIfNotExist_1.createAccountingReportIfNotExist)({
59
61
  ...order,
60
- acceptedOffers
62
+ // acceptedOffers
61
63
  })(repos);
62
64
  }
63
65
  catch (error) {
@@ -17,7 +17,6 @@ const hasPOS_1 = require("../../repo/place/hasPOS");
17
17
  const movieTheater_1 = require("../../repo/place/movieTheater");
18
18
  const screeningRoom_1 = require("../../repo/place/screeningRoom");
19
19
  const product_1 = require("../../repo/product");
20
- const productModel_1 = require("../../repo/productModel");
21
20
  const setting_1 = require("../../repo/setting");
22
21
  const task_1 = require("../../repo/task");
23
22
  const deleteResourcesByAggregateOffer_1 = require("./onResourceDeleted/deleteResourcesByAggregateOffer");
@@ -28,7 +27,7 @@ const deleteResourcesByProduct_1 = require("./onResourceDeleted/deleteResourcesB
28
27
  const deleteResourcesByRoom_1 = require("./onResourceDeleted/deleteResourcesByRoom");
29
28
  const deleteResourcesBySeller_1 = require("./onResourceDeleted/deleteResourcesBySeller");
30
29
  const onHasPOSUpdated_1 = require("./onResourceUpdated/onHasPOSUpdated");
31
- const syncCategoryCode_1 = require("./onResourceUpdated/syncCategoryCode");
30
+ // import { syncCategoryCode } from './onResourceUpdated/syncCategoryCode';
32
31
  const syncOfferCatalog_1 = require("./onResourceUpdated/syncOfferCatalog");
33
32
  /**
34
33
  * タスク実行関数
@@ -51,7 +50,6 @@ function call(params) {
51
50
  paymentServiceProvider: new paymentServiceProvider_1.PaymentServiceProviderRepo(connection),
52
51
  screeningRoom: new screeningRoom_1.ScreeningRoomRepo(connection),
53
52
  product: new product_1.ProductRepo(connection),
54
- productModel: new productModel_1.ProductModelRepo(connection),
55
53
  setting: new setting_1.SettingRepo(connection),
56
54
  task: new task_1.TaskRepo(connection)
57
55
  });
@@ -136,11 +134,12 @@ function onResourceDeleted(params) {
136
134
  break;
137
135
  // 区分削除に対応(2024-04-18~)
138
136
  case 'CategoryCode':
139
- await (0, syncCategoryCode_1.syncCategoryCode)({
140
- project: { id: params.project.id },
141
- ids: params.id,
142
- isDeleted: true
143
- })(repos);
137
+ // discontinue sync to productModels(2026-04-30~)
138
+ // await syncCategoryCode({
139
+ // project: { id: params.project.id },
140
+ // ids: params.id,
141
+ // isDeleted: true
142
+ // })(repos);
144
143
  break;
145
144
  default:
146
145
  // no op
@@ -20,11 +20,10 @@ const hasPOS_1 = require("../../repo/place/hasPOS");
20
20
  const movieTheater_1 = require("../../repo/place/movieTheater");
21
21
  const screeningRoom_1 = require("../../repo/place/screeningRoom");
22
22
  const product_1 = require("../../repo/product");
23
- const productModel_1 = require("../../repo/productModel");
24
23
  const setting_1 = require("../../repo/setting");
25
24
  const task_1 = require("../../repo/task");
26
25
  const onAggregateOfferUpdated_1 = require("./onResourceUpdated/onAggregateOfferUpdated");
27
- const onCategoryCodeUpdated_1 = require("./onResourceUpdated/onCategoryCodeUpdated");
26
+ // import { onCategoryCodeUpdated } from './onResourceUpdated/onCategoryCodeUpdated';
28
27
  const onHasPOSUpdated_1 = require("./onResourceUpdated/onHasPOSUpdated");
29
28
  const onOfferCatalogUpdated_1 = require("./onResourceUpdated/onOfferCatalogUpdated");
30
29
  /**
@@ -51,7 +50,6 @@ function call(data) {
51
50
  paymentServiceProvider: new paymentServiceProvider_1.PaymentServiceProviderRepo(connection),
52
51
  screeningRoom: new screeningRoom_1.ScreeningRoomRepo(connection),
53
52
  product: new product_1.ProductRepo(connection),
54
- productModel: new productModel_1.ProductModelRepo(connection),
55
53
  setting: new setting_1.SettingRepo(connection),
56
54
  task: new task_1.TaskRepo(connection)
57
55
  });
@@ -170,11 +168,12 @@ function onResourceUpdated(params) {
170
168
  break;
171
169
  // 区分に対応(2024-04-18~)
172
170
  case 'CategoryCode':
173
- await (0, onCategoryCodeUpdated_1.onCategoryCodeUpdated)({
174
- project: { id: params.project.id },
175
- ids: params.id,
176
- isDeleted: false
177
- })(repos);
171
+ // discontinue sync to productModels(2026-04-30~)
172
+ // await onCategoryCodeUpdated({
173
+ // project: { id: params.project.id },
174
+ // ids: params.id,
175
+ // isDeleted: false
176
+ // })(repos);
178
177
  break;
179
178
  default:
180
179
  // no op
@@ -1,6 +1,6 @@
1
+ import type { IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
1
2
  import { factory } from '../../factory';
2
- import type { IOperationExecute } from '../taskHandler';
3
3
  /**
4
4
  * タスク実行関数
5
5
  */
6
- export declare function call(data: factory.task.useReservation.IData): IOperationExecute<void>;
6
+ export declare function call(params: Pick<factory.task.useReservation.ITask, IExecutableTaskKeys>): IOperationExecute<void>;
@@ -12,25 +12,15 @@ const useReservation_1 = require("../reserve/useReservation");
12
12
  /**
13
13
  * タスク実行関数
14
14
  */
15
- function call(data) {
15
+ function call(params) {
16
16
  return async ({ connection }) => {
17
- let instrument;
18
- // support array(2025-02-17~)
19
- if (Array.isArray(data.instrument)) {
20
- instrument = data.instrument;
21
- }
22
- else {
23
- if (data.instrument?.typeOf === 'Ticket') {
24
- instrument = [data.instrument];
25
- }
26
- }
17
+ const { data, project } = params;
27
18
  await (0, useReservation_1.useReservation)({
28
- project: data.project,
19
+ project,
29
20
  agent: data.agent,
30
21
  object: data.object,
31
- instrument,
32
- // ...(typeof data.instrument?.typeOf === 'string') ? { instrument: data.instrument } : undefined,
33
- ...(typeof data.location?.typeOf === 'string') ? { location: data.location } : undefined
22
+ instrument: data.instrument,
23
+ ...(typeof data.location?.identifier === 'string') ? { location: data.location } : undefined
34
24
  })({
35
25
  action: new action_1.ActionRepo(connection),
36
26
  assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
@@ -39,8 +29,6 @@ function call(data) {
39
29
  reservation: new reservation_1.ReservationRepo(connection),
40
30
  setting: new setting_1.SettingRepo(connection),
41
31
  task: new task_1.TaskRepo(connection)
42
- }
43
- // settings
44
- );
32
+ });
45
33
  };
46
34
  }
@@ -74,6 +74,7 @@ function executeTask(task, next) {
74
74
  case factory_1.factory.taskName.SendEmailMessage:
75
75
  case factory_1.factory.taskName.SyncResourcesFromCOA:
76
76
  case factory_1.factory.taskName.TriggerWebhook:
77
+ case factory_1.factory.taskName.UseReservation:
77
78
  callResult = await call(task)(settings, options);
78
79
  break;
79
80
  default:
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": "8.0.0",
14
+ "@chevre/factory": "8.1.0-alpha.4",
15
15
  "@motionpicture/coa-service": "10.0.0",
16
16
  "@motionpicture/gmo-service": "6.1.0-alpha.0",
17
17
  "@sendgrid/client": "8.1.4",
@@ -91,5 +91,5 @@
91
91
  "postversion": "git push origin --tags",
92
92
  "prepublishOnly": "npm run clean && npm run build"
93
93
  },
94
- "version": "24.1.0-alpha.0"
94
+ "version": "24.1.0-alpha.10"
95
95
  }
@@ -1,33 +0,0 @@
1
- import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
2
- import { IVirtuals } from '../virtuals';
3
- import { factory } from '../../../factory';
4
- export interface IProductModel {
5
- id: string;
6
- project: {
7
- id: string;
8
- typeOf: factory.organizationType.Project;
9
- };
10
- typeOf: 'ProductModel';
11
- category: Pick<factory.categoryCode.ICategoryCode, 'codeValue' | 'inCodeSet'> & {
12
- /**
13
- * 区分ID
14
- * 削除時同期に必要
15
- */
16
- id: string;
17
- };
18
- name: factory.multilingualString;
19
- offers: {
20
- typeOf: factory.offerType.Offer;
21
- eligibleCustomerType?: {
22
- codeValue: string;
23
- }[];
24
- }[];
25
- }
26
- type IDocType = Omit<IProductModel, 'id'>;
27
- type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
28
- type ISchemaDefinition = SchemaDefinition<IDocType>;
29
- type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition, IDocType>;
30
- declare const modelName = "ProductModel";
31
- declare const indexes: [d: IndexDefinition, o: IndexOptions][];
32
- declare function createSchema(): ISchema;
33
- export { createSchema, IDocType, IModel, indexes, modelName };
@@ -1,57 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.modelName = exports.indexes = void 0;
4
- exports.createSchema = createSchema;
5
- const mongoose_1 = require("mongoose");
6
- const writeConcern_1 = require("../writeConcern");
7
- const settings_1 = require("../../../settings");
8
- const modelName = 'ProductModel';
9
- exports.modelName = modelName;
10
- const schemaDefinition = {
11
- project: mongoose_1.SchemaTypes.Mixed,
12
- typeOf: { type: String, required: true },
13
- category: mongoose_1.SchemaTypes.Mixed,
14
- name: mongoose_1.SchemaTypes.Mixed,
15
- offers: mongoose_1.SchemaTypes.Mixed
16
- };
17
- const schemaOptions = {
18
- autoIndex: settings_1.MONGO_AUTO_INDEX,
19
- autoCreate: false,
20
- collection: 'productModels',
21
- id: true,
22
- read: settings_1.MONGO_READ_PREFERENCE,
23
- writeConcern: writeConcern_1.writeConcern,
24
- strict: true,
25
- strictQuery: false,
26
- timestamps: false, // 2024-09-03~
27
- versionKey: false, // 2024-09-03~
28
- toJSON: {
29
- getters: false,
30
- virtuals: false,
31
- minimize: false,
32
- versionKey: false
33
- },
34
- toObject: {
35
- getters: false,
36
- virtuals: true,
37
- minimize: false,
38
- versionKey: false
39
- }
40
- };
41
- const indexes = [];
42
- exports.indexes = indexes;
43
- /**
44
- * プロダクトモデルスキーマ
45
- */
46
- let schema;
47
- function createSchema() {
48
- if (schema === undefined) {
49
- schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
50
- if (settings_1.MONGO_AUTO_INDEX) {
51
- indexes.forEach((indexParams) => {
52
- schema?.index(...indexParams);
53
- });
54
- }
55
- }
56
- return schema;
57
- }
@@ -1,27 +0,0 @@
1
- import type { Connection } from 'mongoose';
2
- import { factory } from '../factory';
3
- /**
4
- * プロダクトモデルリポジトリ
5
- */
6
- export declare class ProductModelRepo {
7
- private readonly productModelModel;
8
- constructor(connection: Connection);
9
- /**
10
- * 区分から同期する
11
- */
12
- upsertByCategory(params: {
13
- category: Pick<factory.categoryCode.ICategoryCode, 'codeValue' | 'inCodeSet' | 'name' | 'project'> & {
14
- id: string;
15
- };
16
- }): Promise<{
17
- id: string;
18
- }>;
19
- /**
20
- * 区分から削除する
21
- */
22
- deleteByCategory(params: {
23
- category: Pick<factory.categoryCode.ICategoryCode, 'project'> & {
24
- id: string;
25
- };
26
- }): Promise<void>;
27
- }