@chevre/domain 20.3.0 → 20.4.0-alpha.1
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.
- package/lib/chevre/repo/comment.d.ts +31 -0
- package/lib/chevre/repo/comment.js +113 -0
- package/lib/chevre/repo/member.d.ts +2 -1
- package/lib/chevre/repo/member.js +1 -1
- package/lib/chevre/repo/mongoose/model/comments.d.ts +7 -0
- package/lib/chevre/repo/mongoose/model/comments.js +82 -0
- package/lib/chevre/repo/mongoose/model/order.js +8 -2
- package/lib/chevre/repo/order.d.ts +6 -0
- package/lib/chevre/repo/order.js +59 -15
- package/lib/chevre/repo/person.js +5 -0
- package/package.json +3 -3
|
@@ -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;
|
|
@@ -188,7 +188,7 @@ class MongoRepository {
|
|
|
188
188
|
const doc = yield this.memberModel.findOneAndUpdate({
|
|
189
189
|
'project.id': { $eq: params.project.id },
|
|
190
190
|
'member.id': { $eq: params.member.id }
|
|
191
|
-
}, Object.assign(Object.assign({ updatedAt: new Date() }, (Array.isArray(params.member.hasRole)) ? { 'member.hasRole': params.member.hasRole } : undefined), (typeof params.member.name === 'string') ? { 'member.name': params.member.name } : undefined))
|
|
191
|
+
}, Object.assign(Object.assign(Object.assign({ updatedAt: new Date() }, (Array.isArray(params.member.hasRole)) ? { 'member.hasRole': params.member.hasRole } : undefined), (typeof params.member.image === 'string') ? { 'member.image': params.member.image } : undefined), (typeof params.member.name === 'string') ? { 'member.name': params.member.name } : undefined))
|
|
192
192
|
.exec();
|
|
193
193
|
if (doc === null) {
|
|
194
194
|
throw new factory.errors.NotFound(this.memberModel.modelName);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as mongoose from 'mongoose';
|
|
2
|
+
declare const modelName = "CreativeWork";
|
|
3
|
+
/**
|
|
4
|
+
* コメントスキーマ
|
|
5
|
+
*/
|
|
6
|
+
declare const schema: mongoose.Schema<mongoose.Document<any, any, any>, mongoose.Model<mongoose.Document<any, any, any>, any, any>, undefined, {}>;
|
|
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
|
-
|
|
36
|
-
|
|
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
|
*/
|
package/lib/chevre/repo/order.js
CHANGED
|
@@ -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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 } },
|
|
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
|
/**
|
|
@@ -920,7 +964,7 @@ class MongoRepository {
|
|
|
920
964
|
aggregate.project((projection !== undefined && projection !== null)
|
|
921
965
|
? projection
|
|
922
966
|
: {
|
|
923
|
-
_id: 0,
|
|
967
|
+
// _id: 0,
|
|
924
968
|
__v: 0,
|
|
925
969
|
createdAt: 0,
|
|
926
970
|
updatedAt: 0
|
|
@@ -42,6 +42,7 @@ class CognitoRepository {
|
|
|
42
42
|
givenName: '',
|
|
43
43
|
familyName: '',
|
|
44
44
|
email: '',
|
|
45
|
+
image: '',
|
|
45
46
|
telephone: '',
|
|
46
47
|
additionalProperty: additionalProperty
|
|
47
48
|
};
|
|
@@ -60,6 +61,10 @@ class CognitoRepository {
|
|
|
60
61
|
// tslint:disable-next-line:max-line-length no-single-line-block-comment
|
|
61
62
|
profile.email = (userAttribute.Value !== undefined) ? userAttribute.Value : /* istanbul ignore next: please write tests */ '';
|
|
62
63
|
break;
|
|
64
|
+
case 'picture':
|
|
65
|
+
// tslint:disable-next-line:max-line-length no-single-line-block-comment
|
|
66
|
+
profile.image = (userAttribute.Value !== undefined) ? userAttribute.Value : /* istanbul ignore next: please write tests */ '';
|
|
67
|
+
break;
|
|
63
68
|
case 'phone_number':
|
|
64
69
|
// tslint:disable-next-line:max-line-length no-single-line-block-comment
|
|
65
70
|
profile.telephone = (userAttribute.Value !== undefined) ? userAttribute.Value : /* istanbul ignore next: please write tests */ '';
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.
|
|
13
|
-
"@cinerino/sdk": "3.
|
|
12
|
+
"@chevre/factory": "4.289.0-alpha.2",
|
|
13
|
+
"@cinerino/sdk": "3.140.0-alpha.1",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
16
16
|
"@sendgrid/mail": "6.4.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.
|
|
123
|
+
"version": "20.4.0-alpha.1"
|
|
124
124
|
}
|