@chevre/domain 20.4.0-alpha.0 → 20.4.0-alpha.2

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.
@@ -34,7 +34,6 @@ export declare class MongoRepository {
34
34
  confirm<T extends factory.account.transactionType>(params: {
35
35
  typeOf?: T;
36
36
  id: string;
37
- result: factory.account.transaction.IResult;
38
37
  potentialActions: factory.account.transaction.IPotentialActions;
39
38
  }): Promise<factory.account.transaction.ITransaction<T>>;
40
39
  /**
@@ -154,7 +154,7 @@ class MongoRepository {
154
154
  const doc = yield this.transactionModel.findOneAndUpdate(Object.assign({ _id: params.id, status: factory.transactionStatusType.InProgress }, (typeof params.typeOf === 'string') ? { typeOf: params.typeOf } : undefined), {
155
155
  status: factory.transactionStatusType.Confirmed,
156
156
  endDate: new Date(),
157
- result: params.result,
157
+ // result: params.result, // resultを更新
158
158
  potentialActions: params.potentialActions
159
159
  }, { new: true })
160
160
  .exec();
@@ -0,0 +1,31 @@
1
+ import { Connection } from 'mongoose';
2
+ import * as factory from '../factory';
3
+ /**
4
+ * コメントリポジトリ
5
+ */
6
+ export declare class MongoRepository {
7
+ private readonly commentModel;
8
+ constructor(connection: Connection);
9
+ static CREATE_MONGO_CONDITIONS(params: factory.creativeWork.comment.ISearchConditions): any[];
10
+ /**
11
+ * 検索
12
+ */
13
+ search(params: factory.creativeWork.comment.ISearchConditions): Promise<factory.creativeWork.comment.IComment[]>;
14
+ findById(params: {
15
+ id: string;
16
+ }): Promise<factory.creativeWork.comment.IComment>;
17
+ create(params: factory.creativeWork.comment.IComment): Promise<factory.creativeWork.comment.IComment>;
18
+ updateById(params: {
19
+ id?: string;
20
+ attributes: {
21
+ text: string;
22
+ };
23
+ }): Promise<void>;
24
+ /**
25
+ * 削除する
26
+ */
27
+ deleteById(params: {
28
+ id: string;
29
+ }): Promise<void>;
30
+ getCursor(conditions: any, projection: any): import("mongoose").QueryCursor<any>;
31
+ }
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.MongoRepository = void 0;
13
+ const comments_1 = require("./mongoose/model/comments");
14
+ const factory = require("../factory");
15
+ /**
16
+ * コメントリポジトリ
17
+ */
18
+ class MongoRepository {
19
+ constructor(connection) {
20
+ this.commentModel = connection.model(comments_1.modelName);
21
+ }
22
+ static CREATE_MONGO_CONDITIONS(params) {
23
+ var _a, _b, _c, _d, _e, _f;
24
+ const andConditions = [];
25
+ const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
26
+ if (typeof projectIdEq === 'string') {
27
+ andConditions.push({ 'project.id': { $eq: projectIdEq } });
28
+ }
29
+ const aboutIdEq = (_d = (_c = params.about) === null || _c === void 0 ? void 0 : _c.id) === null || _d === void 0 ? void 0 : _d.$eq;
30
+ if (typeof aboutIdEq === 'string') {
31
+ andConditions.push({ 'about.id': { $exists: true, $eq: aboutIdEq } });
32
+ }
33
+ const aboutIdIn = (_f = (_e = params.about) === null || _e === void 0 ? void 0 : _e.id) === null || _f === void 0 ? void 0 : _f.$in;
34
+ if (Array.isArray(aboutIdIn)) {
35
+ andConditions.push({ 'about.id': { $exists: true, $in: aboutIdIn } });
36
+ }
37
+ return andConditions;
38
+ }
39
+ /**
40
+ * 検索
41
+ */
42
+ search(params) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
45
+ const query = this.commentModel.find((conditions.length > 0) ? { $and: conditions } : {}, {
46
+ __v: 0,
47
+ createdAt: 0,
48
+ updatedAt: 0
49
+ });
50
+ if (typeof params.limit === 'number') {
51
+ const page = (typeof params.page === 'number') ? params.page : 1;
52
+ query.limit(params.limit)
53
+ .skip(params.limit * (page - 1));
54
+ }
55
+ // tslint:disable-next-line:no-single-line-block-comment
56
+ /* istanbul ignore else */
57
+ if (params.sort !== undefined) {
58
+ query.sort(params.sort);
59
+ }
60
+ return query.setOptions({ maxTimeMS: 10000 })
61
+ .exec()
62
+ .then((docs) => docs.map((doc) => doc.toObject()));
63
+ });
64
+ }
65
+ findById(params) {
66
+ return __awaiter(this, void 0, void 0, function* () {
67
+ const doc = yield this.commentModel.findOne({ _id: params.id }, {
68
+ __v: 0,
69
+ createdAt: 0,
70
+ updatedAt: 0
71
+ })
72
+ .exec();
73
+ if (doc === null) {
74
+ throw new factory.errors.NotFound(this.commentModel.modelName);
75
+ }
76
+ return doc.toObject();
77
+ });
78
+ }
79
+ create(params) {
80
+ return __awaiter(this, void 0, void 0, function* () {
81
+ const creatingDoc = Object.assign({ about: params.about, author: params.author, dateCreated: new Date(), project: params.project, text: params.text, typeOf: factory.creativeWorkType.Comment }, (Array.isArray(params.additionalProperty)) ? { additionalProperty: params.additionalProperty } : undefined);
82
+ const doc = yield this.commentModel.create(creatingDoc);
83
+ return doc.toObject();
84
+ });
85
+ }
86
+ updateById(params) {
87
+ return __awaiter(this, void 0, void 0, function* () {
88
+ const updateFields = {
89
+ $set: Object.assign({ dateModified: new Date() }, (typeof params.attributes.text === 'string') ? { text: params.attributes.text } : undefined)
90
+ };
91
+ const doc = yield this.commentModel.findOneAndUpdate({ _id: params.id }, updateFields, { upsert: false, new: true })
92
+ .exec();
93
+ if (doc === null) {
94
+ throw new factory.errors.NotFound(this.commentModel.modelName);
95
+ }
96
+ });
97
+ }
98
+ /**
99
+ * 削除する
100
+ */
101
+ deleteById(params) {
102
+ return __awaiter(this, void 0, void 0, function* () {
103
+ yield this.commentModel.findOneAndRemove({ _id: params.id })
104
+ .exec();
105
+ });
106
+ }
107
+ getCursor(conditions, projection) {
108
+ return this.commentModel.find(conditions, projection)
109
+ .sort({ codeValue: factory.sortType.Ascending })
110
+ .cursor();
111
+ }
112
+ }
113
+ exports.MongoRepository = MongoRepository;
@@ -466,14 +466,18 @@ class MongoRepository {
466
466
  if (Array.isArray(params)) {
467
467
  params.forEach((creatingEventParams) => {
468
468
  var _a, _b;
469
+ if (creatingEventParams.attributes.typeOf !== factory.eventType.ScreeningEvent) {
470
+ throw new factory.errors.NotImplemented(`${factory.eventType.ScreeningEventSeries} not implemented`);
471
+ }
469
472
  const additionalPropertyValue = (_b = (_a = creatingEventParams.attributes.additionalProperty) === null || _a === void 0 ? void 0 : _a.find((property) => property.name === creatingEventParams.filter.name)) === null || _b === void 0 ? void 0 : _b.value;
470
473
  if (typeof additionalPropertyValue !== 'string') {
471
474
  throw new factory.errors.NotFound('additionalProperty.value');
472
475
  }
476
+ const _c = creatingEventParams.attributes, { identifier, project, superEvent, workPerformed, typeOf, location, name, remainingAttendeeCapacity, maximumAttendeeCapacity } = _c, updateFields = __rest(_c, ["identifier", "project", "superEvent", "workPerformed", "typeOf", "location", "name", "remainingAttendeeCapacity", "maximumAttendeeCapacity"]);
473
477
  bulkWriteOps.push({
474
478
  updateOne: {
475
479
  filter: {
476
- typeOf: creatingEventParams.attributes.typeOf,
480
+ typeOf,
477
481
  // 追加特性をキーに更新
478
482
  additionalProperty: {
479
483
  $exists: true,
@@ -481,7 +485,18 @@ class MongoRepository {
481
485
  }
482
486
  },
483
487
  update: {
484
- $setOnInsert: Object.assign({ _id: uniqid() }, creatingEventParams.attributes)
488
+ $setOnInsert: {
489
+ _id: uniqid(),
490
+ typeOf,
491
+ project,
492
+ superEvent,
493
+ workPerformed,
494
+ location,
495
+ name
496
+ // ...creatingEventParams.attributes
497
+ },
498
+ // 変更可能な属性のみ上書き
499
+ $set: updateFields
485
500
  },
486
501
  upsert: true
487
502
  }
@@ -1,7 +1,7 @@
1
1
  import * as mongoose from 'mongoose';
2
- declare const modelName = "AccountAction";
2
+ declare const modelName = "CreativeWork";
3
3
  /**
4
- * アクションスキーマ
4
+ * コメントスキーマ
5
5
  */
6
6
  declare const schema: mongoose.Schema<mongoose.Document<any, any, any>, mongoose.Model<mongoose.Document<any, any, any>, any, any>, undefined, {}>;
7
7
  export { modelName, schema };
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.schema = exports.modelName = void 0;
4
+ const mongoose = require("mongoose");
5
+ const modelName = 'CreativeWork';
6
+ exports.modelName = modelName;
7
+ const writeConcern = { j: true, w: 'majority', wtimeout: 10000 };
8
+ /**
9
+ * コメントスキーマ
10
+ */
11
+ const schema = new mongoose.Schema({
12
+ project: mongoose.SchemaTypes.Mixed,
13
+ typeOf: {
14
+ type: String,
15
+ required: true
16
+ },
17
+ about: mongoose.SchemaTypes.Mixed,
18
+ additionalProperty: [mongoose.SchemaTypes.Mixed],
19
+ author: mongoose.SchemaTypes.Mixed,
20
+ // commnet: Comment[]
21
+ commentCount: { type: Number, default: 0 },
22
+ dateCreated: Date,
23
+ dateModified: Date,
24
+ text: {
25
+ type: String,
26
+ required: true
27
+ }
28
+ }, {
29
+ collection: 'comments',
30
+ id: true,
31
+ read: 'primaryPreferred',
32
+ writeConcern: writeConcern,
33
+ strict: true,
34
+ useNestedStrict: true,
35
+ timestamps: {
36
+ createdAt: 'createdAt',
37
+ updatedAt: 'updatedAt'
38
+ },
39
+ toJSON: {
40
+ getters: false,
41
+ virtuals: false,
42
+ minimize: false,
43
+ versionKey: false
44
+ },
45
+ toObject: {
46
+ getters: false,
47
+ virtuals: true,
48
+ minimize: false,
49
+ versionKey: false
50
+ }
51
+ });
52
+ exports.schema = schema;
53
+ schema.index({ createdAt: 1 }, { name: 'searchByCreatedAt' });
54
+ schema.index({ updatedAt: 1 }, { name: 'searchByUpdatedAt' });
55
+ schema.index({ dateCreated: 1 }, {
56
+ name: 'searchByDateCreated'
57
+ });
58
+ schema.index({ 'project.id': 1, dateCreated: 1 }, {
59
+ name: 'searchByProjectId'
60
+ });
61
+ schema.index({ 'about.id': 1, dateCreated: 1 }, {
62
+ name: 'searchByAboutId',
63
+ partialFilterExpression: {
64
+ 'about.id': { $exists: true }
65
+ }
66
+ });
67
+ schema.index({ additionalProperty: 1, dateCreated: 1 }, {
68
+ name: 'searchByAdditionalProperty',
69
+ partialFilterExpression: {
70
+ additionalProperty: { $exists: true }
71
+ }
72
+ });
73
+ mongoose.model(modelName, schema)
74
+ .on('index',
75
+ // tslint:disable-next-line:no-single-line-block-comment
76
+ /* istanbul ignore next */
77
+ (error) => {
78
+ if (error !== undefined) {
79
+ // tslint:disable-next-line:no-console
80
+ console.error(error);
81
+ }
82
+ });
@@ -32,8 +32,8 @@ const schema = new mongoose.Schema({
32
32
  orderDate: Date,
33
33
  isGift: Boolean,
34
34
  dateReturned: Date,
35
- // ↓追加(2022-04-15~)
36
- orderedItem: [mongoose.SchemaTypes.Mixed]
35
+ orderedItem: [mongoose.SchemaTypes.Mixed],
36
+ additionalProperty: [mongoose.SchemaTypes.Mixed] // 追加(2023-02-13~)
37
37
  }, {
38
38
  collection: 'orders',
39
39
  id: true,
@@ -297,6 +297,12 @@ schema.index({ price: 1, orderDate: -1 }, {
297
297
  price: { $exists: true }
298
298
  }
299
299
  });
300
+ schema.index({ additionalProperty: 1, orderDate: -1 }, {
301
+ name: 'searchByAdditionalProperty',
302
+ partialFilterExpression: {
303
+ additionalProperty: { $exists: true }
304
+ }
305
+ });
300
306
  mongoose.model(modelName, schema)
301
307
  .on('index',
302
308
  // tslint:disable-next-line:no-single-line-block-comment
@@ -33,9 +33,15 @@ export declare class MongoRepository {
33
33
  * 変更可能な属性を更新する
34
34
  */
35
35
  updateChangeableAttributes(params: {
36
+ additionalProperty?: factory.propertyValue.IPropertyValue<string>[];
36
37
  name?: string;
37
38
  orderNumber: string;
38
39
  }): Promise<void>;
40
+ findById(params: {
41
+ id: string;
42
+ inclusion: string[];
43
+ exclusion: string[];
44
+ }): Promise<factory.order.IOrder>;
39
45
  /**
40
46
  * 注文番号から注文を取得する
41
47
  */
@@ -24,7 +24,7 @@ class MongoRepository {
24
24
  }
25
25
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
26
26
  static CREATE_MONGO_CONDITIONS(params) {
27
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7;
27
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11;
28
28
  const andConditions = [];
29
29
  // tslint:disable-next-line:no-single-line-block-comment
30
30
  /* istanbul ignore else */
@@ -39,6 +39,22 @@ class MongoRepository {
39
39
  }
40
40
  }
41
41
  }
42
+ const additionalPropertyAll = (_a = params.additionalProperty) === null || _a === void 0 ? void 0 : _a.$all;
43
+ if (Array.isArray(additionalPropertyAll)) {
44
+ andConditions.push({ additionalProperty: { $exists: true, $all: additionalPropertyAll } });
45
+ }
46
+ const additionalPropertyIn = (_b = params.additionalProperty) === null || _b === void 0 ? void 0 : _b.$in;
47
+ if (Array.isArray(additionalPropertyIn)) {
48
+ andConditions.push({ additionalProperty: { $exists: true, $in: additionalPropertyIn } });
49
+ }
50
+ const additionalPropertyNin = (_c = params.additionalProperty) === null || _c === void 0 ? void 0 : _c.$nin;
51
+ if (Array.isArray(additionalPropertyNin)) {
52
+ andConditions.push({ additionalProperty: { $nin: additionalPropertyNin } });
53
+ }
54
+ const additionalPropertyElemMatch = (_d = params.additionalProperty) === null || _d === void 0 ? void 0 : _d.$elemMatch;
55
+ if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
56
+ andConditions.push({ additionalProperty: { $exists: true, $elemMatch: additionalPropertyElemMatch } });
57
+ }
42
58
  // tslint:disable-next-line:no-single-line-block-comment
43
59
  /* istanbul ignore else */
44
60
  if (params.identifier !== undefined) {
@@ -87,7 +103,7 @@ class MongoRepository {
87
103
  });
88
104
  }
89
105
  }
90
- const brokerIdEq = (_b = (_a = params.broker) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
106
+ const brokerIdEq = (_f = (_e = params.broker) === null || _e === void 0 ? void 0 : _e.id) === null || _f === void 0 ? void 0 : _f.$eq;
91
107
  if (typeof brokerIdEq === 'string') {
92
108
  andConditions.push({
93
109
  'broker.id': {
@@ -304,7 +320,7 @@ class MongoRepository {
304
320
  }
305
321
  }
306
322
  }
307
- const nameEq = (_c = params.name) === null || _c === void 0 ? void 0 : _c.$eq;
323
+ const nameEq = (_g = params.name) === null || _g === void 0 ? void 0 : _g.$eq;
308
324
  if (typeof nameEq === 'string') {
309
325
  andConditions.push({
310
326
  name: {
@@ -313,7 +329,7 @@ class MongoRepository {
313
329
  }
314
330
  });
315
331
  }
316
- const nameRegex = (_d = params.name) === null || _d === void 0 ? void 0 : _d.$regex;
332
+ const nameRegex = (_h = params.name) === null || _h === void 0 ? void 0 : _h.$regex;
317
333
  if (typeof nameRegex === 'string' && nameRegex.length > 0) {
318
334
  andConditions.push({
319
335
  name: {
@@ -346,7 +362,7 @@ class MongoRepository {
346
362
  }
347
363
  });
348
364
  }
349
- const itemOfferedIdentifierIn = (_g = (_f = (_e = params.acceptedOffers) === null || _e === void 0 ? void 0 : _e.itemOffered) === null || _f === void 0 ? void 0 : _f.identifier) === null || _g === void 0 ? void 0 : _g.$in;
365
+ const itemOfferedIdentifierIn = (_l = (_k = (_j = params.acceptedOffers) === null || _j === void 0 ? void 0 : _j.itemOffered) === null || _k === void 0 ? void 0 : _k.identifier) === null || _l === void 0 ? void 0 : _l.$in;
350
366
  if (Array.isArray(itemOfferedIdentifierIn)) {
351
367
  andConditions.push({
352
368
  'acceptedOffers.itemOffered.identifier': {
@@ -355,7 +371,7 @@ class MongoRepository {
355
371
  }
356
372
  });
357
373
  }
358
- const itemOfferedTypeOfIn = (_k = (_j = (_h = params.acceptedOffers) === null || _h === void 0 ? void 0 : _h.itemOffered) === null || _j === void 0 ? void 0 : _j.typeOf) === null || _k === void 0 ? void 0 : _k.$in;
374
+ const itemOfferedTypeOfIn = (_p = (_o = (_m = params.acceptedOffers) === null || _m === void 0 ? void 0 : _m.itemOffered) === null || _o === void 0 ? void 0 : _o.typeOf) === null || _p === void 0 ? void 0 : _p.$in;
359
375
  if (Array.isArray(itemOfferedTypeOfIn)) {
360
376
  andConditions.push({
361
377
  'acceptedOffers.itemOffered.typeOf': {
@@ -364,7 +380,7 @@ class MongoRepository {
364
380
  }
365
381
  });
366
382
  }
367
- const itemOfferedIssuedThroughTypeOfEq = (_p = (_o = (_m = (_l = params.acceptedOffers) === null || _l === void 0 ? void 0 : _l.itemOffered) === null || _m === void 0 ? void 0 : _m.issuedThrough) === null || _o === void 0 ? void 0 : _o.typeOf) === null || _p === void 0 ? void 0 : _p.$eq;
383
+ const itemOfferedIssuedThroughTypeOfEq = (_t = (_s = (_r = (_q = params.acceptedOffers) === null || _q === void 0 ? void 0 : _q.itemOffered) === null || _r === void 0 ? void 0 : _r.issuedThrough) === null || _s === void 0 ? void 0 : _s.typeOf) === null || _t === void 0 ? void 0 : _t.$eq;
368
384
  if (typeof itemOfferedIssuedThroughTypeOfEq === 'string') {
369
385
  andConditions.push({
370
386
  'acceptedOffers.itemOffered.issuedThrough.typeOf': {
@@ -373,7 +389,7 @@ class MongoRepository {
373
389
  }
374
390
  });
375
391
  }
376
- const itemOfferedIssuedThroughIdIn = (_t = (_s = (_r = (_q = params.acceptedOffers) === null || _q === void 0 ? void 0 : _q.itemOffered) === null || _r === void 0 ? void 0 : _r.issuedThrough) === null || _s === void 0 ? void 0 : _s.id) === null || _t === void 0 ? void 0 : _t.$in;
392
+ const itemOfferedIssuedThroughIdIn = (_x = (_w = (_v = (_u = params.acceptedOffers) === null || _u === void 0 ? void 0 : _u.itemOffered) === null || _v === void 0 ? void 0 : _v.issuedThrough) === null || _w === void 0 ? void 0 : _w.id) === null || _x === void 0 ? void 0 : _x.$in;
377
393
  if (Array.isArray(itemOfferedIssuedThroughIdIn)) {
378
394
  andConditions.push({
379
395
  'acceptedOffers.itemOffered.issuedThrough.id': {
@@ -382,7 +398,7 @@ class MongoRepository {
382
398
  }
383
399
  });
384
400
  }
385
- const itemOfferedProgramMembershipUsedIdentifierEq = (_x = (_w = (_v = (_u = params.acceptedOffers) === null || _u === void 0 ? void 0 : _u.itemOffered) === null || _v === void 0 ? void 0 : _v.programMembershipUsed) === null || _w === void 0 ? void 0 : _w.identifier) === null || _x === void 0 ? void 0 : _x.$eq;
401
+ const itemOfferedProgramMembershipUsedIdentifierEq = (_1 = (_0 = (_z = (_y = params.acceptedOffers) === null || _y === void 0 ? void 0 : _y.itemOffered) === null || _z === void 0 ? void 0 : _z.programMembershipUsed) === null || _0 === void 0 ? void 0 : _0.identifier) === null || _1 === void 0 ? void 0 : _1.$eq;
386
402
  if (typeof itemOfferedProgramMembershipUsedIdentifierEq === 'string') {
387
403
  andConditions.push({
388
404
  'acceptedOffers.itemOffered.programMembershipUsed.identifier': {
@@ -391,7 +407,7 @@ class MongoRepository {
391
407
  }
392
408
  });
393
409
  }
394
- const itemOfferedProgramMembershipUsedIssuedThroughServiceTypeCodeValueEq = (_3 = (_2 = (_1 = (_0 = (_z = (_y = params.acceptedOffers) === null || _y === void 0 ? void 0 : _y.itemOffered) === null || _z === void 0 ? void 0 : _z.programMembershipUsed) === null || _0 === void 0 ? void 0 : _0.issuedThrough) === null || _1 === void 0 ? void 0 : _1.serviceType) === null || _2 === void 0 ? void 0 : _2.codeValue) === null || _3 === void 0 ? void 0 : _3.$eq;
410
+ const itemOfferedProgramMembershipUsedIssuedThroughServiceTypeCodeValueEq = (_7 = (_6 = (_5 = (_4 = (_3 = (_2 = params.acceptedOffers) === null || _2 === void 0 ? void 0 : _2.itemOffered) === null || _3 === void 0 ? void 0 : _3.programMembershipUsed) === null || _4 === void 0 ? void 0 : _4.issuedThrough) === null || _5 === void 0 ? void 0 : _5.serviceType) === null || _6 === void 0 ? void 0 : _6.codeValue) === null || _7 === void 0 ? void 0 : _7.$eq;
395
411
  if (typeof itemOfferedProgramMembershipUsedIssuedThroughServiceTypeCodeValueEq === 'string') {
396
412
  andConditions.push({
397
413
  'acceptedOffers.itemOffered.programMembershipUsed.issuedThrough.serviceType.codeValue': {
@@ -587,7 +603,7 @@ class MongoRepository {
587
603
  });
588
604
  }
589
605
  }
590
- const paymentMethodAdditionalPropertyAll = (_5 = (_4 = params.paymentMethods) === null || _4 === void 0 ? void 0 : _4.additionalProperty) === null || _5 === void 0 ? void 0 : _5.$all;
606
+ const paymentMethodAdditionalPropertyAll = (_9 = (_8 = params.paymentMethods) === null || _8 === void 0 ? void 0 : _8.additionalProperty) === null || _9 === void 0 ? void 0 : _9.$all;
591
607
  if (Array.isArray(paymentMethodAdditionalPropertyAll)) {
592
608
  andConditions.push({
593
609
  'paymentMethods.additionalProperty': {
@@ -596,7 +612,7 @@ class MongoRepository {
596
612
  }
597
613
  });
598
614
  }
599
- const paymentMethodAdditionalPropertyIn = (_7 = (_6 = params.paymentMethods) === null || _6 === void 0 ? void 0 : _6.additionalProperty) === null || _7 === void 0 ? void 0 : _7.$in;
615
+ const paymentMethodAdditionalPropertyIn = (_11 = (_10 = params.paymentMethods) === null || _10 === void 0 ? void 0 : _10.additionalProperty) === null || _11 === void 0 ? void 0 : _11.$in;
600
616
  if (Array.isArray(paymentMethodAdditionalPropertyIn)) {
601
617
  andConditions.push({
602
618
  'paymentMethods.additionalProperty': {
@@ -761,17 +777,45 @@ class MongoRepository {
761
777
  */
762
778
  updateChangeableAttributes(params) {
763
779
  return __awaiter(this, void 0, void 0, function* () {
764
- const doc = yield this.orderModel.findOneAndUpdate({ orderNumber: { $eq: params.orderNumber } }, Object.assign({}, (typeof params.name === 'string') ? { name: params.name } : undefined), {
780
+ const doc = yield this.orderModel.findOneAndUpdate({ orderNumber: { $eq: params.orderNumber } }, {
781
+ $set: Object.assign(Object.assign({}, (Array.isArray(params.additionalProperty)) ? { additionalProperty: params.additionalProperty } : undefined), (typeof params.name === 'string') ? { name: params.name } : undefined)
782
+ }, {
765
783
  projection: {
784
+ _id: 1
785
+ }
786
+ })
787
+ .exec();
788
+ if (doc === null) {
789
+ throw new factory.errors.NotFound(this.orderModel.modelName);
790
+ }
791
+ });
792
+ }
793
+ findById(params) {
794
+ return __awaiter(this, void 0, void 0, function* () {
795
+ let projection = {};
796
+ if (Array.isArray(params.inclusion) && params.inclusion.length > 0) {
797
+ params.inclusion.forEach((field) => {
798
+ projection[field] = 1;
799
+ });
800
+ }
801
+ else {
802
+ projection = {
766
803
  __v: 0,
767
804
  createdAt: 0,
768
805
  updatedAt: 0
806
+ };
807
+ if (Array.isArray(params.exclusion) && params.exclusion.length > 0) {
808
+ params.exclusion.forEach((field) => {
809
+ projection[field] = 0;
810
+ });
769
811
  }
770
- })
812
+ }
813
+ const doc = yield this.orderModel.findById({ _id: params.id }, projection)
771
814
  .exec();
772
815
  if (doc === null) {
773
816
  throw new factory.errors.NotFound(this.orderModel.modelName);
774
817
  }
818
+ return doc.toObject();
775
819
  });
776
820
  }
777
821
  /**
@@ -48,9 +48,6 @@ import { CognitoRepository as PersonRepo } from './repo/person';
48
48
  */
49
49
  export declare class Account extends AccountRepo {
50
50
  }
51
- /**
52
- * 口座アクションリポジトリ
53
- */
54
51
  /**
55
52
  * 経理レポートリポジトリ
56
53
  */
@@ -53,10 +53,6 @@ const person_1 = require("./repo/person");
53
53
  class Account extends account_1.MongoRepository {
54
54
  }
55
55
  exports.Account = Account;
56
- /**
57
- * 口座アクションリポジトリ
58
- */
59
- // export class AccountAction extends AccountActionRepo { }
60
56
  /**
61
57
  * 経理レポートリポジトリ
62
58
  */
@@ -53,12 +53,6 @@ exports.close = close;
53
53
  */
54
54
  function transferMoney(actionAttributes) {
55
55
  return (repos) => __awaiter(this, void 0, void 0, function* () {
56
- // 口座取引におけるAccountAction管理を廃止(2022-11-28~)
57
- // let action = await repos.accountAction.startByIdentifier<factory.actionType.MoneyTransfer>(actionAttributes);
58
- // すでに完了していれば何もしない
59
- // if (action.actionStatus === factory.actionStatusType.CompletedActionStatus) {
60
- // return;
61
- // }
62
56
  const action = actionAttributes;
63
57
  let fromAccountNumber;
64
58
  let toAccountNumber;
@@ -81,18 +75,8 @@ function transferMoney(actionAttributes) {
81
75
  });
82
76
  }
83
77
  catch (error) {
84
- // actionにエラー結果を追加
85
- // try {
86
- // const actionError = { ...error, message: error.message, name: error.name };
87
- // await repos.accountAction.giveUp(action.typeOf, action.id, actionError);
88
- // } catch (__) {
89
- // // 失敗したら仕方ない
90
- // }
91
78
  throw error;
92
79
  }
93
- // アクション完了
94
- // const actionResult: factory.account.action.moneyTransfer.IResult = {};
95
- // action = await repos.accountAction.complete(action.typeOf, action.id, actionResult);
96
80
  });
97
81
  }
98
82
  exports.transferMoney = transferMoney;
@@ -133,17 +117,6 @@ function cancelMoneyTransfer(params) {
133
117
  : transaction.object.amount.value,
134
118
  transactionId: transaction.id
135
119
  });
136
- // 口座取引におけるAccountAction管理を廃止(2022-11-28~)
137
- // アクション取得
138
- // const actions = await repos.accountAction.searchTransferActions({
139
- // purpose: {
140
- // typeOf: { $eq: transaction.typeOf },
141
- // id: { $eq: transaction.id }
142
- // }
143
- // });
144
- // await Promise.all(actions.map(async (action) => {
145
- // await repos.accountAction.cancel(action.typeOf, action.id);
146
- // }));
147
120
  });
148
121
  }
149
122
  exports.cancelMoneyTransfer = cancelMoneyTransfer;
@@ -63,10 +63,6 @@ function start(params) {
63
63
  accountNumber: params.object.toLocation.accountNumber,
64
64
  transaction: pendingTransaction
65
65
  });
66
- // 口座取引におけるAccountAction管理を廃止(2022-11-28~)
67
- // アクション開始
68
- // const moneyTransferActionAttributes = createMoneyTransferActionAttributes({ transaction });
69
- // await repos.accountAction.startByIdentifier(moneyTransferActionAttributes);
70
66
  // 結果返却
71
67
  return transaction;
72
68
  });