@chevre/domain 22.9.0-alpha.113 → 22.9.0-alpha.114

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.
@@ -0,0 +1,47 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+
4
+ import { chevre } from '../../../../lib/index';
5
+
6
+ // const project = { id: String(process.env.PROJECT_ID) };
7
+ const excludedProject = { id: String(process.env.EXCLUDED_PROJECT_ID) };
8
+
9
+ mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
10
+
11
+ // tslint:disable-next-line:max-func-body-length
12
+ async function main() {
13
+ const aggregateOfferRepo = await chevre.repository.AggregateOffer.createInstance(mongoose.connection);
14
+
15
+ const cursor = aggregateOfferRepo.getCursor(
16
+ {
17
+ 'project.id': { $ne: excludedProject.id }
18
+ // _id: { $eq: 'blyk9q24f' }
19
+ },
20
+ {
21
+ _id: 1,
22
+ project: 1
23
+ }
24
+ );
25
+ console.log('docs found');
26
+
27
+ let i = 0;
28
+ await cursor.eachAsync(async (doc) => {
29
+ i += 1;
30
+ const offer: Pick<chevre.factory.aggregateOffer.IAggregateOffer, 'id' | 'project'> = doc.toObject();
31
+
32
+ console.log('count?', offer.project.id, offer.id, i);
33
+ const result = await aggregateOfferRepo.countIncludedInDataCatalog({
34
+ id: { $eq: String(offer.id) }
35
+ });
36
+ console.log('result:', result, offer.project.id, offer.id, i);
37
+ });
38
+
39
+ console.log(i, 'docs checked');
40
+
41
+ const resultMax = await aggregateOfferRepo.maxIncludedInDataCatalogCount();
42
+ console.log('resultMax:', resultMax);
43
+ }
44
+
45
+ main()
46
+ .then()
47
+ .catch(console.error);
@@ -1,8 +1,7 @@
1
1
  // tslint:disable:no-console
2
2
  import * as mongoose from 'mongoose';
3
3
 
4
- import { PendingReservationRepo } from '../../../lib/chevre/repo/pendingReservation';
5
- // import { chevre } from '../../../lib/index';
4
+ import { chevre } from '../../../lib/index';
6
5
 
7
6
  mongoose.Model.on('index', (...args) => {
8
7
  console.error('******** index event emitted. ********\n', args);
@@ -12,9 +11,8 @@ mongoose.Model.on('index', (...args) => {
12
11
  async function main() {
13
12
  await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
14
13
 
15
- // await chevre.repository.StockHolder.createInstance(mongoose.connection);
16
- const pendingReservationRepo = new PendingReservationRepo(mongoose.connection);
17
- console.log('success!', pendingReservationRepo);
14
+ await chevre.repository.Note.createInstance(mongoose.connection);
15
+ console.log('success!');
18
16
  }
19
17
 
20
18
  main()
@@ -0,0 +1,100 @@
1
+ // tslint:disable:no-console
2
+ import * as moment from 'moment';
3
+ import * as mongoose from 'mongoose';
4
+ import * as redis from 'redis';
5
+
6
+ import { chevre } from '../../../../lib/index';
7
+
8
+ // const project = { id: String(process.env.PROJECT_ID) };
9
+
10
+ const client = redis.createClient<redis.RedisDefaultModules, Record<string, never>, Record<string, never>>({
11
+ socket: {
12
+ port: Number(<string>process.env.REDIS_PORT),
13
+ host: <string>process.env.REDIS_HOST
14
+ },
15
+ password: <string>process.env.REDIS_KEY
16
+ })
17
+ .on('error', (err) => {
18
+ // eslint-disable-next-line no-console
19
+ console.error('createDefaultRedisClient: client onError:', err);
20
+ // reject(err);
21
+ });
22
+ client.connect();
23
+ mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
24
+
25
+ // tslint:disable-next-line:max-func-body-length
26
+ async function main() {
27
+ const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
28
+ const settingRepo = await chevre.repository.Setting.createInstance(mongoose.connection);
29
+ const stockHolderRepo = await chevre.repository.StockHolder.createInstance(
30
+ client,
31
+ mongoose.connection
32
+ );
33
+
34
+ const setting = await settingRepo.findOne(
35
+ { project: { id: { $eq: '*' } } },
36
+ ['useMongoAsStockHolderProjects']
37
+ );
38
+ const useMongoAsStockHolderProjects =
39
+ (Array.isArray(setting?.useMongoAsStockHolderProjects)) ? setting?.useMongoAsStockHolderProjects : [];
40
+
41
+ if (useMongoAsStockHolderProjects.length === 0) {
42
+ return;
43
+ }
44
+
45
+ const cursor = eventRepo.getCursor(
46
+ {
47
+ 'project.id': {
48
+ // $eq: 'toei-production',
49
+ $in: useMongoAsStockHolderProjects
50
+ },
51
+ startDate: {
52
+ $gte: moment()
53
+ .add(0, 'days')
54
+ .toDate()
55
+ },
56
+ typeOf: { $eq: chevre.factory.eventType.ScreeningEvent }
57
+ // _id: { $eq: 'blyk9q24f' }
58
+ },
59
+ {
60
+ _id: 1,
61
+ // offers: 1,
62
+ startDate: 1,
63
+ project: 1,
64
+ typeOf: 1
65
+ }
66
+ );
67
+ console.log('events found');
68
+
69
+ let i = 0;
70
+ let redisKeyCount = 0;
71
+ const eventsWithRedis: string[] = [];
72
+ await cursor.eachAsync(async (doc) => {
73
+ i += 1;
74
+ const event: Pick<
75
+ chevre.factory.event.screeningEvent.IEvent,
76
+ 'id' | 'startDate' | 'project' | 'typeOf'
77
+ > = doc.toObject();
78
+
79
+ console.log('redisKeyExists?', event.project.id, event.typeOf, event.id, event.startDate, i);
80
+ const redisKeyExists = await stockHolderRepo.redisKeyExists({
81
+ eventId: event.id,
82
+ startDate: event.startDate
83
+ });
84
+ console.log('redisKeyExists:', redisKeyExists, event.project.id, event.typeOf, event.id, event.startDate, i);
85
+
86
+ if (redisKeyExists) {
87
+ redisKeyCount += 1;
88
+ eventsWithRedis.push(event.id);
89
+ }
90
+ });
91
+
92
+ console.log(i, 'events checked');
93
+ console.log(redisKeyCount, 'redisKeys found');
94
+ console.log('useMongoAsStockHolderProjects:', useMongoAsStockHolderProjects);
95
+ // console.log('eventsWithRedis:', eventsWithRedis);
96
+ }
97
+
98
+ main()
99
+ .then()
100
+ .catch(console.error);
@@ -20,36 +20,60 @@ const client = redis.createClient<redis.RedisDefaultModules, Record<string, neve
20
20
  client.connect();
21
21
  mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
22
22
 
23
- const EVENT_ID = 'cm8dwc74d';
23
+ const EVENT_ID = 'cm8dwc74c';
24
24
 
25
- // tslint:disable-next-line:max-func-body-length
26
25
  async function main() {
27
26
  // 万が一に備えて、保留予約をredis->mongo移行するスクリプト
27
+ const assetTransactionRepo = await chevre.repository.AssetTransaction.createInstance(mongoose.connection);
28
28
  const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
29
+ // const pendingReservationRepo = await chevre.repository.PendingReservation.createInstance(mongoose.connection);
29
30
  const stockHolderRepo = await chevre.repository.StockHolder.createInstance(client, mongoose.connection);
30
- // const pendingReservationRepo = new PendingReservationRepo(mongoose.connection);
31
31
 
32
32
  const event = await eventRepo.projectEventFieldsById(
33
33
  { id: EVENT_ID },
34
- ['startDate', 'organizer', 'project']
34
+ ['startDate', 'organizer', 'project', 'offers']
35
35
  );
36
- const result = await stockHolderRepo.migrate2mongoJustInCase({
36
+ const hasTicketedSeat = event.offers.itemOffered.serviceOutput?.reservedTicket?.ticketedSeat?.typeOf === chevre.factory.placeType.Seat;
37
+ const { expireTime, hash } = await stockHolderRepo.migrate2mongoJustInCase({
37
38
  eventId: EVENT_ID,
38
39
  startDate: event.startDate
39
40
  // project: { id: event.project.id },
40
41
  // provider: { id: event.organizer.id }
41
42
  });
42
- console.log(result);
43
+ console.log(expireTime, hash);
44
+
45
+ const lockKeys: ILockKey[] = [];
46
+ const reservationNumbers: string[] = [...new Set(Object.values(hash))];
47
+ const expires: Date = moment.unix(expireTime)
48
+ .toDate();
49
+ console.log('reservationNumbers:', reservationNumbers);
50
+ console.log('expires:', expires);
43
51
 
44
52
  // 予約番号ごとにlockKeyを作成する
45
- const lockKey: ILockKey = {
46
- project: { id: event.project.id },
47
- provider: { id: event.organizer.id },
48
- eventId: EVENT_ID,
49
- startDate: event.startDate,
50
- hasTicketedSeat: true,
51
- offers: Object.keys(result)
52
- .map((field) => {
53
+ for (const reservationNumber of reservationNumbers) {
54
+ const reserveTransaction = (await assetTransactionRepo.search<chevre.factory.assetTransactionType.Reserve>(
55
+ {
56
+ limit: 1,
57
+ page: 1,
58
+ transactionNumber: { $eq: reservationNumber },
59
+ typeOf: chevre.factory.assetTransactionType.Reserve,
60
+ status: { $in: [chevre.factory.transactionStatusType.Confirmed] }
61
+ },
62
+ ['object', 'startDate']
63
+ )).shift();
64
+ if (reserveTransaction === undefined) {
65
+ throw new Error(`reserveTransaction not found ${reservationNumber}`);
66
+ }
67
+
68
+ const fields: string[] = Object.keys(hash)
69
+ .filter((field) => hash[field] === reservationNumber);
70
+ const lockKey: ILockKey = {
71
+ project: { id: event.project.id },
72
+ provider: { id: event.organizer.id },
73
+ eventId: EVENT_ID,
74
+ startDate: event.startDate,
75
+ hasTicketedSeat,
76
+ offers: fields.map((field) => {
53
77
  const splitedField = field.split(':');
54
78
 
55
79
  return {
@@ -57,14 +81,14 @@ async function main() {
57
81
  seatNumber: splitedField[1]
58
82
  };
59
83
  }),
60
- expires: moment(event.startDate)
61
- // tslint:disable-next-line:no-magic-numbers
62
- .add(3, 'months')
63
- .toDate(),
64
- holder: '',
65
- bookingTime: new Date()
66
- };
67
- console.log('lockKey:', lockKey);
84
+ expires,
85
+ holder: reservationNumber,
86
+ bookingTime: reserveTransaction.startDate
87
+ };
88
+ console.log('lockKey:', lockKey);
89
+ lockKeys.push(lockKey);
90
+ // await pendingReservationRepo.lock(lockKey);
91
+ }
68
92
  }
69
93
 
70
94
  main()
@@ -9,17 +9,17 @@ import { chevre } from '../../../lib/index';
9
9
  async function main() {
10
10
  await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
11
11
 
12
- const paymentServiceRepo = await chevre.repository.PaymentService.createInstance(mongoose.connection);
12
+ const aggregateOfferRepo = await chevre.repository.AggregateOffer.createInstance(mongoose.connection);
13
13
 
14
14
  let updateResult: any;
15
15
 
16
- updateResult = await paymentServiceRepo.unsetUnnecessaryFields({
16
+ updateResult = await aggregateOfferRepo.unsetUnnecessaryFields({
17
17
  filter: {
18
- 'availableChannel.serviceUrl': { $exists: true }
19
- // _id: { $eq: '657e4003d4abb2d3871bb92f' }
18
+ 'offers.includedInDataCatalog.id': { $exists: true }
19
+ // _id: { $eq: 'blj55y1mo' }
20
20
  },
21
21
  $unset: {
22
- 'availableChannel.serviceUrl': 1
22
+ 'offers.0.includedInDataCatalog': 1
23
23
  }
24
24
  });
25
25
  console.log(updateResult);
@@ -57,9 +57,24 @@ export declare class AggregateOfferRepo {
57
57
  };
58
58
  id: string;
59
59
  }): Promise<void>;
60
+ getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, {}, import("./mongoose/schemas/aggregateOffer").IDocType> & import("./mongoose/schemas/aggregateOffer").IDocType & Required<{
61
+ _id: string;
62
+ }>, import("mongoose").QueryOptions<import("mongoose").Document<unknown, {}, import("./mongoose/schemas/aggregateOffer").IDocType> & import("./mongoose/schemas/aggregateOffer").IDocType & Required<{
63
+ _id: string;
64
+ }>>>;
60
65
  unsetUnnecessaryFields(params: {
61
66
  filter: FilterQuery<factory.aggregateOffer.IAggregateOffer>;
62
67
  $unset: any;
63
68
  }): Promise<import("mongoose").UpdateWriteOpResult>;
69
+ countIncludedInDataCatalog(params: {
70
+ id: {
71
+ $eq: string;
72
+ };
73
+ }): Promise<{
74
+ includedInDataCatalogCount: number;
75
+ }[]>;
76
+ maxIncludedInDataCatalogCount(): Promise<{
77
+ includedInDataCatalogCount: number;
78
+ }[]>;
64
79
  }
65
80
  export {};
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.AggregateOfferRepo = void 0;
13
13
  const createDebug = require("debug");
14
+ const factory = require("../factory");
14
15
  const aggregateOffer_1 = require("./mongoose/schemas/aggregateOffer");
15
16
  const debug = createDebug('chevre-domain:repo:aggregateOffer');
16
17
  /**
@@ -558,11 +559,77 @@ class AggregateOfferRepo {
558
559
  // )
559
560
  // .exec();
560
561
  // }
562
+ getCursor(conditions, projection) {
563
+ return this.aggregateOfferModel.find(conditions, projection)
564
+ .sort({ 'offers.identifier': factory.sortType.Ascending })
565
+ .cursor();
566
+ }
561
567
  unsetUnnecessaryFields(params) {
562
568
  return __awaiter(this, void 0, void 0, function* () {
563
569
  return this.aggregateOfferModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
564
570
  .exec();
565
571
  });
566
572
  }
573
+ countIncludedInDataCatalog(params) {
574
+ return __awaiter(this, void 0, void 0, function* () {
575
+ const aggregate = this.aggregateOfferModel.aggregate([
576
+ {
577
+ $match: {
578
+ _id: { $eq: params.id.$eq }
579
+ }
580
+ },
581
+ {
582
+ $project: {
583
+ _id: 0,
584
+ includedInDataCatalogCount: {
585
+ $cond: {
586
+ if: { $isArray: '$includedInDataCatalog' },
587
+ then: { $size: '$includedInDataCatalog' },
588
+ else: 0
589
+ }
590
+ }
591
+ }
592
+ }
593
+ ]);
594
+ return aggregate.exec();
595
+ });
596
+ }
597
+ maxIncludedInDataCatalogCount() {
598
+ return __awaiter(this, void 0, void 0, function* () {
599
+ const aggregate = this.aggregateOfferModel.aggregate([
600
+ // {
601
+ // $match: {
602
+ // _id: { $eq: params.id.$eq }
603
+ // }
604
+ // },
605
+ {
606
+ $project: {
607
+ _id: 0,
608
+ includedInDataCatalogCount: {
609
+ $cond: {
610
+ if: { $isArray: '$includedInDataCatalog' },
611
+ then: { $size: '$includedInDataCatalog' },
612
+ else: 0
613
+ }
614
+ }
615
+ }
616
+ },
617
+ {
618
+ $group: {
619
+ // tslint:disable-next-line:no-null-keyword
620
+ _id: null,
621
+ maxCount: { $max: '$includedInDataCatalogCount' }
622
+ }
623
+ },
624
+ {
625
+ $project: {
626
+ _id: 0,
627
+ maxCount: '$maxCount'
628
+ }
629
+ }
630
+ ]);
631
+ return aggregate.exec();
632
+ });
633
+ }
567
634
  }
568
635
  exports.AggregateOfferRepo = AggregateOfferRepo;
@@ -60,15 +60,16 @@ const indexes = [
60
60
  }
61
61
  }
62
62
  ],
63
- [
64
- { 'offers.includedInDataCatalog.id': 1 },
65
- {
66
- name: 'searchByOffersIncludedInDataCatalogId-v2',
67
- partialFilterExpression: {
68
- 'offers.includedInDataCatalog.id': { $exists: true }
69
- }
70
- }
71
- ],
63
+ // discontinue(2025-05-04~)
64
+ // [
65
+ // { 'offers.includedInDataCatalog.id': 1 },
66
+ // {
67
+ // name: 'searchByOffersIncludedInDataCatalogId-v2',
68
+ // partialFilterExpression: {
69
+ // 'offers.includedInDataCatalog.id': { $exists: true }
70
+ // }
71
+ // }
72
+ // ],
72
73
  [
73
74
  { 'project.id': 1 },
74
75
  { name: 'searchByProjectId-v2' }
@@ -8,41 +8,17 @@ const settings_1 = require("../../../settings");
8
8
  const modelName = 'Note';
9
9
  exports.modelName = modelName;
10
10
  const schemaDefinition = {
11
- identifier: {
12
- type: String,
13
- required: true
14
- },
15
- text: {
16
- type: String,
17
- required: true
18
- },
19
- project: {
20
- type: mongoose_1.SchemaTypes.Mixed,
21
- required: true
22
- },
23
- provider: {
24
- type: mongoose_1.SchemaTypes.Mixed,
25
- required: true
26
- },
27
- about: {
28
- type: mongoose_1.SchemaTypes.Mixed,
29
- required: true
30
- },
31
- dateCreated: Date,
11
+ identifier: { type: String, required: true },
12
+ text: { type: String, required: true },
13
+ project: { type: mongoose_1.SchemaTypes.Mixed, required: true },
14
+ provider: { type: mongoose_1.SchemaTypes.Mixed, required: true },
15
+ about: { type: mongoose_1.SchemaTypes.Mixed, required: true },
16
+ dateCreated: { type: Date, required: true },
32
17
  dateModified: Date,
33
- creator: {
34
- type: mongoose_1.SchemaTypes.Mixed,
35
- required: true
36
- },
18
+ creator: { type: mongoose_1.SchemaTypes.Mixed, required: true },
37
19
  editor: mongoose_1.SchemaTypes.Mixed,
38
- version: {
39
- type: String,
40
- required: true
41
- },
42
- typeOf: {
43
- type: String,
44
- required: true
45
- }
20
+ version: { type: String, required: true },
21
+ typeOf: { type: String, required: true }
46
22
  };
47
23
  const schemaOptions = {
48
24
  autoIndex: settings_1.MONGO_AUTO_INDEX,
@@ -69,18 +45,46 @@ const schemaOptions = {
69
45
  }
70
46
  };
71
47
  const indexes = [
48
+ [
49
+ { dateCreated: -1 },
50
+ { name: 'dateCreated' }
51
+ ],
52
+ [
53
+ { 'project.id': 1, dateCreated: -1 },
54
+ { name: 'projectId' }
55
+ ],
56
+ [
57
+ { 'provider.id': 1, dateCreated: -1 },
58
+ { name: 'providerId' }
59
+ ],
60
+ [
61
+ { 'about.id': 1, dateCreated: -1 },
62
+ { name: 'aboutId' }
63
+ ],
64
+ [
65
+ { 'about.orderNumber': 1, dateCreated: -1 },
66
+ { name: 'aboutOrderNumber' }
67
+ ],
68
+ [
69
+ { identifier: 1, dateCreated: -1 },
70
+ { name: 'identifier' }
71
+ ],
72
+ // tslint:disable-next-line:no-suspicious-comment
72
73
  [
73
74
  { identifier: 1 },
74
75
  { name: 'searchByIdentifier' }
75
76
  ],
77
+ // tslint:disable-next-line:no-suspicious-comment
76
78
  [
77
79
  { 'project.id': 1, identifier: 1 },
78
80
  { name: 'searchByProjectId' }
79
81
  ],
82
+ // tslint:disable-next-line:no-suspicious-comment
80
83
  [
81
84
  { 'provider.id': 1, identifier: 1 },
82
85
  { name: 'searchByProviderId' }
83
86
  ],
87
+ // tslint:disable-next-line:no-suspicious-comment
84
88
  [
85
89
  { 'about.id': 1, identifier: 1 },
86
90
  { name: 'searchByAboutId' }
@@ -13,7 +13,9 @@ export declare class NoteRepo {
13
13
  /**
14
14
  * 検索
15
15
  */
16
- projectFields(params: factory.creativeWork.noteDigitalDocument.ISearchConditions, inclusion: IKeyOfProjection[]): Promise<(INoteDigitalDocument & {
16
+ projectFields(params: factory.creativeWork.noteDigitalDocument.ISearchConditions & {
17
+ sort: factory.creativeWork.noteDigitalDocument.ISortOrder;
18
+ }, inclusion: IKeyOfProjection[]): Promise<(INoteDigitalDocument & {
17
19
  id: string;
18
20
  })[]>;
19
21
  /**
@@ -95,10 +95,8 @@ class NoteRepo {
95
95
  query.limit(params.limit)
96
96
  .skip(params.limit * (page - 1));
97
97
  }
98
- // tslint:disable-next-line:no-single-line-block-comment
99
- /* istanbul ignore else */
100
- if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.identifier) !== undefined) {
101
- query.sort({ identifier: params.sort.identifier });
98
+ if (typeof ((_a = params.sort) === null || _a === void 0 ? void 0 : _a.dateCreated) === 'number') {
99
+ query.sort({ dateCreated: params.sort.dateCreated });
102
100
  }
103
101
  return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
104
102
  .lean() // 2024-09-19~
@@ -51,6 +51,10 @@ export declare class StockHolderRepo implements AbstractStockHolderRepo {
51
51
  hasTicketedSeat: boolean;
52
52
  offers: IOffer[];
53
53
  }): Promise<IGetHolderResult[]>;
54
+ redisKeyExists(params: {
55
+ eventId: string;
56
+ startDate: Date;
57
+ }): Promise<boolean>;
54
58
  checkIfConflicted(params: {
55
59
  eventId: string;
56
60
  startDate: Date;
@@ -62,12 +66,14 @@ export declare class StockHolderRepo implements AbstractStockHolderRepo {
62
66
  eventId: string;
63
67
  startDate: Date;
64
68
  }): Promise<{
65
- [x: string]: string;
69
+ expireTime: number;
70
+ hash: {
71
+ [x: string]: string;
72
+ };
66
73
  }>;
67
74
  /**
68
75
  * 新リポジトリを使用するかどうか
69
76
  */
70
77
  private useMongoose;
71
78
  private useMongoAsStockHolderBySettings;
72
- private redisKeyExists;
73
79
  }
@@ -247,6 +247,14 @@ class StockHolderRepo {
247
247
  }
248
248
  });
249
249
  }
250
+ redisKeyExists(params) {
251
+ return __awaiter(this, void 0, void 0, function* () {
252
+ const key = StockHolderRepo.createKey(params);
253
+ const existingRedisKeyCount = yield this.redisClient.exists(key);
254
+ // console.log('existingRedisKeyCount:', existingRedisKeyCount);
255
+ return typeof existingRedisKeyCount === 'number' && existingRedisKeyCount > 0;
256
+ });
257
+ }
250
258
  checkIfConflicted(params) {
251
259
  return __awaiter(this, void 0, void 0, function* () {
252
260
  const redisKeyExists = yield this.redisKeyExists(params);
@@ -262,7 +270,10 @@ class StockHolderRepo {
262
270
  migrate2mongoJustInCase(params) {
263
271
  return __awaiter(this, void 0, void 0, function* () {
264
272
  const redisKey = StockHolderRepo.createKey({ eventId: params.eventId, startDate: params.startDate });
265
- return this.redisClient.hGetAll(redisKey);
273
+ return {
274
+ expireTime: yield this.redisClient.expireTime(redisKey),
275
+ hash: yield this.redisClient.hGetAll(redisKey)
276
+ };
266
277
  });
267
278
  }
268
279
  /**
@@ -310,14 +321,6 @@ class StockHolderRepo {
310
321
  return useMongoGlobally || useMongoByProject;
311
322
  });
312
323
  }
313
- redisKeyExists(params) {
314
- return __awaiter(this, void 0, void 0, function* () {
315
- const key = StockHolderRepo.createKey(params);
316
- const existingRedisKeyCount = yield this.redisClient.exists(key);
317
- // console.log('existingRedisKeyCount:', existingRedisKeyCount);
318
- return typeof existingRedisKeyCount === 'number' && existingRedisKeyCount > 0;
319
- });
320
- }
321
324
  }
322
325
  exports.StockHolderRepo = StockHolderRepo;
323
326
  StockHolderRepo.KEY_PREFIX_NEW = 'stockHolder';
@@ -185,11 +185,12 @@ function onResourceUpdated(params) {
185
185
  });
186
186
  }
187
187
  function createInformNoteTasks(params, setting) {
188
- return (repos
189
- // settings: Settings
190
- ) => __awaiter(this, void 0, void 0, function* () {
188
+ return (repos) => __awaiter(this, void 0, void 0, function* () {
191
189
  var _a;
192
- const notes4inform = yield repos.note.projectFields({ id: { $in: params.ids } }, ['about', 'identifier', 'project', 'text', 'typeOf', 'version']);
190
+ const notes4inform = yield repos.note.projectFields({
191
+ id: { $in: params.ids },
192
+ sort: { dateCreated: factory.sortType.Descending }
193
+ }, ['about', 'identifier', 'project', 'text', 'typeOf', 'version']);
193
194
  // const informResources = settings.onResourceUpdated.informResource;
194
195
  const informResources = (_a = setting === null || setting === void 0 ? void 0 : setting.onResourceUpdated) === null || _a === void 0 ? void 0 : _a.informResource;
195
196
  if (notes4inform.length > 0) {
package/package.json CHANGED
@@ -11,8 +11,8 @@
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.393.0-alpha.49",
15
- "@cinerino/sdk": "10.21.0-alpha.33",
14
+ "@chevre/factory": "4.393.0-alpha.50",
15
+ "@cinerino/sdk": "10.21.0-alpha.34",
16
16
  "@motionpicture/coa-service": "9.6.0",
17
17
  "@motionpicture/gmo-service": "5.3.0",
18
18
  "@sendgrid/client": "8.1.4",
@@ -113,5 +113,5 @@
113
113
  "postversion": "git push origin --tags",
114
114
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
115
115
  },
116
- "version": "22.9.0-alpha.113"
116
+ "version": "22.9.0-alpha.114"
117
117
  }