@chevre/domain 23.0.0-alpha.26 → 23.0.0-alpha.28
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/example/src/chevre/categoryCode/checkUniqueness.ts +69 -0
- package/example/src/chevre/event/migrateEventAdditionalProperty2identifier.ts +6 -2
- package/example/src/chevre/movieTicketType/deleteOldMovieTicketTypes.ts +15 -0
- package/example/src/chevre/reIndex.ts +2 -1
- package/lib/chevre/repo/categoryCode.d.ts +2 -7
- package/lib/chevre/repo/categoryCode.js +20 -20
- package/lib/chevre/repo/mongoose/schemas/categoryCode.js +34 -23
- package/lib/chevre/repo/mongoose/schemas/movieTicketTypes.d.ts +1 -12
- package/lib/chevre/repo/mongoose/schemas/movieTicketTypes.js +1 -10
- package/lib/chevre/repo/movieTicketType.d.ts +5 -4
- package/lib/chevre/repo/movieTicketType.js +31 -24
- package/package.json +3 -3
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// tslint:disable:no-console no-magic-numbers
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../../lib/index';
|
|
5
|
+
|
|
6
|
+
// tslint:disable-next-line:max-func-body-length
|
|
7
|
+
async function main() {
|
|
8
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
9
|
+
|
|
10
|
+
const categoryCodeRepo = await chevre.repository.CategoryCode.createInstance(mongoose.connection);
|
|
11
|
+
|
|
12
|
+
const cursor = categoryCodeRepo.getCursor(
|
|
13
|
+
{
|
|
14
|
+
// _id: { $eq: '68f5d32176b5f6b689ff24a6' },
|
|
15
|
+
// 'project.id': { $eq: project.id },
|
|
16
|
+
// 'additionalProperty.name': { $exists: true, $eq: PROPERTY_NAME }
|
|
17
|
+
'inCodeSet.identifier': { $ne: chevre.factory.movieTicketType.CategorySetIdentifier.MovieTicketType }
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
_id: 1,
|
|
21
|
+
codeValue: 1,
|
|
22
|
+
project: 1,
|
|
23
|
+
inCodeSet: 1,
|
|
24
|
+
name: 1,
|
|
25
|
+
typeOf: 1
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
console.log('docs found');
|
|
29
|
+
|
|
30
|
+
let i = 0;
|
|
31
|
+
let notUniqueCount = 0;
|
|
32
|
+
await cursor.eachAsync(async (doc) => {
|
|
33
|
+
i += 1;
|
|
34
|
+
const categoryCode: Pick<
|
|
35
|
+
chevre.factory.categoryCode.ICategoryCode,
|
|
36
|
+
'codeValue' | 'id' | 'inCodeSet' | 'name' | 'project' | 'typeOf'
|
|
37
|
+
> = doc.toObject();
|
|
38
|
+
|
|
39
|
+
// console.log('unique?', categoryCode.project.id, categoryCode.id, categoryCode.codeValue, i);
|
|
40
|
+
|
|
41
|
+
const sameCodeValues = (await categoryCodeRepo.projectCategoryCodeFields(
|
|
42
|
+
{
|
|
43
|
+
project: { id: { $eq: categoryCode.project.id } },
|
|
44
|
+
codeValue: { $eq: categoryCode.codeValue }
|
|
45
|
+
// inCodeSet:{identifier:{$}}
|
|
46
|
+
},
|
|
47
|
+
['codeValue', 'inCodeSet']
|
|
48
|
+
)).filter(
|
|
49
|
+
({ inCodeSet }) => <unknown>inCodeSet.identifier !== chevre.factory.movieTicketType.CategorySetIdentifier.MovieTicketType
|
|
50
|
+
);
|
|
51
|
+
// console.log(sameCodeValues, 'sameCodeValues found', categoryCode.project.id, categoryCode.id, categoryCode.codeValue, i);
|
|
52
|
+
|
|
53
|
+
const isUnique = sameCodeValues.length === 1;
|
|
54
|
+
if (isUnique) {
|
|
55
|
+
// console.log(
|
|
56
|
+
// 'unique.', categoryCode.project.id, categoryCode.id, categoryCode.codeValue, i);
|
|
57
|
+
} else {
|
|
58
|
+
notUniqueCount += 1;
|
|
59
|
+
console.log('not unique.', categoryCode.project.id, categoryCode.id, categoryCode.codeValue, i);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
console.log(i, 'docs checked');
|
|
64
|
+
console.log(notUniqueCount, 'docs not unique');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
main()
|
|
68
|
+
.then()
|
|
69
|
+
.catch(console.error);
|
|
@@ -4,7 +4,7 @@ import * as mongoose from 'mongoose';
|
|
|
4
4
|
|
|
5
5
|
import { chevre } from '../../../../lib/index';
|
|
6
6
|
|
|
7
|
-
const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
+
// const project = { id: String(process.env.PROJECT_ID) };
|
|
8
8
|
const PROPERTY_NAME = 'createId';
|
|
9
9
|
|
|
10
10
|
async function additionalProperty2identifier(raw: string) {
|
|
@@ -42,7 +42,7 @@ async function main() {
|
|
|
42
42
|
const cursor = eventRepo.getCursor(
|
|
43
43
|
{
|
|
44
44
|
// _id: { $eq: '68f5d32176b5f6b689ff24a6' },
|
|
45
|
-
'project.id': { $eq: project.id },
|
|
45
|
+
// 'project.id': { $eq: project.id },
|
|
46
46
|
'additionalProperty.name': { $exists: true, $eq: PROPERTY_NAME }
|
|
47
47
|
},
|
|
48
48
|
{
|
|
@@ -80,6 +80,10 @@ async function main() {
|
|
|
80
80
|
|
|
81
81
|
if (alreadyMigrated) {
|
|
82
82
|
validateIdentifier(eventIdentifier);
|
|
83
|
+
// 追加特性から生成された識別子に一致するはず
|
|
84
|
+
if (identifierMustBe !== eventIdentifier) {
|
|
85
|
+
throw new Error(`${identifierMustBe} !== ${eventIdentifier} ${event.id}, ${i}`);
|
|
86
|
+
}
|
|
83
87
|
console.log(
|
|
84
88
|
'already migrated.', event.project.id, eventIdentifier, additionalPropertyValue, event.id, event.startDate, i);
|
|
85
89
|
} else {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// tslint:disable:no-console no-magic-numbers
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../../lib/index';
|
|
5
|
+
|
|
6
|
+
async function main() {
|
|
7
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
8
|
+
|
|
9
|
+
const movieTicketTypeRepo = await chevre.repository.MovieTicketType.createInstance(mongoose.connection);
|
|
10
|
+
await movieTicketTypeRepo.deleteOldMovieTicketTypes(mongoose.connection);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
main()
|
|
14
|
+
.then()
|
|
15
|
+
.catch(console.error);
|
|
@@ -11,7 +11,8 @@ mongoose.Model.on('index', (...args) => {
|
|
|
11
11
|
async function main() {
|
|
12
12
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
13
|
|
|
14
|
-
await chevre.repository.
|
|
14
|
+
await chevre.repository.CategoryCode.createInstance(mongoose.connection);
|
|
15
|
+
// await chevre.repository.MovieTicketType.createInstance(mongoose.connection);
|
|
15
16
|
console.log('success!');
|
|
16
17
|
}
|
|
17
18
|
|
|
@@ -3,13 +3,8 @@ 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
|
-
export type CategorySetIdentifierExceptMovieTicketType =
|
|
7
|
-
export type ICategoryCodeExceptMovieTicketType = Pick<factory.categoryCode.ICategoryCode, 'additionalProperty' | 'codeValue' | 'color' | 'id' | 'image' | 'name' | 'project' | 'typeOf'
|
|
8
|
-
inCodeSet: {
|
|
9
|
-
typeOf: 'CategoryCodeSet';
|
|
10
|
-
identifier: CategorySetIdentifierExceptMovieTicketType;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
6
|
+
export type CategorySetIdentifierExceptMovieTicketType = factory.categoryCode.CategorySetIdentifier;
|
|
7
|
+
export type ICategoryCodeExceptMovieTicketType = Pick<factory.categoryCode.ICategoryCode, 'additionalProperty' | 'codeValue' | 'color' | 'id' | 'image' | 'name' | 'project' | 'typeOf' | 'inCodeSet'>;
|
|
13
8
|
type IKeyOfProjection = keyof factory.categoryCode.ICategoryCode;
|
|
14
9
|
type IKeyOfProjectionExceptMovieTicketType = keyof ICategoryCodeExceptMovieTicketType;
|
|
15
10
|
/**
|
|
@@ -37,7 +37,7 @@ class CategoryCodeRepo {
|
|
|
37
37
|
}
|
|
38
38
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
39
39
|
static CREATE_MONGO_CONDITIONS(params, options) {
|
|
40
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
40
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
41
41
|
const excludeMovieTicketType = (options === null || options === void 0 ? void 0 : options.excludeMovieTicketType) === true;
|
|
42
42
|
const andConditions = [];
|
|
43
43
|
if (excludeMovieTicketType) {
|
|
@@ -133,25 +133,25 @@ class CategoryCodeRepo {
|
|
|
133
133
|
}
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
|
-
const paymentMethodTypeOfEq =
|
|
137
|
-
if (typeof paymentMethodTypeOfEq === 'string') {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
const paymentMethodTypeOfIn =
|
|
146
|
-
if (Array.isArray(paymentMethodTypeOfIn)) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
const additionalPropertyElemMatch = (
|
|
136
|
+
// const paymentMethodTypeOfEq = params.paymentMethod?.typeOf?.$eq;
|
|
137
|
+
// if (typeof paymentMethodTypeOfEq === 'string') {
|
|
138
|
+
// andConditions.push({
|
|
139
|
+
// 'paymentMethod.typeOf': {
|
|
140
|
+
// $exists: true,
|
|
141
|
+
// $eq: paymentMethodTypeOfEq
|
|
142
|
+
// }
|
|
143
|
+
// });
|
|
144
|
+
// }
|
|
145
|
+
// const paymentMethodTypeOfIn = params.paymentMethod?.typeOf?.$in;
|
|
146
|
+
// if (Array.isArray(paymentMethodTypeOfIn)) {
|
|
147
|
+
// andConditions.push({
|
|
148
|
+
// 'paymentMethod.typeOf': {
|
|
149
|
+
// $exists: true,
|
|
150
|
+
// $in: paymentMethodTypeOfIn
|
|
151
|
+
// }
|
|
152
|
+
// });
|
|
153
|
+
// }
|
|
154
|
+
const additionalPropertyElemMatch = (_g = params.additionalProperty) === null || _g === void 0 ? void 0 : _g.$elemMatch;
|
|
155
155
|
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
156
156
|
andConditions.push({
|
|
157
157
|
additionalProperty: {
|
|
@@ -4,7 +4,6 @@ exports.modelName = exports.indexes = void 0;
|
|
|
4
4
|
exports.createSchema = createSchema;
|
|
5
5
|
const mongoose_1 = require("mongoose");
|
|
6
6
|
const writeConcern_1 = require("../writeConcern");
|
|
7
|
-
const factory = require("../../../factory");
|
|
8
7
|
const settings_1 = require("../../../settings");
|
|
9
8
|
const modelName = 'CategoryCode';
|
|
10
9
|
exports.modelName = modelName;
|
|
@@ -100,37 +99,49 @@ const indexes = [
|
|
|
100
99
|
}
|
|
101
100
|
}
|
|
102
101
|
],
|
|
103
|
-
//
|
|
104
|
-
[
|
|
105
|
-
{
|
|
106
|
-
'project.id': 1,
|
|
107
|
-
'inCodeSet.identifier': 1,
|
|
108
|
-
codeValue: 1
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
unique: true,
|
|
112
|
-
name: 'uniqueByCodeValueAndInCodeSet',
|
|
113
|
-
partialFilterExpression: {
|
|
114
|
-
// tslint:disable-next-line:no-null-keyword
|
|
115
|
-
'paymentMethod.typeOf': null
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
],
|
|
102
|
+
// 決済カード区分をコレクション分離したので、reIndex unique index(2025-11-05~)
|
|
119
103
|
[
|
|
120
104
|
{
|
|
121
105
|
'project.id': 1,
|
|
122
|
-
'
|
|
106
|
+
'inCodeSet.identifier': 1, // ssktsでのみ区分分類をまたいで重複がある
|
|
123
107
|
codeValue: 1
|
|
124
108
|
},
|
|
125
109
|
{
|
|
126
110
|
unique: true,
|
|
127
|
-
name: '
|
|
128
|
-
partialFilterExpression: {
|
|
129
|
-
'inCodeSet.identifier': { $eq: factory.categoryCode.CategorySetIdentifier.MovieTicketType },
|
|
130
|
-
'paymentMethod.typeOf': { $exists: true }
|
|
131
|
-
}
|
|
111
|
+
name: 'uniqueByCodeValue'
|
|
132
112
|
}
|
|
133
113
|
]
|
|
114
|
+
// add unique index(2024-11-14~)
|
|
115
|
+
// [
|
|
116
|
+
// {
|
|
117
|
+
// 'project.id': 1,
|
|
118
|
+
// 'inCodeSet.identifier': 1,
|
|
119
|
+
// codeValue: 1
|
|
120
|
+
// },
|
|
121
|
+
// {
|
|
122
|
+
// unique: true,
|
|
123
|
+
// name: 'uniqueByCodeValueAndInCodeSet',
|
|
124
|
+
// partialFilterExpression: {
|
|
125
|
+
// // tslint:disable-next-line:no-null-keyword
|
|
126
|
+
// 'paymentMethod.typeOf': null
|
|
127
|
+
// }
|
|
128
|
+
// }
|
|
129
|
+
// ],
|
|
130
|
+
// [
|
|
131
|
+
// {
|
|
132
|
+
// 'project.id': 1,
|
|
133
|
+
// 'paymentMethod.typeOf': 1,
|
|
134
|
+
// codeValue: 1
|
|
135
|
+
// },
|
|
136
|
+
// {
|
|
137
|
+
// unique: true,
|
|
138
|
+
// name: 'uniqueByCodeValueAndPaymentMethod',
|
|
139
|
+
// partialFilterExpression: {
|
|
140
|
+
// 'inCodeSet.identifier': { $eq: factory.movieTicketType.CategorySetIdentifier.MovieTicketType },
|
|
141
|
+
// 'paymentMethod.typeOf': { $exists: true }
|
|
142
|
+
// }
|
|
143
|
+
// }
|
|
144
|
+
// ]
|
|
134
145
|
];
|
|
135
146
|
exports.indexes = indexes;
|
|
136
147
|
/**
|
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
2
|
import * as factory from '../../../factory';
|
|
3
|
-
type IMovieTicketType = Pick<factory.
|
|
4
|
-
paymentMethod: {
|
|
5
|
-
/**
|
|
6
|
-
* 決済カード区分の場合、対応決済方法区分
|
|
7
|
-
*/
|
|
8
|
-
typeOf: string;
|
|
9
|
-
};
|
|
10
|
-
inCodeSet: {
|
|
11
|
-
typeOf: 'CategoryCodeSet';
|
|
12
|
-
identifier: factory.categoryCode.CategorySetIdentifier.MovieTicketType;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
3
|
+
type IMovieTicketType = Pick<factory.movieTicketType.IMovieTicketType, 'codeValue' | 'color' | 'id' | 'image' | 'name' | 'project' | 'typeOf' | 'inCodeSet' | 'paymentMethod'>;
|
|
15
4
|
type IDocType = factory.categoryCode.ICategoryCode;
|
|
16
5
|
type IModel = Model<IDocType>;
|
|
17
6
|
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
@@ -10,7 +10,7 @@ exports.modelName = modelName;
|
|
|
10
10
|
const schemaDefinition = {
|
|
11
11
|
project: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
12
12
|
typeOf: { type: String, required: true },
|
|
13
|
-
additionalProperty: [
|
|
13
|
+
// additionalProperty: [SchemaTypes.Mixed],
|
|
14
14
|
color: String,
|
|
15
15
|
image: String,
|
|
16
16
|
codeValue: { type: String, required: true },
|
|
@@ -87,15 +87,6 @@ const indexes = [
|
|
|
87
87
|
'name.en': { $exists: true }
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
],
|
|
91
|
-
[
|
|
92
|
-
{ additionalProperty: 1, codeValue: 1 },
|
|
93
|
-
{
|
|
94
|
-
name: 'searchByAdditionalProperty',
|
|
95
|
-
partialFilterExpression: {
|
|
96
|
-
additionalProperty: { $exists: true }
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
90
|
]
|
|
100
91
|
];
|
|
101
92
|
exports.indexes = indexes;
|
|
@@ -2,7 +2,7 @@ import { AnyExpression, Connection, FilterQuery } from 'mongoose';
|
|
|
2
2
|
import { IMovieTicketType } from './mongoose/schemas/movieTicketTypes';
|
|
3
3
|
import * as factory from '../factory';
|
|
4
4
|
type IUnset = {
|
|
5
|
-
[key in keyof Pick<factory.
|
|
5
|
+
[key in keyof Pick<factory.movieTicketType.IMovieTicketType, 'color' | 'image'>]?: 1;
|
|
6
6
|
};
|
|
7
7
|
type IKeyOfProjection = keyof IMovieTicketType;
|
|
8
8
|
/**
|
|
@@ -11,17 +11,17 @@ type IKeyOfProjection = keyof IMovieTicketType;
|
|
|
11
11
|
export declare class MovieTicketTypeRepo {
|
|
12
12
|
private readonly categoryCodeModel;
|
|
13
13
|
constructor(connection: Connection);
|
|
14
|
-
static CREATE_MONGO_CONDITIONS(params: factory.
|
|
14
|
+
static CREATE_MONGO_CONDITIONS(params: factory.movieTicketType.ISearchConditions): FilterQuery<IMovieTicketType>[];
|
|
15
15
|
static CREATE_AGGREGATE_PROJECTION(inclusion: IKeyOfProjection[]): {
|
|
16
16
|
[field: string]: AnyExpression;
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
19
19
|
* 決済カード区分検索
|
|
20
20
|
*/
|
|
21
|
-
projectMovieTicketTypeFields(params: Omit<factory.
|
|
21
|
+
projectMovieTicketTypeFields(params: Omit<factory.movieTicketType.ISearchConditions, 'inCodeSet'> & {
|
|
22
22
|
inCodeSet?: {
|
|
23
23
|
identifier?: {
|
|
24
|
-
$eq?: factory.
|
|
24
|
+
$eq?: factory.movieTicketType.CategorySetIdentifier.MovieTicketType;
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
27
|
},
|
|
@@ -54,5 +54,6 @@ export declare class MovieTicketTypeRepo {
|
|
|
54
54
|
};
|
|
55
55
|
}): Promise<void>;
|
|
56
56
|
migrateCollections(connection: Connection): Promise<void>;
|
|
57
|
+
deleteOldMovieTicketTypes(connection: Connection): Promise<void>;
|
|
57
58
|
}
|
|
58
59
|
export {};
|
|
@@ -28,28 +28,22 @@ const movieTicketTypes_1 = require("./mongoose/schemas/movieTicketTypes");
|
|
|
28
28
|
const factory = require("../factory");
|
|
29
29
|
const settings_1 = require("../settings");
|
|
30
30
|
const AVAILABLE_PROJECT_FIELDS = [
|
|
31
|
-
'
|
|
31
|
+
'codeValue', 'color', 'image', 'inCodeSet', 'name', 'paymentMethod', 'project', 'typeOf'
|
|
32
32
|
];
|
|
33
|
-
const USE_MOVIE_TICKET_TYPE_SCHEMA = process.env.USE_MOVIE_TICKET_TYPE_SCHEMA === '1';
|
|
34
33
|
/**
|
|
35
34
|
* 決済カード区分リポジトリ
|
|
36
35
|
*/
|
|
37
36
|
class MovieTicketTypeRepo {
|
|
38
37
|
constructor(connection) {
|
|
39
|
-
|
|
40
|
-
this.categoryCodeModel = connection.model(movieTicketTypes_1.modelName, (0, movieTicketTypes_1.createSchema)());
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
this.categoryCodeModel = connection.model(categoryCode_1.modelName, (0, categoryCode_1.createSchema)());
|
|
44
|
-
}
|
|
38
|
+
this.categoryCodeModel = connection.model(movieTicketTypes_1.modelName, (0, movieTicketTypes_1.createSchema)());
|
|
45
39
|
}
|
|
46
40
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
47
41
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
48
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k
|
|
42
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
49
43
|
const andConditions = [
|
|
50
44
|
{
|
|
51
45
|
'inCodeSet.identifier': {
|
|
52
|
-
$eq: factory.
|
|
46
|
+
$eq: factory.movieTicketType.CategorySetIdentifier.MovieTicketType
|
|
53
47
|
}
|
|
54
48
|
}
|
|
55
49
|
];
|
|
@@ -145,15 +139,15 @@ class MovieTicketTypeRepo {
|
|
|
145
139
|
}
|
|
146
140
|
});
|
|
147
141
|
}
|
|
148
|
-
const additionalPropertyElemMatch =
|
|
149
|
-
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
142
|
+
// const additionalPropertyElemMatch = params.additionalProperty?.$elemMatch;
|
|
143
|
+
// if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
144
|
+
// andConditions.push({
|
|
145
|
+
// additionalProperty: {
|
|
146
|
+
// $exists: true,
|
|
147
|
+
// $elemMatch: additionalPropertyElemMatch
|
|
148
|
+
// }
|
|
149
|
+
// });
|
|
150
|
+
// }
|
|
157
151
|
return andConditions;
|
|
158
152
|
}
|
|
159
153
|
static CREATE_AGGREGATE_PROJECTION(inclusion) {
|
|
@@ -162,7 +156,7 @@ class MovieTicketTypeRepo {
|
|
|
162
156
|
id: { $toString: '$_id' },
|
|
163
157
|
project: '$project',
|
|
164
158
|
typeOf: '$typeOf',
|
|
165
|
-
additionalProperty: '$additionalProperty',
|
|
159
|
+
// additionalProperty: '$additionalProperty',
|
|
166
160
|
color: '$color',
|
|
167
161
|
image: '$image',
|
|
168
162
|
codeValue: '$codeValue',
|
|
@@ -271,7 +265,7 @@ class MovieTicketTypeRepo {
|
|
|
271
265
|
const oldCategoryCodeModel = connection.model(categoryCode_1.modelName, (0, categoryCode_1.createSchema)());
|
|
272
266
|
const movieTicketTypeModel = connection.model(movieTicketTypes_1.modelName, (0, movieTicketTypes_1.createSchema)());
|
|
273
267
|
const cursor = oldCategoryCodeModel.find({
|
|
274
|
-
'inCodeSet.identifier': { $eq: factory.
|
|
268
|
+
'inCodeSet.identifier': { $eq: factory.movieTicketType.CategorySetIdentifier.MovieTicketType }
|
|
275
269
|
})
|
|
276
270
|
.sort({ codeValue: factory.sortType.Ascending })
|
|
277
271
|
.cursor();
|
|
@@ -279,20 +273,33 @@ class MovieTicketTypeRepo {
|
|
|
279
273
|
yield cursor.eachAsync((doc) => __awaiter(this, void 0, void 0, function* () {
|
|
280
274
|
i += 1;
|
|
281
275
|
const movieTicketType = doc.toObject();
|
|
276
|
+
const { additionalProperty } = movieTicketType, docWithoutAdditinalProperty = __rest(movieTicketType, ["additionalProperty"]);
|
|
282
277
|
// tslint:disable-next-line:no-console
|
|
283
|
-
console.log('upserting...',
|
|
284
|
-
const result = yield movieTicketTypeModel.findOneAndReplace({ _id: { $eq: doc._id } },
|
|
278
|
+
console.log('upserting...', docWithoutAdditinalProperty, i);
|
|
279
|
+
const result = yield movieTicketTypeModel.findOneAndReplace({ _id: { $eq: doc._id } }, docWithoutAdditinalProperty, {
|
|
285
280
|
upsert: true,
|
|
286
281
|
projection: { _id: 1 }
|
|
287
282
|
})
|
|
288
283
|
.exec();
|
|
289
284
|
// await additionalPropertyRepo.save({ attributes: additionalProperty });
|
|
290
285
|
// tslint:disable-next-line:no-console
|
|
291
|
-
console.log('upserted', result, movieTicketType.id, movieTicketType.project.id, movieTicketType.codeValue);
|
|
286
|
+
console.log('upserted', result, movieTicketType.id, movieTicketType.project.id, movieTicketType.codeValue, i);
|
|
292
287
|
}));
|
|
293
288
|
// tslint:disable-next-line:no-console
|
|
294
289
|
console.log(i, 'docs checked');
|
|
295
290
|
});
|
|
296
291
|
}
|
|
292
|
+
// tslint:disable-next-line:prefer-function-over-method
|
|
293
|
+
deleteOldMovieTicketTypes(connection) {
|
|
294
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
295
|
+
const oldCategoryCodeModel = connection.model(categoryCode_1.modelName, (0, categoryCode_1.createSchema)());
|
|
296
|
+
const result = yield oldCategoryCodeModel.deleteMany({
|
|
297
|
+
'inCodeSet.identifier': { $eq: factory.movieTicketType.CategorySetIdentifier.MovieTicketType }
|
|
298
|
+
})
|
|
299
|
+
.exec();
|
|
300
|
+
// tslint:disable-next-line:no-console
|
|
301
|
+
console.log(result);
|
|
302
|
+
});
|
|
303
|
+
}
|
|
297
304
|
}
|
|
298
305
|
exports.MovieTicketTypeRepo = MovieTicketTypeRepo;
|
package/package.json
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.600.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.600.0",
|
|
14
|
-
"@chevre/factory": "5.2.0-alpha.
|
|
15
|
-
"@cinerino/sdk": "12.
|
|
14
|
+
"@chevre/factory": "5.2.0-alpha.4",
|
|
15
|
+
"@cinerino/sdk": "12.7.0-alpha.1",
|
|
16
16
|
"@motionpicture/coa-service": "9.6.0",
|
|
17
17
|
"@motionpicture/gmo-service": "5.4.0-alpha.1",
|
|
18
18
|
"@sendgrid/client": "8.1.4",
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"postversion": "git push origin --tags",
|
|
116
116
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
117
117
|
},
|
|
118
|
-
"version": "23.0.0-alpha.
|
|
118
|
+
"version": "23.0.0-alpha.28"
|
|
119
119
|
}
|