@chevre/domain 23.0.0-alpha.24 → 23.0.0-alpha.25
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/categoryCode.d.ts +9 -31
- package/lib/chevre/repo/categoryCode.js +5 -36
- package/lib/chevre/repo/movieTicketType.d.ts +68 -0
- package/lib/chevre/repo/movieTicketType.js +262 -0
- package/lib/chevre/repository.d.ts +5 -0
- package/lib/chevre/repository.js +15 -2
- package/lib/chevre/service/offer/event/importFromCOA.js +1 -1
- package/lib/chevre/service/project.d.ts +3 -0
- package/lib/chevre/service/project.js +2 -1
- package/package.json +1 -1
|
@@ -3,23 +3,17 @@ import * as factory from '../factory';
|
|
|
3
3
|
type IUnset = {
|
|
4
4
|
[key in keyof Pick<factory.categoryCode.ICategoryCode, 'additionalProperty' | 'color' | 'image' | 'paymentMethod'>]?: 1;
|
|
5
5
|
};
|
|
6
|
-
type CategorySetIdentifierExceptMovieTicketType = Exclude<factory.categoryCode.CategorySetIdentifier, factory.categoryCode.CategorySetIdentifier.MovieTicketType>;
|
|
7
|
-
type ICategoryCodeExceptMovieTicketType = Pick<factory.categoryCode.ICategoryCode, 'additionalProperty' | 'codeValue' | 'color' | 'id' | 'image' | 'name' | 'project' | 'typeOf'> & {
|
|
6
|
+
export type CategorySetIdentifierExceptMovieTicketType = Exclude<factory.categoryCode.CategorySetIdentifier, factory.categoryCode.CategorySetIdentifier.MovieTicketType>;
|
|
7
|
+
export type ICategoryCodeExceptMovieTicketType = Pick<factory.categoryCode.ICategoryCode, 'additionalProperty' | 'codeValue' | 'color' | 'id' | 'image' | 'name' | 'project' | 'typeOf'> & {
|
|
8
8
|
inCodeSet: {
|
|
9
9
|
typeOf: 'CategoryCodeSet';
|
|
10
10
|
identifier: CategorySetIdentifierExceptMovieTicketType;
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
-
type IMovieTicketType = Pick<factory.categoryCode.ICategoryCode, 'additionalProperty' | 'codeValue' | 'color' | 'id' | 'image' | 'name' | 'project' | 'typeOf' | 'paymentMethod'> & {
|
|
14
|
-
inCodeSet: {
|
|
15
|
-
typeOf: 'CategoryCodeSet';
|
|
16
|
-
identifier: factory.categoryCode.CategorySetIdentifier.MovieTicketType;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
13
|
type IKeyOfProjection = keyof factory.categoryCode.ICategoryCode;
|
|
20
14
|
type IKeyOfProjectionExceptMovieTicketType = keyof ICategoryCodeExceptMovieTicketType;
|
|
21
15
|
/**
|
|
22
|
-
*
|
|
16
|
+
* 区分(決済カード区分を除く)リポジトリ
|
|
23
17
|
*/
|
|
24
18
|
export declare class CategoryCodeRepo {
|
|
25
19
|
private readonly categoryCodeModel;
|
|
@@ -55,44 +49,28 @@ export declare class CategoryCodeRepo {
|
|
|
55
49
|
}): Promise<(ICategoryCodeExceptMovieTicketType & {
|
|
56
50
|
id: string;
|
|
57
51
|
})[]>;
|
|
58
|
-
|
|
59
|
-
* 決済カード区分検索
|
|
60
|
-
*/
|
|
61
|
-
projectMovieTicketTypeFields(params: Omit<factory.categoryCode.ISearchConditions, 'inCodeSet'> & {
|
|
62
|
-
inCodeSet?: {
|
|
63
|
-
identifier?: {
|
|
64
|
-
$eq?: factory.categoryCode.CategorySetIdentifier.MovieTicketType;
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
},
|
|
68
|
-
/**
|
|
69
|
-
* 空の場合無効
|
|
70
|
-
*/
|
|
71
|
-
inclusion: IKeyOfProjection[]): Promise<(IMovieTicketType & {
|
|
72
|
-
id: string;
|
|
73
|
-
})[]>;
|
|
74
|
-
save(params: {
|
|
52
|
+
saveCategoryCode(params: {
|
|
75
53
|
id?: string;
|
|
76
|
-
attributes:
|
|
54
|
+
attributes: ICategoryCodeExceptMovieTicketType & {
|
|
77
55
|
$unset?: IUnset;
|
|
78
56
|
};
|
|
79
57
|
}): Promise<{
|
|
80
58
|
id: string;
|
|
81
59
|
}>;
|
|
82
|
-
|
|
83
|
-
attributes:
|
|
60
|
+
saveCategoryCodesByCodeValue(params: {
|
|
61
|
+
attributes: ICategoryCodeExceptMovieTicketType;
|
|
84
62
|
upsert?: boolean;
|
|
85
63
|
}[]): Promise<void>;
|
|
86
64
|
/**
|
|
87
65
|
* 削除する
|
|
88
66
|
*/
|
|
89
|
-
|
|
67
|
+
deleteCategoryCodeById(params: {
|
|
90
68
|
id: string;
|
|
91
69
|
}): Promise<void>;
|
|
92
70
|
/**
|
|
93
71
|
* プロジェクト指定で削除する
|
|
94
72
|
*/
|
|
95
|
-
|
|
73
|
+
deleteCategoryCodesByProject(params: {
|
|
96
74
|
project: {
|
|
97
75
|
id: string;
|
|
98
76
|
};
|
|
@@ -29,7 +29,7 @@ const AVAILABLE_PROJECT_FIELDS = [
|
|
|
29
29
|
'additionalProperty', 'codeValue', 'color', 'image', 'inCodeSet', 'name', 'paymentMethod', 'project', 'typeOf'
|
|
30
30
|
];
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* 区分(決済カード区分を除く)リポジトリ
|
|
33
33
|
*/
|
|
34
34
|
class CategoryCodeRepo {
|
|
35
35
|
constructor(connection) {
|
|
@@ -247,38 +247,7 @@ class CategoryCodeRepo {
|
|
|
247
247
|
.exec();
|
|
248
248
|
});
|
|
249
249
|
}
|
|
250
|
-
|
|
251
|
-
* 決済カード区分検索
|
|
252
|
-
*/
|
|
253
|
-
projectMovieTicketTypeFields(params,
|
|
254
|
-
/**
|
|
255
|
-
* 空の場合無効
|
|
256
|
-
*/
|
|
257
|
-
inclusion) {
|
|
258
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
259
|
-
const conditions = CategoryCodeRepo.CREATE_MONGO_CONDITIONS(params);
|
|
260
|
-
let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
|
|
261
|
-
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
262
|
-
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
263
|
-
}
|
|
264
|
-
const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
|
|
265
|
-
const query = this.categoryCodeModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
|
|
266
|
-
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
267
|
-
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
268
|
-
query.limit(params.limit)
|
|
269
|
-
.skip(params.limit * (page - 1));
|
|
270
|
-
}
|
|
271
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
272
|
-
/* istanbul ignore else */
|
|
273
|
-
if (params.sort !== undefined) {
|
|
274
|
-
query.sort(params.sort);
|
|
275
|
-
}
|
|
276
|
-
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
277
|
-
.lean() // 2024-08-19~
|
|
278
|
-
.exec();
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
save(params) {
|
|
250
|
+
saveCategoryCode(params) {
|
|
282
251
|
return __awaiter(this, void 0, void 0, function* () {
|
|
283
252
|
let savedId;
|
|
284
253
|
// let doc: HydratedDocument<{ _id: Types.ObjectId }> | null;
|
|
@@ -307,7 +276,7 @@ class CategoryCodeRepo {
|
|
|
307
276
|
return { id: savedId };
|
|
308
277
|
});
|
|
309
278
|
}
|
|
310
|
-
|
|
279
|
+
saveCategoryCodesByCodeValue(params) {
|
|
311
280
|
return __awaiter(this, void 0, void 0, function* () {
|
|
312
281
|
const bulkWriteOps = [];
|
|
313
282
|
if (Array.isArray(params)) {
|
|
@@ -342,7 +311,7 @@ class CategoryCodeRepo {
|
|
|
342
311
|
/**
|
|
343
312
|
* 削除する
|
|
344
313
|
*/
|
|
345
|
-
|
|
314
|
+
deleteCategoryCodeById(params) {
|
|
346
315
|
return __awaiter(this, void 0, void 0, function* () {
|
|
347
316
|
yield this.categoryCodeModel.findOneAndDelete({ _id: { $eq: params.id } }, { projection: { _id: 1 } })
|
|
348
317
|
.exec();
|
|
@@ -351,7 +320,7 @@ class CategoryCodeRepo {
|
|
|
351
320
|
/**
|
|
352
321
|
* プロジェクト指定で削除する
|
|
353
322
|
*/
|
|
354
|
-
|
|
323
|
+
deleteCategoryCodesByProject(params) {
|
|
355
324
|
return __awaiter(this, void 0, void 0, function* () {
|
|
356
325
|
yield this.categoryCodeModel.deleteMany({
|
|
357
326
|
'project.id': { $eq: params.project.id }
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { AnyExpression, Connection, FilterQuery } from 'mongoose';
|
|
2
|
+
import * as factory from '../factory';
|
|
3
|
+
type IUnset = {
|
|
4
|
+
[key in keyof Pick<factory.categoryCode.ICategoryCode, 'additionalProperty' | 'color' | 'image'>]?: 1;
|
|
5
|
+
};
|
|
6
|
+
type IMovieTicketType = Pick<factory.categoryCode.ICategoryCode, 'additionalProperty' | 'codeValue' | 'color' | 'id' | 'image' | 'name' | 'project' | 'typeOf'> & {
|
|
7
|
+
paymentMethod: {
|
|
8
|
+
/**
|
|
9
|
+
* 決済カード区分の場合、対応決済方法区分
|
|
10
|
+
*/
|
|
11
|
+
typeOf: string;
|
|
12
|
+
};
|
|
13
|
+
inCodeSet: {
|
|
14
|
+
typeOf: 'CategoryCodeSet';
|
|
15
|
+
identifier: factory.categoryCode.CategorySetIdentifier.MovieTicketType;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
type IKeyOfProjection = keyof IMovieTicketType;
|
|
19
|
+
/**
|
|
20
|
+
* 決済カード区分リポジトリ
|
|
21
|
+
*/
|
|
22
|
+
export declare class MovieTicketTypeRepo {
|
|
23
|
+
private readonly categoryCodeModel;
|
|
24
|
+
constructor(connection: Connection);
|
|
25
|
+
static CREATE_MONGO_CONDITIONS(params: factory.categoryCode.ISearchConditions): FilterQuery<IMovieTicketType>[];
|
|
26
|
+
static CREATE_AGGREGATE_PROJECTION(inclusion: IKeyOfProjection[]): {
|
|
27
|
+
[field: string]: AnyExpression;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* 決済カード区分検索
|
|
31
|
+
*/
|
|
32
|
+
projectMovieTicketTypeFields(params: Omit<factory.categoryCode.ISearchConditions, 'inCodeSet'> & {
|
|
33
|
+
inCodeSet?: {
|
|
34
|
+
identifier?: {
|
|
35
|
+
$eq?: factory.categoryCode.CategorySetIdentifier.MovieTicketType;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
/**
|
|
40
|
+
* 空の場合無効
|
|
41
|
+
*/
|
|
42
|
+
inclusion: IKeyOfProjection[]): Promise<(IMovieTicketType & {
|
|
43
|
+
id: string;
|
|
44
|
+
})[]>;
|
|
45
|
+
saveMovieTicketType(params: {
|
|
46
|
+
id?: string;
|
|
47
|
+
attributes: IMovieTicketType & {
|
|
48
|
+
$unset?: IUnset;
|
|
49
|
+
};
|
|
50
|
+
}): Promise<{
|
|
51
|
+
id: string;
|
|
52
|
+
}>;
|
|
53
|
+
/**
|
|
54
|
+
* 削除する
|
|
55
|
+
*/
|
|
56
|
+
deleteMovieTicketTypeById(params: {
|
|
57
|
+
id: string;
|
|
58
|
+
}): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* プロジェクト指定で削除する
|
|
61
|
+
*/
|
|
62
|
+
deleteMovieTicketTypesByProject(params: {
|
|
63
|
+
project: {
|
|
64
|
+
id: string;
|
|
65
|
+
};
|
|
66
|
+
}): Promise<void>;
|
|
67
|
+
}
|
|
68
|
+
export {};
|
|
@@ -0,0 +1,262 @@
|
|
|
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
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.MovieTicketTypeRepo = void 0;
|
|
24
|
+
// tslint:disable-next-line:no-implicit-dependencies
|
|
25
|
+
const mongoose_1 = require("mongoose");
|
|
26
|
+
const categoryCode_1 = require("./mongoose/schemas/categoryCode");
|
|
27
|
+
const factory = require("../factory");
|
|
28
|
+
const settings_1 = require("../settings");
|
|
29
|
+
const AVAILABLE_PROJECT_FIELDS = [
|
|
30
|
+
'additionalProperty', 'codeValue', 'color', 'image', 'inCodeSet', 'name', 'paymentMethod', 'project', 'typeOf'
|
|
31
|
+
];
|
|
32
|
+
/**
|
|
33
|
+
* 決済カード区分リポジトリ
|
|
34
|
+
*/
|
|
35
|
+
class MovieTicketTypeRepo {
|
|
36
|
+
constructor(connection) {
|
|
37
|
+
this.categoryCodeModel = connection.model(categoryCode_1.modelName, (0, categoryCode_1.createSchema)());
|
|
38
|
+
}
|
|
39
|
+
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
40
|
+
static CREATE_MONGO_CONDITIONS(params) {
|
|
41
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
42
|
+
const andConditions = [
|
|
43
|
+
{
|
|
44
|
+
'inCodeSet.identifier': {
|
|
45
|
+
$eq: factory.categoryCode.CategorySetIdentifier.MovieTicketType
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
];
|
|
49
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
50
|
+
/* istanbul ignore else */
|
|
51
|
+
if (params.project !== undefined && params.project !== null) {
|
|
52
|
+
if (params.project.id !== undefined && params.project.id !== null) {
|
|
53
|
+
if (typeof params.project.id.$eq === 'string') {
|
|
54
|
+
andConditions.push({
|
|
55
|
+
'project.id': {
|
|
56
|
+
$eq: params.project.id.$eq
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const idEq = (_a = params.id) === null || _a === void 0 ? void 0 : _a.$eq;
|
|
63
|
+
if (typeof idEq === 'string') {
|
|
64
|
+
// andConditions.push({ _id: { $eq: idEq } });
|
|
65
|
+
andConditions.push({ _id: { $eq: new mongoose_1.Types.ObjectId(idEq) } });
|
|
66
|
+
}
|
|
67
|
+
const idIn = (_b = params.id) === null || _b === void 0 ? void 0 : _b.$in;
|
|
68
|
+
if (Array.isArray(idIn)) {
|
|
69
|
+
// andConditions.push({ _id: { $in: idIn } });
|
|
70
|
+
andConditions.push({ _id: { $in: idIn.map((id) => new mongoose_1.Types.ObjectId(id)) } });
|
|
71
|
+
}
|
|
72
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
73
|
+
/* istanbul ignore else */
|
|
74
|
+
if (params.name !== undefined && params.name !== null) {
|
|
75
|
+
if (typeof params.name.$regex === 'string' && params.name.$regex.length > 0) {
|
|
76
|
+
andConditions.push({
|
|
77
|
+
$or: [
|
|
78
|
+
{
|
|
79
|
+
'name.ja': {
|
|
80
|
+
$exists: true,
|
|
81
|
+
$regex: new RegExp(params.name.$regex)
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
'name.en': {
|
|
86
|
+
$exists: true,
|
|
87
|
+
$regex: new RegExp(params.name.$regex)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const codeValueEq = (_c = params.codeValue) === null || _c === void 0 ? void 0 : _c.$eq;
|
|
95
|
+
if (typeof codeValueEq === 'string') {
|
|
96
|
+
andConditions.push({ codeValue: { $eq: codeValueEq } });
|
|
97
|
+
}
|
|
98
|
+
const codeValueIn = (_d = params.codeValue) === null || _d === void 0 ? void 0 : _d.$in;
|
|
99
|
+
if (Array.isArray(codeValueIn)) {
|
|
100
|
+
andConditions.push({ codeValue: { $in: codeValueIn } });
|
|
101
|
+
}
|
|
102
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
103
|
+
/* istanbul ignore else */
|
|
104
|
+
if (params.inCodeSet !== undefined && params.inCodeSet !== null) {
|
|
105
|
+
if (params.inCodeSet.identifier !== undefined && params.inCodeSet.identifier !== null) {
|
|
106
|
+
if (typeof params.inCodeSet.identifier.$eq === 'string') {
|
|
107
|
+
andConditions.push({
|
|
108
|
+
'inCodeSet.identifier': {
|
|
109
|
+
$eq: params.inCodeSet.identifier.$eq
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
const inCodeSetIdentifierIn = (_f = (_e = params.inCodeSet) === null || _e === void 0 ? void 0 : _e.identifier) === null || _f === void 0 ? void 0 : _f.$in;
|
|
116
|
+
if (Array.isArray(inCodeSetIdentifierIn)) {
|
|
117
|
+
andConditions.push({
|
|
118
|
+
'inCodeSet.identifier': {
|
|
119
|
+
$in: inCodeSetIdentifierIn
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
const paymentMethodTypeOfEq = (_h = (_g = params.paymentMethod) === null || _g === void 0 ? void 0 : _g.typeOf) === null || _h === void 0 ? void 0 : _h.$eq;
|
|
124
|
+
if (typeof paymentMethodTypeOfEq === 'string') {
|
|
125
|
+
andConditions.push({
|
|
126
|
+
'paymentMethod.typeOf': {
|
|
127
|
+
$exists: true,
|
|
128
|
+
$eq: paymentMethodTypeOfEq
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
const paymentMethodTypeOfIn = (_k = (_j = params.paymentMethod) === null || _j === void 0 ? void 0 : _j.typeOf) === null || _k === void 0 ? void 0 : _k.$in;
|
|
133
|
+
if (Array.isArray(paymentMethodTypeOfIn)) {
|
|
134
|
+
andConditions.push({
|
|
135
|
+
'paymentMethod.typeOf': {
|
|
136
|
+
$exists: true,
|
|
137
|
+
$in: paymentMethodTypeOfIn
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
const additionalPropertyElemMatch = (_l = params.additionalProperty) === null || _l === void 0 ? void 0 : _l.$elemMatch;
|
|
142
|
+
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
143
|
+
andConditions.push({
|
|
144
|
+
additionalProperty: {
|
|
145
|
+
$exists: true,
|
|
146
|
+
$elemMatch: additionalPropertyElemMatch
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
return andConditions;
|
|
151
|
+
}
|
|
152
|
+
static CREATE_AGGREGATE_PROJECTION(inclusion) {
|
|
153
|
+
let projectStage = {
|
|
154
|
+
_id: 0,
|
|
155
|
+
id: { $toString: '$_id' },
|
|
156
|
+
project: '$project',
|
|
157
|
+
typeOf: '$typeOf',
|
|
158
|
+
additionalProperty: '$additionalProperty',
|
|
159
|
+
color: '$color',
|
|
160
|
+
image: '$image',
|
|
161
|
+
codeValue: '$codeValue',
|
|
162
|
+
inCodeSet: '$inCodeSet',
|
|
163
|
+
name: '$name',
|
|
164
|
+
paymentMethod: '$paymentMethod'
|
|
165
|
+
};
|
|
166
|
+
if (inclusion.length > 0) {
|
|
167
|
+
projectStage = { _id: 0 };
|
|
168
|
+
inclusion.forEach((field) => {
|
|
169
|
+
switch (field) {
|
|
170
|
+
// case '_id':
|
|
171
|
+
case 'id':
|
|
172
|
+
projectStage.id = { $toString: '$_id' };
|
|
173
|
+
break;
|
|
174
|
+
default:
|
|
175
|
+
projectStage[field] = `$${field}`;
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
return projectStage;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* 決済カード区分検索
|
|
183
|
+
*/
|
|
184
|
+
projectMovieTicketTypeFields(params,
|
|
185
|
+
/**
|
|
186
|
+
* 空の場合無効
|
|
187
|
+
*/
|
|
188
|
+
inclusion) {
|
|
189
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
190
|
+
const conditions = MovieTicketTypeRepo.CREATE_MONGO_CONDITIONS(params);
|
|
191
|
+
let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
|
|
192
|
+
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
193
|
+
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
194
|
+
}
|
|
195
|
+
const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
|
|
196
|
+
const query = this.categoryCodeModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
|
|
197
|
+
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
198
|
+
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
199
|
+
query.limit(params.limit)
|
|
200
|
+
.skip(params.limit * (page - 1));
|
|
201
|
+
}
|
|
202
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
203
|
+
/* istanbul ignore else */
|
|
204
|
+
if (params.sort !== undefined) {
|
|
205
|
+
query.sort(params.sort);
|
|
206
|
+
}
|
|
207
|
+
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
208
|
+
.lean() // 2024-08-19~
|
|
209
|
+
.exec();
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
saveMovieTicketType(params) {
|
|
213
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
214
|
+
let savedId;
|
|
215
|
+
// let doc: HydratedDocument<{ _id: Types.ObjectId }> | null;
|
|
216
|
+
if (typeof params.id !== 'string') {
|
|
217
|
+
const _a = params.attributes, { id, $unset } = _a, creatingDoc = __rest(_a, ["id", "$unset"]);
|
|
218
|
+
const createResult = yield this.categoryCodeModel.create(creatingDoc);
|
|
219
|
+
// doc = createResult;
|
|
220
|
+
if (typeof createResult.id !== 'string') {
|
|
221
|
+
throw new factory.errors.Internal(`failed in creating ${creatingDoc.typeOf} unexpectedly`);
|
|
222
|
+
}
|
|
223
|
+
savedId = createResult.id;
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
// 上書き禁止属性を除外(2022-08-24~)
|
|
227
|
+
const _b = params.attributes, { id, codeValue, inCodeSet, project, typeOf, $unset } = _b, updateFields = __rest(_b, ["id", "codeValue", "inCodeSet", "project", "typeOf", "$unset"]);
|
|
228
|
+
const doc = yield this.categoryCodeModel.findOneAndUpdate({ _id: { $eq: params.id } }, Object.assign({ $set: updateFields }, ($unset !== undefined) ? { $unset } : undefined), { upsert: false, new: true, projection: { _id: 1 } })
|
|
229
|
+
.exec();
|
|
230
|
+
if (doc === null) {
|
|
231
|
+
throw new factory.errors.NotFound(this.categoryCodeModel.modelName);
|
|
232
|
+
}
|
|
233
|
+
savedId = params.id;
|
|
234
|
+
}
|
|
235
|
+
// if (doc === null) {
|
|
236
|
+
// throw new factory.errors.NotFound(this.categoryCodeModel.modelName);
|
|
237
|
+
// }
|
|
238
|
+
return { id: savedId };
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* 削除する
|
|
243
|
+
*/
|
|
244
|
+
deleteMovieTicketTypeById(params) {
|
|
245
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
246
|
+
yield this.categoryCodeModel.findOneAndDelete({ _id: { $eq: params.id } }, { projection: { _id: 1 } })
|
|
247
|
+
.exec();
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* プロジェクト指定で削除する
|
|
252
|
+
*/
|
|
253
|
+
deleteMovieTicketTypesByProject(params) {
|
|
254
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
255
|
+
yield this.categoryCodeModel.deleteMany({
|
|
256
|
+
'project.id': { $eq: params.project.id }
|
|
257
|
+
})
|
|
258
|
+
.exec();
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
exports.MovieTicketTypeRepo = MovieTicketTypeRepo;
|
|
@@ -32,6 +32,7 @@ import type { MemberRepo } from './repo/member';
|
|
|
32
32
|
import type { MemberProgramRepo } from './repo/memberProgram';
|
|
33
33
|
import type { MerchantReturnPolicyRepo } from './repo/merchantReturnPolicy';
|
|
34
34
|
import type { MessageRepo } from './repo/message';
|
|
35
|
+
import type { MovieTicketTypeRepo } from './repo/movieTicketType';
|
|
35
36
|
import type { NoteRepo } from './repo/note';
|
|
36
37
|
import type { NoteAboutOrderRepo } from './repo/noteAboutOrder';
|
|
37
38
|
import type { OfferRepo } from './repo/offer/unitPriceInCatalog';
|
|
@@ -216,6 +217,10 @@ export type Message = MessageRepo;
|
|
|
216
217
|
export declare namespace Message {
|
|
217
218
|
function createInstance(...params: ConstructorParameters<typeof MessageRepo>): Promise<MessageRepo>;
|
|
218
219
|
}
|
|
220
|
+
export type MovieTicketType = MovieTicketTypeRepo;
|
|
221
|
+
export declare namespace MovieTicketType {
|
|
222
|
+
function createInstance(...params: ConstructorParameters<typeof MovieTicketTypeRepo>): Promise<MovieTicketTypeRepo>;
|
|
223
|
+
}
|
|
219
224
|
export type Note = NoteRepo;
|
|
220
225
|
export declare namespace Note {
|
|
221
226
|
function createInstance(...params: ConstructorParameters<typeof NoteRepo>): Promise<NoteRepo>;
|
package/lib/chevre/repository.js
CHANGED
|
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
13
|
-
exports.WebSite = exports.rateLimit = exports.Trip = exports.TransactionProcess = exports.TransactionNumber = exports.Transaction = exports.Ticket = exports.Telemetry = exports.Task = exports.StockHolder = exports.setting = exports.Setting = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.ServiceAvailableHour = exports.SellerReturnPolicy = exports.SellerPaymentAccepted = exports.SellerMakesOffer = exports.Seller = exports.Schedule = exports.Role = exports.ReserveInterface = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductOffer = exports.ProductModel = exports.ProductHasOfferCatalog = exports.Product = exports.PriceSpecification = exports.PotentialAction = exports.place = void 0;
|
|
12
|
+
exports.Person = exports.paymentMethod = exports.PendingReservation = exports.PaymentServiceProvider = exports.PaymentServiceChannel = exports.PaymentService = exports.Passport = exports.OwnershipInfo = exports.OrderNumber = exports.OrderInTransaction = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.NoteAboutOrder = exports.Note = exports.MovieTicketType = exports.Message = exports.MerchantReturnPolicy = exports.MemberProgram = exports.Member = exports.Issuer = exports.IdentityProvider = exports.Identity = exports.EventSeries = exports.EventSellerMakesOffer = exports.Event = exports.EmailMessage = exports.CustomerType = exports.Customer = exports.Credentials = exports.CreativeWork = exports.ConfirmationNumber = exports.Comment = exports.Authorization = exports.CategoryCode = exports.AssetTransaction = exports.Aggregation = exports.AggregateReservation = exports.AggregateOrder = exports.AggregateOffer = exports.AdvanceBookingRequirement = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = exports.AcceptedOffer = void 0;
|
|
13
|
+
exports.WebSite = exports.rateLimit = exports.Trip = exports.TransactionProcess = exports.TransactionNumber = exports.Transaction = exports.Ticket = exports.Telemetry = exports.Task = exports.StockHolder = exports.setting = exports.Setting = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.ServiceAvailableHour = exports.SellerReturnPolicy = exports.SellerPaymentAccepted = exports.SellerMakesOffer = exports.Seller = exports.Schedule = exports.Role = exports.ReserveInterface = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductOffer = exports.ProductModel = exports.ProductHasOfferCatalog = exports.Product = exports.PriceSpecification = exports.PotentialAction = exports.place = exports.Permit = void 0;
|
|
14
14
|
var AcceptedOffer;
|
|
15
15
|
(function (AcceptedOffer) {
|
|
16
16
|
let repo;
|
|
@@ -427,6 +427,19 @@ var Message;
|
|
|
427
427
|
}
|
|
428
428
|
Message.createInstance = createInstance;
|
|
429
429
|
})(Message || (exports.Message = Message = {}));
|
|
430
|
+
var MovieTicketType;
|
|
431
|
+
(function (MovieTicketType) {
|
|
432
|
+
let repo;
|
|
433
|
+
function createInstance(...params) {
|
|
434
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
435
|
+
if (repo === undefined) {
|
|
436
|
+
repo = (yield Promise.resolve().then(() => require('./repo/movieTicketType'))).MovieTicketTypeRepo;
|
|
437
|
+
}
|
|
438
|
+
return new repo(...params);
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
MovieTicketType.createInstance = createInstance;
|
|
442
|
+
})(MovieTicketType || (exports.MovieTicketType = MovieTicketType = {}));
|
|
430
443
|
var Note;
|
|
431
444
|
(function (Note) {
|
|
432
445
|
let repo;
|
|
@@ -117,7 +117,7 @@ function importCategoryCodesFromCOA(params) {
|
|
|
117
117
|
upsert: true
|
|
118
118
|
});
|
|
119
119
|
});
|
|
120
|
-
yield repos.categoryCode.
|
|
120
|
+
yield repos.categoryCode.saveCategoryCodesByCodeValue(saveParams);
|
|
121
121
|
}
|
|
122
122
|
catch (error) {
|
|
123
123
|
let throwsError = true;
|
|
@@ -8,6 +8,7 @@ import type { CategoryCodeRepo } from '../repo/categoryCode';
|
|
|
8
8
|
import type { CreativeWorkRepo } from '../repo/creativeWork';
|
|
9
9
|
import type { EventRepo } from '../repo/event';
|
|
10
10
|
import type { MemberRepo } from '../repo/member';
|
|
11
|
+
import type { MovieTicketTypeRepo } from '../repo/movieTicketType';
|
|
11
12
|
import type { OfferRepo } from '../repo/offer/unitPriceInCatalog';
|
|
12
13
|
import type { OfferCatalogRepo } from '../repo/offerCatalog';
|
|
13
14
|
import type { MovieTheaterRepo } from '../repo/place/movieTheater';
|
|
@@ -27,6 +28,7 @@ export declare function deleteProject(params: {
|
|
|
27
28
|
creativeWork: CreativeWorkRepo;
|
|
28
29
|
event: EventRepo;
|
|
29
30
|
member: MemberRepo;
|
|
31
|
+
movieTicketType: MovieTicketTypeRepo;
|
|
30
32
|
offer: OfferRepo;
|
|
31
33
|
offerCatalog: OfferCatalogRepo;
|
|
32
34
|
priceSpecification: PriceSpecificationRepo;
|
|
@@ -48,6 +50,7 @@ export declare function cleanUpDatabaseByProject(params: {
|
|
|
48
50
|
categoryCode: CategoryCodeRepo;
|
|
49
51
|
creativeWork: CreativeWorkRepo;
|
|
50
52
|
event: EventRepo;
|
|
53
|
+
movieTicketType: MovieTicketTypeRepo;
|
|
51
54
|
offer: OfferRepo;
|
|
52
55
|
offerCatalog: OfferCatalogRepo;
|
|
53
56
|
priceSpecification: PriceSpecificationRepo;
|
|
@@ -24,7 +24,8 @@ function cleanUpDatabaseByProject(params) {
|
|
|
24
24
|
yield repos.accountTitle.deleteByProject({ project: { id: params.id } });
|
|
25
25
|
yield repos.action.deleteByProject({ project: { id: params.id } });
|
|
26
26
|
yield repos.assetTransaction.deleteByProject({ project: { id: params.id } });
|
|
27
|
-
yield repos.categoryCode.
|
|
27
|
+
yield repos.categoryCode.deleteCategoryCodesByProject({ project: { id: params.id } });
|
|
28
|
+
yield repos.movieTicketType.deleteMovieTicketTypesByProject({ project: { id: params.id } });
|
|
28
29
|
yield repos.creativeWork.deleteByProject({ project: { id: params.id } });
|
|
29
30
|
yield repos.event.deleteByProject({ project: { id: params.id } });
|
|
30
31
|
yield repos.offerCatalog.deleteByProject({ project: { id: params.id } });
|
package/package.json
CHANGED