@chevre/domain 20.1.0-alpha.20 → 20.1.0-alpha.22

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.
@@ -12,6 +12,7 @@ async function main() {
12
12
  await mongoose.connect(<string>process.env.MONGOLAB_URI);
13
13
 
14
14
  const eventRepo = new chevre.repository.Event(mongoose.connection);
15
+ const additionalPropertyRepo = new chevre.repository.AdditionalProperty(mongoose.connection);
15
16
 
16
17
  const cursor = eventRepo.getCursor(
17
18
  {
@@ -36,7 +37,7 @@ async function main() {
36
37
  const projectIds: string[] = [];
37
38
 
38
39
  let i = 0;
39
- const updateCount = 0;
40
+ let updateCount = 0;
40
41
  await cursor.eachAsync(async (doc) => {
41
42
  i += 1;
42
43
  const event: chevre.factory.event.screeningEventSeries.IEvent = doc.toObject();
@@ -55,6 +56,33 @@ async function main() {
55
56
  throw new Error(`length matched ${event.project.id} ${event.id} ${name}`);
56
57
  }
57
58
  });
59
+
60
+ for (const additionalPropertyNameOnEvent of additionalPropertyNamesOnEvent) {
61
+ const existings = await additionalPropertyRepo.search({
62
+ project: { id: { $eq: event.project.id } },
63
+ limit: 1,
64
+ page: 1,
65
+ name: { $regex: `^${additionalPropertyNameOnEvent}$` }
66
+ });
67
+ if (existings.length > 0) {
68
+ console.log('already existed', additionalPropertyNameOnEvent, event.id, event.project.id);
69
+ } else {
70
+ updateCount += 1;
71
+ await additionalPropertyRepo.save({
72
+ attributes: {
73
+ project: event.project,
74
+ typeOf: 'CategoryCode',
75
+ codeValue: additionalPropertyNameOnEvent,
76
+ inCodeSet: {
77
+ typeOf: 'CategoryCodeSet',
78
+ identifier: <any>event.typeOf
79
+ },
80
+ name: { ja: additionalPropertyNameOnEvent }
81
+ }
82
+ });
83
+ console.log('created', additionalPropertyNameOnEvent, event.id, event.project.id);
84
+ }
85
+ }
58
86
  }
59
87
  });
60
88
  console.log(i, 'events checked');
@@ -1,23 +1,23 @@
1
1
  import { Connection } from 'mongoose';
2
2
  import * as factory from '../factory';
3
3
  /**
4
- * 追加特性名称リポジトリ
4
+ * 追加特性リポジトリ
5
5
  */
6
6
  export declare class MongoRepository {
7
- private readonly additionalPropertyNameModel;
7
+ private readonly additionalPropertyModel;
8
8
  constructor(connection: Connection);
9
- static CREATE_MONGO_CONDITIONS(params: factory.categoryCode.ISearchConditions): any[];
9
+ static CREATE_MONGO_CONDITIONS(params: factory.additionalProperty.ISearchConditions): any[];
10
10
  /**
11
11
  * 検索
12
12
  */
13
- search(params: factory.categoryCode.ISearchConditions): Promise<factory.categoryCode.ICategoryCode[]>;
13
+ search(params: factory.additionalProperty.ISearchConditions): Promise<factory.additionalProperty.IAdditionalProperty[]>;
14
14
  findById(params: {
15
15
  id: string;
16
- }): Promise<factory.categoryCode.ICategoryCode>;
16
+ }): Promise<factory.additionalProperty.IAdditionalProperty>;
17
17
  save(params: {
18
18
  id?: string;
19
- attributes: factory.categoryCode.ICategoryCode;
20
- }): Promise<factory.categoryCode.ICategoryCode>;
19
+ attributes: factory.additionalProperty.IAdditionalProperty;
20
+ }): Promise<factory.additionalProperty.IAdditionalProperty>;
21
21
  /**
22
22
  * 削除する
23
23
  */
@@ -21,14 +21,14 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
- const additionalPropertyName_1 = require("./mongoose/model/additionalPropertyName");
24
+ const additionalProperty_1 = require("./mongoose/model/additionalProperty");
25
25
  const factory = require("../factory");
26
26
  /**
27
- * 追加特性名称リポジトリ
27
+ * 追加特性リポジトリ
28
28
  */
29
29
  class MongoRepository {
30
30
  constructor(connection) {
31
- this.additionalPropertyNameModel = connection.model(additionalPropertyName_1.modelName);
31
+ this.additionalPropertyModel = connection.model(additionalProperty_1.modelName);
32
32
  }
33
33
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
34
34
  static CREATE_MONGO_CONDITIONS(params) {
@@ -124,19 +124,13 @@ class MongoRepository {
124
124
  }
125
125
  return andConditions;
126
126
  }
127
- // public async count(params: factory.categoryCode.ISearchConditions): Promise<number> {
128
- // const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
129
- // return this.additionalPropertyNameModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
130
- // .setOptions({ maxTimeMS: 10000 })
131
- // .exec();
132
- // }
133
127
  /**
134
128
  * 検索
135
129
  */
136
130
  search(params) {
137
131
  return __awaiter(this, void 0, void 0, function* () {
138
132
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
139
- const query = this.additionalPropertyNameModel.find((conditions.length > 0) ? { $and: conditions } : {}, {
133
+ const query = this.additionalPropertyModel.find((conditions.length > 0) ? { $and: conditions } : {}, {
140
134
  __v: 0,
141
135
  createdAt: 0,
142
136
  updatedAt: 0
@@ -158,14 +152,14 @@ class MongoRepository {
158
152
  }
159
153
  findById(params) {
160
154
  return __awaiter(this, void 0, void 0, function* () {
161
- const doc = yield this.additionalPropertyNameModel.findOne({ _id: params.id }, {
155
+ const doc = yield this.additionalPropertyModel.findOne({ _id: params.id }, {
162
156
  __v: 0,
163
157
  createdAt: 0,
164
158
  updatedAt: 0
165
159
  })
166
160
  .exec();
167
161
  if (doc === null) {
168
- throw new factory.errors.NotFound(this.additionalPropertyNameModel.modelName);
162
+ throw new factory.errors.NotFound(this.additionalPropertyModel.modelName);
169
163
  }
170
164
  return doc.toObject();
171
165
  });
@@ -174,15 +168,15 @@ class MongoRepository {
174
168
  return __awaiter(this, void 0, void 0, function* () {
175
169
  let doc;
176
170
  if (typeof params.id !== 'string') {
177
- doc = yield this.additionalPropertyNameModel.create(params.attributes);
171
+ doc = yield this.additionalPropertyModel.create(params.attributes);
178
172
  }
179
173
  else {
180
174
  const _a = params.attributes, { id, codeValue, inCodeSet, project, typeOf } = _a, updateFields = __rest(_a, ["id", "codeValue", "inCodeSet", "project", "typeOf"]);
181
- doc = yield this.additionalPropertyNameModel.findOneAndUpdate({ _id: params.id }, updateFields, { upsert: false, new: true })
175
+ doc = yield this.additionalPropertyModel.findOneAndUpdate({ _id: params.id }, updateFields, { upsert: false, new: true })
182
176
  .exec();
183
177
  }
184
178
  if (doc === null) {
185
- throw new factory.errors.NotFound(this.additionalPropertyNameModel.modelName);
179
+ throw new factory.errors.NotFound(this.additionalPropertyModel.modelName);
186
180
  }
187
181
  return doc.toObject();
188
182
  });
@@ -192,7 +186,7 @@ class MongoRepository {
192
186
  */
193
187
  deleteById(params) {
194
188
  return __awaiter(this, void 0, void 0, function* () {
195
- yield this.additionalPropertyNameModel.findOneAndRemove({ _id: params.id })
189
+ yield this.additionalPropertyModel.findOneAndRemove({ _id: params.id })
196
190
  .exec();
197
191
  });
198
192
  }
@@ -201,7 +195,7 @@ class MongoRepository {
201
195
  */
202
196
  deleteByProject(params) {
203
197
  return __awaiter(this, void 0, void 0, function* () {
204
- yield this.additionalPropertyNameModel.deleteMany({
198
+ yield this.additionalPropertyModel.deleteMany({
205
199
  'project.id': { $eq: params.project.id }
206
200
  })
207
201
  .exec();
@@ -34,7 +34,7 @@ class MongoRepository {
34
34
  }
35
35
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
36
36
  static CREATE_MONGO_CONDITIONS(conditions) {
37
- 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;
37
+ 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;
38
38
  const andConditions = [{ typeOf: { $eq: conditions.typeOf } }];
39
39
  const projectIdEq = (_b = (_a = conditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
40
40
  if (typeof projectIdEq === 'string') {
@@ -119,6 +119,15 @@ class MongoRepository {
119
119
  }
120
120
  });
121
121
  }
122
+ const additionalPropertyElemMatch = (_h = conditions.additionalProperty) === null || _h === void 0 ? void 0 : _h.$elemMatch;
123
+ if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
124
+ andConditions.push({
125
+ additionalProperty: {
126
+ $exists: true,
127
+ $elemMatch: additionalPropertyElemMatch
128
+ }
129
+ });
130
+ }
122
131
  let params;
123
132
  switch (conditions.typeOf) {
124
133
  case factory.eventType.ScreeningEvent:
@@ -145,7 +154,7 @@ class MongoRepository {
145
154
  }
146
155
  // tslint:disable-next-line:no-single-line-block-comment
147
156
  /* istanbul ignore else */
148
- const superEventLocationIdEq = (_k = (_j = (_h = params.superEvent) === null || _h === void 0 ? void 0 : _h.location) === null || _j === void 0 ? void 0 : _j.id) === null || _k === void 0 ? void 0 : _k.$eq;
157
+ const superEventLocationIdEq = (_l = (_k = (_j = params.superEvent) === null || _j === void 0 ? void 0 : _j.location) === null || _k === void 0 ? void 0 : _k.id) === null || _l === void 0 ? void 0 : _l.$eq;
149
158
  if (typeof superEventLocationIdEq === 'string') {
150
159
  andConditions.push({
151
160
  'superEvent.location.id': {
@@ -233,7 +242,7 @@ class MongoRepository {
233
242
  });
234
243
  }
235
244
  }
236
- const itemOfferedIdIn = (_m = (_l = params.offers.itemOffered) === null || _l === void 0 ? void 0 : _l.id) === null || _m === void 0 ? void 0 : _m.$in;
245
+ const itemOfferedIdIn = (_o = (_m = params.offers.itemOffered) === null || _m === void 0 ? void 0 : _m.id) === null || _o === void 0 ? void 0 : _o.$in;
237
246
  if (Array.isArray(itemOfferedIdIn)) {
238
247
  andConditions.push({
239
248
  'offers.itemOffered.id': {
@@ -283,8 +292,8 @@ class MongoRepository {
283
292
  }
284
293
  }
285
294
  }
286
- const sellerMakesOfferElemMatch = (_q = (_p = (_o = params.offers) === null || _o === void 0 ? void 0 : _o.seller) === null || _p === void 0 ? void 0 : _p.makesOffer) === null || _q === void 0 ? void 0 : _q.$elemMatch;
287
- if (typeof ((_r = sellerMakesOfferElemMatch === null || sellerMakesOfferElemMatch === void 0 ? void 0 : sellerMakesOfferElemMatch['availableAtOrFrom.id']) === null || _r === void 0 ? void 0 : _r.$eq) === 'string') {
295
+ const sellerMakesOfferElemMatch = (_r = (_q = (_p = params.offers) === null || _p === void 0 ? void 0 : _p.seller) === null || _q === void 0 ? void 0 : _q.makesOffer) === null || _r === void 0 ? void 0 : _r.$elemMatch;
296
+ if (typeof ((_s = sellerMakesOfferElemMatch === null || sellerMakesOfferElemMatch === void 0 ? void 0 : sellerMakesOfferElemMatch['availableAtOrFrom.id']) === null || _s === void 0 ? void 0 : _s.$eq) === 'string') {
288
297
  andConditions.push({
289
298
  'offers.seller.makesOffer': {
290
299
  $exists: true,
@@ -321,7 +330,7 @@ class MongoRepository {
321
330
  ]
322
331
  });
323
332
  }
324
- const locationIdEq = (_t = (_s = params.location) === null || _s === void 0 ? void 0 : _s.id) === null || _t === void 0 ? void 0 : _t.$eq;
333
+ const locationIdEq = (_u = (_t = params.location) === null || _t === void 0 ? void 0 : _t.id) === null || _u === void 0 ? void 0 : _u.$eq;
325
334
  // tslint:disable-next-line:no-single-line-block-comment
326
335
  /* istanbul ignore else */
327
336
  if (typeof locationIdEq === 'string') {
@@ -343,7 +352,7 @@ class MongoRepository {
343
352
  });
344
353
  }
345
354
  }
346
- const workPerformedIdentifierIn = (_u = params.workPerformed) === null || _u === void 0 ? void 0 : _u.identifiers;
355
+ const workPerformedIdentifierIn = (_v = params.workPerformed) === null || _v === void 0 ? void 0 : _v.identifiers;
347
356
  // tslint:disable-next-line:no-single-line-block-comment
348
357
  /* istanbul ignore else */
349
358
  if (Array.isArray(workPerformedIdentifierIn)) {
@@ -354,7 +363,7 @@ class MongoRepository {
354
363
  }
355
364
  });
356
365
  }
357
- const videoFormatTypeOfEq = (_w = (_v = params.videoFormat) === null || _v === void 0 ? void 0 : _v.typeOf) === null || _w === void 0 ? void 0 : _w.$eq;
366
+ const videoFormatTypeOfEq = (_x = (_w = params.videoFormat) === null || _w === void 0 ? void 0 : _w.typeOf) === null || _x === void 0 ? void 0 : _x.$eq;
358
367
  if (typeof videoFormatTypeOfEq === 'string') {
359
368
  andConditions.push({
360
369
  'videoFormat.typeOf': {
@@ -363,7 +372,7 @@ class MongoRepository {
363
372
  }
364
373
  });
365
374
  }
366
- const videoFormatTypeOfIn = (_y = (_x = params.videoFormat) === null || _x === void 0 ? void 0 : _x.typeOf) === null || _y === void 0 ? void 0 : _y.$in;
375
+ const videoFormatTypeOfIn = (_z = (_y = params.videoFormat) === null || _y === void 0 ? void 0 : _y.typeOf) === null || _z === void 0 ? void 0 : _z.$in;
367
376
  if (Array.isArray(videoFormatTypeOfIn)) {
368
377
  andConditions.push({
369
378
  'videoFormat.typeOf': {
@@ -372,7 +381,7 @@ class MongoRepository {
372
381
  }
373
382
  });
374
383
  }
375
- const soundFormatTypeOfEq = (_0 = (_z = params.soundFormat) === null || _z === void 0 ? void 0 : _z.typeOf) === null || _0 === void 0 ? void 0 : _0.$eq;
384
+ const soundFormatTypeOfEq = (_1 = (_0 = params.soundFormat) === null || _0 === void 0 ? void 0 : _0.typeOf) === null || _1 === void 0 ? void 0 : _1.$eq;
376
385
  if (typeof soundFormatTypeOfEq === 'string') {
377
386
  andConditions.push({
378
387
  'soundFormat.typeOf': {
@@ -381,7 +390,7 @@ class MongoRepository {
381
390
  }
382
391
  });
383
392
  }
384
- const soundFormatTypeOfIn = (_2 = (_1 = params.soundFormat) === null || _1 === void 0 ? void 0 : _1.typeOf) === null || _2 === void 0 ? void 0 : _2.$in;
393
+ const soundFormatTypeOfIn = (_3 = (_2 = params.soundFormat) === null || _2 === void 0 ? void 0 : _2.typeOf) === null || _3 === void 0 ? void 0 : _3.$in;
385
394
  if (Array.isArray(soundFormatTypeOfIn)) {
386
395
  andConditions.push({
387
396
  'soundFormat.typeOf': {
@@ -1,7 +1,7 @@
1
1
  import * as mongoose from 'mongoose';
2
- declare const modelName = "AdditionalPropertyNam";
2
+ declare const modelName = "AdditionalProperty";
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 };
@@ -2,11 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose = require("mongoose");
5
- const modelName = 'AdditionalPropertyNam';
5
+ const modelName = 'AdditionalProperty';
6
6
  exports.modelName = modelName;
7
7
  const writeConcern = { j: true, w: 'majority', wtimeout: 10000 };
8
8
  /**
9
- * 追加特性名称スキーマ
9
+ * 追加特性スキーマ
10
10
  */
11
11
  const schema = new mongoose.Schema({
12
12
  project: mongoose.SchemaTypes.Mixed,
@@ -21,7 +21,7 @@ const schema = new mongoose.Schema({
21
21
  inCodeSet: mongoose.SchemaTypes.Mixed,
22
22
  name: mongoose.SchemaTypes.Mixed
23
23
  }, {
24
- collection: 'additionalPropertyNames',
24
+ collection: 'additionalProperties',
25
25
  id: true,
26
26
  read: 'primaryPreferred',
27
27
  writeConcern: writeConcern,
@@ -7,7 +7,7 @@ import { MongoRepository as AccountingReportRepo } from './repo/accountingReport
7
7
  import { MongoRepository as AccountTitleRepo } from './repo/accountTitle';
8
8
  import { MongoRepository as AccountTransactionRepo } from './repo/accountTransaction';
9
9
  import { MongoRepository as ActionRepo } from './repo/action';
10
- import { MongoRepository as AdditionalPropertyNameRepo } from './repo/additionalPropertyName';
10
+ import { MongoRepository as AdditionalPropertyRepo } from './repo/additionalProperty';
11
11
  import { MongoRepository as AssetTransactionRepo } from './repo/assetTransaction';
12
12
  import { MongoRepository as CategoryCodeRepo } from './repo/categoryCode';
13
13
  import { MongoRepository as CodeRepo } from './repo/code';
@@ -67,9 +67,9 @@ export declare class AccountTransaction extends AccountTransactionRepo {
67
67
  export declare class Action extends ActionRepo {
68
68
  }
69
69
  /**
70
- * 追加特性名称リポジトリ
70
+ * 追加特性リポジトリ
71
71
  */
72
- export declare class AdditionalPropertyName extends AdditionalPropertyNameRepo {
72
+ export declare class AdditionalProperty extends AdditionalPropertyRepo {
73
73
  }
74
74
  export declare namespace action {
75
75
  class RegisterServiceInProgress extends RegisterServiceActionInProgress {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.rateLimit = exports.itemAvailability = exports.TransactionNumber = exports.Transaction = exports.Telemetry = exports.Task = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.Seller = exports.Role = exports.Reservation = exports.Project = exports.Product = exports.PriceSpecification = exports.Place = exports.Permit = exports.Person = exports.paymentMethod = exports.OwnershipInfo = exports.OrderNumber = exports.Order = exports.OfferCatalog = exports.Offer = exports.MerchantReturnPolicy = exports.Member = exports.Event = exports.EmailMessage = exports.Customer = exports.CreativeWork = exports.ConfirmationNumber = exports.Code = exports.CategoryCode = exports.AssetTransaction = exports.action = exports.AdditionalPropertyName = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.AccountAction = exports.Account = void 0;
3
+ exports.rateLimit = exports.itemAvailability = exports.TransactionNumber = exports.Transaction = exports.Telemetry = exports.Task = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.Seller = exports.Role = exports.Reservation = exports.Project = exports.Product = exports.PriceSpecification = exports.Place = exports.Permit = exports.Person = exports.paymentMethod = exports.OwnershipInfo = exports.OrderNumber = exports.Order = exports.OfferCatalog = exports.Offer = exports.MerchantReturnPolicy = exports.Member = exports.Event = exports.EmailMessage = exports.Customer = exports.CreativeWork = exports.ConfirmationNumber = exports.Code = exports.CategoryCode = exports.AssetTransaction = exports.action = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.AccountAction = exports.Account = void 0;
4
4
  // tslint:disable:max-classes-per-file completed-docs
5
5
  /**
6
6
  * リポジトリ
@@ -11,7 +11,7 @@ const accountingReport_1 = require("./repo/accountingReport");
11
11
  const accountTitle_1 = require("./repo/accountTitle");
12
12
  const accountTransaction_1 = require("./repo/accountTransaction");
13
13
  const action_1 = require("./repo/action");
14
- const additionalPropertyName_1 = require("./repo/additionalPropertyName");
14
+ const additionalProperty_1 = require("./repo/additionalProperty");
15
15
  const assetTransaction_1 = require("./repo/assetTransaction");
16
16
  const categoryCode_1 = require("./repo/categoryCode");
17
17
  const code_1 = require("./repo/code");
@@ -77,11 +77,11 @@ class Action extends action_1.MongoRepository {
77
77
  }
78
78
  exports.Action = Action;
79
79
  /**
80
- * 追加特性名称リポジトリ
80
+ * 追加特性リポジトリ
81
81
  */
82
- class AdditionalPropertyName extends additionalPropertyName_1.MongoRepository {
82
+ class AdditionalProperty extends additionalProperty_1.MongoRepository {
83
83
  }
84
- exports.AdditionalPropertyName = AdditionalPropertyName;
84
+ exports.AdditionalProperty = AdditionalProperty;
85
85
  var action;
86
86
  (function (action) {
87
87
  class RegisterServiceInProgress extends registerServiceInProgress_1.RedisRepository {
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.279.0-alpha.1",
12
+ "@chevre/factory": "4.279.0-alpha.2",
13
13
  "@cinerino/sdk": "3.133.0",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.0",
@@ -120,5 +120,5 @@
120
120
  "postversion": "git push origin --tags",
121
121
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
122
122
  },
123
- "version": "20.1.0-alpha.20"
123
+ "version": "20.1.0-alpha.22"
124
124
  }