@chevre/domain 21.13.0-alpha.8 → 21.13.0
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/importEventsFromCOA.ts +11 -8
- package/example/src/chevre/migrateCognitoUser.ts +3 -3
- package/example/src/chevre/migrateOwnershipInfos2newUserPool.ts +2 -2
- package/example/src/chevre/ownershipInfosCsv2peopleJson.ts +3 -3
- package/example/src/chevre/person/globalSignOutAndDisable.ts +1 -1
- package/example/src/chevre/person/search.ts +3 -11
- package/example/src/chevre/person/updateProfile.ts +2 -2
- package/lib/chevre/repo/creativeWork.d.ts +7 -1
- package/lib/chevre/repo/creativeWork.js +36 -8
- package/lib/chevre/repo/event.d.ts +28 -11
- package/lib/chevre/repo/person.d.ts +6 -6
- package/lib/chevre/repo/person.js +12 -15
- package/lib/chevre/repo/place/hasPOS.d.ts +2 -2
- package/lib/chevre/repo/place.d.ts +11 -9
- package/lib/chevre/repo/place.js +44 -33
- package/lib/chevre/repo/reservation.d.ts +2 -2
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +0 -7
- package/lib/chevre/service/assetTransaction/reserve.js +1 -1
- package/lib/chevre/service/event.d.ts +2 -0
- package/lib/chevre/service/event.js +20 -1
- package/lib/chevre/service/offer.d.ts +2 -4
- package/lib/chevre/service/offer.js +1 -1
- package/lib/chevre/service/task/importEventsFromCOA.js +2 -0
- package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.d.ts +2 -0
- package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +8 -3
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +2 -0
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +2 -0
- package/lib/chevre/service/task/onResourceUpdated.js +3 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +4 -11
- package/package.json +7 -5
- package/example/src/chevre/csv2json.ts +0 -57
- package/example/src/chevre/person/createInformTask.ts +0 -77
|
@@ -10,28 +10,31 @@ const project = { id: String(process.env.PROJECT_ID) };
|
|
|
10
10
|
async function main() {
|
|
11
11
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
12
12
|
|
|
13
|
-
const actionRepo =
|
|
14
|
-
const categoryCodeRepo =
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
13
|
+
const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
|
|
14
|
+
const categoryCodeRepo = await chevre.repository.CategoryCode.createInstance(mongoose.connection);
|
|
15
|
+
const creativeWorkRepo = await chevre.repository.CreativeWork.createInstance(mongoose.connection);
|
|
16
|
+
const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
17
|
+
const placeRepo = await chevre.repository.Place.createInstance(mongoose.connection);
|
|
18
|
+
const sellerRepo = await chevre.repository.Seller.createInstance(mongoose.connection);
|
|
18
19
|
|
|
19
|
-
await chevre.service.event.importFromCOA({
|
|
20
|
+
await (await chevre.service.event.createService()).importFromCOA({
|
|
20
21
|
project: {
|
|
21
22
|
id: project.id,
|
|
22
23
|
typeOf: chevre.factory.organizationType.Project
|
|
23
24
|
},
|
|
24
|
-
locationBranchCode: '
|
|
25
|
+
locationBranchCode: '120',
|
|
25
26
|
importFrom: moment()
|
|
26
27
|
.toDate(),
|
|
27
28
|
importThrough: moment()
|
|
28
29
|
.add(1, 'day')
|
|
29
30
|
.toDate(),
|
|
30
31
|
saveMovieTheater: false,
|
|
31
|
-
saveScreeningEventSeries:
|
|
32
|
+
saveScreeningEventSeries: true,
|
|
33
|
+
saveScreeningEventSeriesPeriodInMonth: 24
|
|
32
34
|
})({
|
|
33
35
|
action: actionRepo,
|
|
34
36
|
categoryCode: categoryCodeRepo,
|
|
37
|
+
creativeWork: creativeWorkRepo,
|
|
35
38
|
event: eventRepo,
|
|
36
39
|
place: placeRepo,
|
|
37
40
|
seller: sellerRepo
|
|
@@ -13,7 +13,7 @@ export async function migrateUser(params: {
|
|
|
13
13
|
let oldPerson: chevre.factory.person.IPerson | undefined;
|
|
14
14
|
|
|
15
15
|
try {
|
|
16
|
-
const oldPersonRepo =
|
|
16
|
+
const oldPersonRepo = await chevre.repository.Person.createInstance({ userPoolId: USERPOOL_ID_OLD });
|
|
17
17
|
oldPerson = await oldPersonRepo.findById({ userId: params.id });
|
|
18
18
|
console.log('oldPerson found', oldPerson.id, oldPerson.givenName, oldPerson.familyName);
|
|
19
19
|
} catch (error) {
|
|
@@ -33,7 +33,7 @@ export async function migrateUser(params: {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
// create user
|
|
36
|
-
const newPersonRepo =
|
|
36
|
+
const newPersonRepo = await chevre.repository.Person.createInstance({ userPoolId: USERPOOL_ID_NEW });
|
|
37
37
|
const newUsername = `${NEW_USERPOOL_PROVIDER_NAME}_${oldPerson.id}`;
|
|
38
38
|
const newUserId = await new Promise<string>((resolve, reject) => {
|
|
39
39
|
newPersonRepo.cognitoIdentityServiceProvider.adminCreateUser(
|
|
@@ -60,7 +60,7 @@ export async function migrateUser(params: {
|
|
|
60
60
|
console.error('user not created.', err);
|
|
61
61
|
reject(err);
|
|
62
62
|
} else {
|
|
63
|
-
resolve(String(data
|
|
63
|
+
resolve(String(data?.User?.Attributes?.find((a) => a.Name === 'sub')?.Value));
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
);
|
|
@@ -16,7 +16,7 @@ const PRODUCT_TYPE = chevre.factory.product.ProductType.EventService;
|
|
|
16
16
|
async function main() {
|
|
17
17
|
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
18
18
|
|
|
19
|
-
const ownershipInfoRepo =
|
|
19
|
+
const ownershipInfoRepo = await chevre.repository.OwnershipInfo.createInstance(mongoose.connection);
|
|
20
20
|
|
|
21
21
|
const now = new Date();
|
|
22
22
|
const cursor = ownershipInfoRepo.getCursor(
|
|
@@ -78,7 +78,7 @@ async function main() {
|
|
|
78
78
|
ownershipInfo.typeOfGood.identifier,
|
|
79
79
|
ownershipInfo.ownedFrom,
|
|
80
80
|
owner.id, owner.memberOf?.membershipNumber, i, notFoundCount);
|
|
81
|
-
const personRepo =
|
|
81
|
+
const personRepo = await chevre.repository.Person.createInstance({ userPoolId: USERPOOL_ID_NEW });
|
|
82
82
|
|
|
83
83
|
try {
|
|
84
84
|
const newUserAttributes = await personRepo.getUserAttributes({ username: `SSKTS_${owner.id}` });
|
|
@@ -32,10 +32,10 @@ async function main() {
|
|
|
32
32
|
autoIndex: false
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
const sellerRepo =
|
|
35
|
+
const sellerRepo = await chevre.repository.Seller.createInstance(mongoose.connection);
|
|
36
36
|
const sellers = <Pick<chevre.factory.seller.ISeller, 'id' | 'name'>[]>await sellerRepo.search({}, ['_id', 'name'], []);
|
|
37
37
|
|
|
38
|
-
const personRepo =
|
|
38
|
+
const personRepo = await chevre.repository.Person.createInstance({
|
|
39
39
|
userPoolId: <string>process.env.COGNITO_USER_POOL_ID
|
|
40
40
|
});
|
|
41
41
|
|
|
@@ -132,7 +132,7 @@ function findAccount(params: {
|
|
|
132
132
|
now: Date;
|
|
133
133
|
}) {
|
|
134
134
|
return async (): Promise<chevre.factory.ownershipInfo.IPermitAsGood | undefined> => {
|
|
135
|
-
const ownershipInfoRepo =
|
|
135
|
+
const ownershipInfoRepo = await chevre.repository.OwnershipInfo.createInstance(mongoose.connection);
|
|
136
136
|
|
|
137
137
|
// let accountOwnershipInfos = await search({
|
|
138
138
|
// project: { typeOf: factory.organizationType.Project, id: params.project.id },
|
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
// tslint:disable:no-console no-magic-numbers
|
|
2
2
|
import { chevre } from '../../../../lib/index';
|
|
3
3
|
|
|
4
|
-
// const cognitoIdentityServiceProvider = new chevre.AWS.CognitoIdentityServiceProvider({
|
|
5
|
-
// apiVersion: 'latest',
|
|
6
|
-
// region: 'ap-northeast-1',
|
|
7
|
-
// credentials: new chevre.AWS.Credentials({
|
|
8
|
-
// accessKeyId: process.env.AWS_ACCESS_KEY_ID,
|
|
9
|
-
// secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY
|
|
10
|
-
// })
|
|
11
|
-
// });
|
|
12
|
-
|
|
13
4
|
async function main() {
|
|
14
5
|
const userPoolId = process.env.COGNITO_USER_POOL_ID;
|
|
15
|
-
const username = '
|
|
6
|
+
const username = 'Google_108017370984644649288';
|
|
16
7
|
|
|
17
|
-
const personRepo =
|
|
8
|
+
const personRepo = await chevre.repository.Person.createInstance({
|
|
18
9
|
userPoolId: String(userPoolId)
|
|
19
10
|
});
|
|
20
11
|
|
|
21
12
|
const people = await personRepo.search({
|
|
22
13
|
username: username
|
|
23
14
|
});
|
|
15
|
+
console.log(people[0]);
|
|
24
16
|
console.log(people.length, 'people found');
|
|
25
17
|
|
|
26
18
|
// await Promise.all(people.map(async (person) => {
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import { chevre } from '../../../../lib/index';
|
|
3
3
|
|
|
4
4
|
async function main() {
|
|
5
|
-
const personRepo =
|
|
5
|
+
const personRepo = await chevre.repository.Person.createInstance({
|
|
6
6
|
userPoolId: <string>process.env.COGNITO_USER_POOL_ID
|
|
7
7
|
});
|
|
8
8
|
|
|
9
|
-
const username = '';
|
|
9
|
+
const username = 'xxx';
|
|
10
10
|
|
|
11
11
|
let profile = await personRepo.getUserAttributes({
|
|
12
12
|
username: username
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
/// <reference types="mongoose/types/validation" />
|
|
23
23
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
+
import type { BulkWriteResult } from 'mongodb';
|
|
25
26
|
import type { Connection } from 'mongoose';
|
|
26
27
|
import * as factory from '../factory';
|
|
27
28
|
/**
|
|
@@ -35,10 +36,15 @@ export declare class MongoRepository {
|
|
|
35
36
|
* コンテンツを保管する
|
|
36
37
|
*/
|
|
37
38
|
saveMovie(params: factory.creativeWork.movie.ICreativeWork): Promise<any>;
|
|
39
|
+
/**
|
|
40
|
+
* コードをキーにして冪等作成
|
|
41
|
+
*/
|
|
42
|
+
upsertMoviesByIdentifier(params: {
|
|
43
|
+
attributes: factory.creativeWork.movie.ICreativeWork;
|
|
44
|
+
}[]): Promise<BulkWriteResult | void>;
|
|
38
45
|
findMovieById(params: {
|
|
39
46
|
id: string;
|
|
40
47
|
}): Promise<factory.creativeWork.movie.ICreativeWork>;
|
|
41
|
-
countMovies(params: factory.creativeWork.movie.ISearchConditions): Promise<number>;
|
|
42
48
|
/**
|
|
43
49
|
* コンテンツを検索する
|
|
44
50
|
*/
|
|
@@ -180,6 +180,42 @@ class MongoRepository {
|
|
|
180
180
|
return doc.toObject();
|
|
181
181
|
});
|
|
182
182
|
}
|
|
183
|
+
/**
|
|
184
|
+
* コードをキーにして冪等作成
|
|
185
|
+
*/
|
|
186
|
+
upsertMoviesByIdentifier(params) {
|
|
187
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
188
|
+
const bulkWriteOps = [];
|
|
189
|
+
if (Array.isArray(params)) {
|
|
190
|
+
params.forEach((creatingMovieParams) => {
|
|
191
|
+
const _a = creatingMovieParams.attributes, { typeOf, project, identifier, duration, name, additionalProperty, contentRating, headline, distributor, thumbnailUrl, datePublished } = _a, setOnInsertFields = __rest(_a, ["typeOf", "project", "identifier", "duration", "name", "additionalProperty", "contentRating", "headline", "distributor", "thumbnailUrl", "datePublished"]);
|
|
192
|
+
if (typeof identifier !== 'string' || identifier.length === 0) {
|
|
193
|
+
throw new factory.errors.ArgumentNull('identifier');
|
|
194
|
+
}
|
|
195
|
+
const updateFilter = {
|
|
196
|
+
$setOnInsert: Object.assign(Object.assign({}, setOnInsertFields), { typeOf,
|
|
197
|
+
project,
|
|
198
|
+
identifier }),
|
|
199
|
+
// 変更可能な属性のみ上書き
|
|
200
|
+
$set: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (name !== undefined) ? { name } : undefined), (contentRating !== undefined) ? { contentRating } : undefined), (duration !== undefined) ? { duration } : undefined), (headline !== undefined) ? { headline } : undefined), (datePublished !== undefined) ? { datePublished } : undefined), (distributor !== undefined) ? { distributor } : undefined), (typeof thumbnailUrl === 'string') ? { thumbnailUrl } : undefined), (Array.isArray(additionalProperty)) ? { additionalProperty } : [])
|
|
201
|
+
};
|
|
202
|
+
const updateOne = {
|
|
203
|
+
filter: {
|
|
204
|
+
typeOf: typeOf,
|
|
205
|
+
'project.id': { $eq: project.id },
|
|
206
|
+
identifier: { $eq: identifier }
|
|
207
|
+
},
|
|
208
|
+
update: updateFilter,
|
|
209
|
+
upsert: true
|
|
210
|
+
};
|
|
211
|
+
bulkWriteOps.push({ updateOne });
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
if (bulkWriteOps.length > 0) {
|
|
215
|
+
return this.creativeWorkModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
}
|
|
183
219
|
findMovieById(params) {
|
|
184
220
|
return __awaiter(this, void 0, void 0, function* () {
|
|
185
221
|
const doc = yield this.creativeWorkModel.findOne({ _id: params.id }, {
|
|
@@ -194,14 +230,6 @@ class MongoRepository {
|
|
|
194
230
|
return doc.toObject();
|
|
195
231
|
});
|
|
196
232
|
}
|
|
197
|
-
countMovies(params) {
|
|
198
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
199
|
-
const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
|
|
200
|
-
return this.creativeWorkModel.countDocuments({ $and: conditions })
|
|
201
|
-
.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
202
|
-
.exec();
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
233
|
/**
|
|
206
234
|
* コンテンツを検索する
|
|
207
235
|
*/
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
/// <reference types="mongoose/types/validation" />
|
|
23
23
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
-
import type { BulkWriteResult
|
|
25
|
+
import type { BulkWriteResult } from 'mongodb';
|
|
26
26
|
import type { Connection } from 'mongoose';
|
|
27
27
|
import * as factory from '../factory';
|
|
28
28
|
import * as EventFactory from '../factory/event';
|
|
@@ -77,11 +77,28 @@ interface IStatus {
|
|
|
77
77
|
export interface IAggregateEvent {
|
|
78
78
|
statuses: IStatus[];
|
|
79
79
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
type IKeyOfProjection<T extends factory.eventType> = keyof factory.event.IEvent<T> & '_id';
|
|
81
|
+
type IProjection<T extends factory.eventType> = {
|
|
82
|
+
[key in IKeyOfProjection<T>]?: 0 | 1;
|
|
83
|
+
};
|
|
83
84
|
export import IMinimizedIndividualEvent = EventFactory.IMinimizedIndividualEvent;
|
|
84
|
-
export declare const PROJECTION_MINIMIZED_EVENT:
|
|
85
|
+
export declare const PROJECTION_MINIMIZED_EVENT: {
|
|
86
|
+
project: number;
|
|
87
|
+
organizer: number;
|
|
88
|
+
_id: number;
|
|
89
|
+
typeOf: number;
|
|
90
|
+
additionalProperty: number;
|
|
91
|
+
name: number;
|
|
92
|
+
doorTime: number;
|
|
93
|
+
endDate: number;
|
|
94
|
+
eventStatus: number;
|
|
95
|
+
location: number;
|
|
96
|
+
startDate: number;
|
|
97
|
+
superEvent: number;
|
|
98
|
+
offers: number;
|
|
99
|
+
coaInfo: number;
|
|
100
|
+
identifier: number;
|
|
101
|
+
};
|
|
85
102
|
/**
|
|
86
103
|
* イベントリポジトリ
|
|
87
104
|
*/
|
|
@@ -106,7 +123,7 @@ export declare class MongoRepository {
|
|
|
106
123
|
name: string;
|
|
107
124
|
};
|
|
108
125
|
}[]): Promise<{
|
|
109
|
-
bulkWriteResult:
|
|
126
|
+
bulkWriteResult: BulkWriteResult;
|
|
110
127
|
modifiedEvents: {
|
|
111
128
|
id: string;
|
|
112
129
|
}[];
|
|
@@ -116,7 +133,7 @@ export declare class MongoRepository {
|
|
|
116
133
|
*/
|
|
117
134
|
createScreeningEventSeriesIfNotExistByWorkPerformed(params: {
|
|
118
135
|
attributes: factory.event.IAttributes<factory.eventType.ScreeningEventSeries>;
|
|
119
|
-
}[]): Promise<
|
|
136
|
+
}[]): Promise<BulkWriteResult | void>;
|
|
120
137
|
/**
|
|
121
138
|
* イベント部分更新
|
|
122
139
|
*/
|
|
@@ -133,13 +150,13 @@ export declare class MongoRepository {
|
|
|
133
150
|
save<T extends factory.eventType>(params: {
|
|
134
151
|
id?: string;
|
|
135
152
|
attributes: factory.event.IAttributes<T>;
|
|
136
|
-
$unset?: IProjection
|
|
153
|
+
$unset?: IProjection<T>;
|
|
137
154
|
upsert?: boolean;
|
|
138
155
|
}): Promise<factory.event.IEvent<T>>;
|
|
139
156
|
saveMany<T extends factory.eventType>(params: {
|
|
140
157
|
id: string;
|
|
141
158
|
attributes: factory.event.IAttributes<T>;
|
|
142
|
-
$unset?: IProjection
|
|
159
|
+
$unset?: IProjection<T>;
|
|
143
160
|
upsert: boolean;
|
|
144
161
|
}[]): Promise<void>;
|
|
145
162
|
save4ttts(params: {
|
|
@@ -149,7 +166,7 @@ export declare class MongoRepository {
|
|
|
149
166
|
/**
|
|
150
167
|
* イベントを検索する
|
|
151
168
|
*/
|
|
152
|
-
search<T extends factory.eventType>(params: ISearchConditions<T>, projection?: IProjection): Promise<factory.event.IEvent<T>[]>;
|
|
169
|
+
search<T extends factory.eventType>(params: ISearchConditions<T>, projection?: IProjection<T>): Promise<factory.event.IEvent<T>[]>;
|
|
153
170
|
searchIds<T extends factory.eventType>(params: ISearchConditions<T>): Promise<string[]>;
|
|
154
171
|
findMinimizedIndividualEventById<T extends factory.eventType.ScreeningEvent | factory.eventType.Event>(params: {
|
|
155
172
|
id: string;
|
|
@@ -275,7 +292,7 @@ export declare class MongoRepository {
|
|
|
275
292
|
updateAggregationById<T extends factory.eventType>(params: {
|
|
276
293
|
id: string;
|
|
277
294
|
}, update: IUpdateAggregateReservationParams | IUpdateAggregateUseActionsParams): Promise<factory.event.IEvent<T>>;
|
|
278
|
-
bulkWrite(bulkWriteOps: any[]): Promise<
|
|
295
|
+
bulkWrite(bulkWriteOps: any[]): Promise<BulkWriteResult & {
|
|
279
296
|
mongoose?: {
|
|
280
297
|
validationErrors: import("mongoose").Error[];
|
|
281
298
|
} | undefined;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CognitoIdentityProvider } from '@aws-sdk/client-cognito-identity-provider';
|
|
2
|
+
import type { AttributeType } from '@aws-sdk/client-cognito-identity-provider/dist-types/models/models_0';
|
|
2
3
|
import * as factory from '../factory';
|
|
3
|
-
export type AttributeListType = AWS.CognitoIdentityServiceProvider.AttributeListType;
|
|
4
4
|
export type IPerson = factory.person.IPerson;
|
|
5
5
|
/**
|
|
6
6
|
* 会員リポジトリ
|
|
7
7
|
*/
|
|
8
8
|
export declare class CognitoRepository {
|
|
9
|
-
readonly cognitoIdentityServiceProvider:
|
|
9
|
+
readonly cognitoIdentityServiceProvider: CognitoIdentityProvider;
|
|
10
10
|
private readonly userPoolId;
|
|
11
11
|
constructor(params: {
|
|
12
12
|
userPoolId: string;
|
|
13
13
|
});
|
|
14
14
|
static ATTRIBUTE2PROFILE(params: {
|
|
15
|
-
attributes?:
|
|
15
|
+
attributes?: AttributeType[];
|
|
16
16
|
}): factory.person.IProfile;
|
|
17
17
|
static ATTRIBUTE2PERSON(params: {
|
|
18
18
|
username?: string;
|
|
19
19
|
userPoolId?: string;
|
|
20
|
-
attributes?:
|
|
20
|
+
attributes?: AttributeType[];
|
|
21
21
|
}): factory.person.IPerson;
|
|
22
|
-
static PROFILE2ATTRIBUTE(params: factory.person.IProfile):
|
|
22
|
+
static PROFILE2ATTRIBUTE(params: factory.person.IProfile): AttributeType[];
|
|
23
23
|
/**
|
|
24
24
|
* 管理者権限でユーザー属性を取得する
|
|
25
25
|
*/
|
|
@@ -10,14 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.CognitoRepository = void 0;
|
|
13
|
-
const
|
|
13
|
+
const client_cognito_identity_provider_1 = require("@aws-sdk/client-cognito-identity-provider");
|
|
14
|
+
const credential_providers_1 = require("@aws-sdk/credential-providers");
|
|
14
15
|
const google_libphonenumber_1 = require("google-libphonenumber");
|
|
15
|
-
const credentials_1 = require("../credentials");
|
|
16
16
|
const factory = require("../factory");
|
|
17
|
-
const awsCredentials =
|
|
18
|
-
accessKeyId: credentials_1.credentials.aws.accessKeyId,
|
|
19
|
-
secretAccessKey: credentials_1.credentials.aws.secretAccessKey
|
|
20
|
-
});
|
|
17
|
+
const awsCredentials = (0, credential_providers_1.fromEnv)();
|
|
21
18
|
const TOKEN_ISSUER_ENDPOINT = 'https://cognito-idp.ap-northeast-1.amazonaws.com';
|
|
22
19
|
/**
|
|
23
20
|
* 会員リポジトリ
|
|
@@ -25,7 +22,7 @@ const TOKEN_ISSUER_ENDPOINT = 'https://cognito-idp.ap-northeast-1.amazonaws.com'
|
|
|
25
22
|
class CognitoRepository {
|
|
26
23
|
constructor(params) {
|
|
27
24
|
this.userPoolId = params.userPoolId;
|
|
28
|
-
this.cognitoIdentityServiceProvider = new
|
|
25
|
+
this.cognitoIdentityServiceProvider = new client_cognito_identity_provider_1.CognitoIdentityProvider({
|
|
29
26
|
apiVersion: 'latest',
|
|
30
27
|
region: 'ap-northeast-1',
|
|
31
28
|
credentials: awsCredentials
|
|
@@ -35,7 +32,7 @@ class CognitoRepository {
|
|
|
35
32
|
let additionalProperty = [];
|
|
36
33
|
if (Array.isArray(params.attributes)) {
|
|
37
34
|
additionalProperty = params.attributes.map((a) => {
|
|
38
|
-
return { name: a.Name, value: String(a.Value) };
|
|
35
|
+
return { name: String(a.Name), value: String(a.Value) };
|
|
39
36
|
});
|
|
40
37
|
}
|
|
41
38
|
const profile = {
|
|
@@ -188,7 +185,7 @@ class CognitoRepository {
|
|
|
188
185
|
reject(err);
|
|
189
186
|
}
|
|
190
187
|
else {
|
|
191
|
-
resolve(CognitoRepository.ATTRIBUTE2PROFILE({ attributes: data.UserAttributes }));
|
|
188
|
+
resolve(CognitoRepository.ATTRIBUTE2PROFILE({ attributes: data === null || data === void 0 ? void 0 : data.UserAttributes }));
|
|
192
189
|
}
|
|
193
190
|
});
|
|
194
191
|
});
|
|
@@ -232,7 +229,7 @@ class CognitoRepository {
|
|
|
232
229
|
else {
|
|
233
230
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
234
231
|
/* istanbul ignore if: please write tests */
|
|
235
|
-
if (data.Users === undefined) {
|
|
232
|
+
if ((data === null || data === void 0 ? void 0 : data.Users) === undefined) {
|
|
236
233
|
reject(new factory.errors.NotFound('User'));
|
|
237
234
|
}
|
|
238
235
|
else {
|
|
@@ -267,7 +264,7 @@ class CognitoRepository {
|
|
|
267
264
|
reject(err);
|
|
268
265
|
}
|
|
269
266
|
else {
|
|
270
|
-
resolve(CognitoRepository.ATTRIBUTE2PROFILE({ attributes: data.UserAttributes }));
|
|
267
|
+
resolve(CognitoRepository.ATTRIBUTE2PROFILE({ attributes: data === null || data === void 0 ? void 0 : data.UserAttributes }));
|
|
271
268
|
}
|
|
272
269
|
});
|
|
273
270
|
});
|
|
@@ -310,7 +307,7 @@ class CognitoRepository {
|
|
|
310
307
|
else {
|
|
311
308
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
312
309
|
/* istanbul ignore if: please write tests */
|
|
313
|
-
if (data.Users === undefined) {
|
|
310
|
+
if ((data === null || data === void 0 ? void 0 : data.Users) === undefined) {
|
|
314
311
|
reject(new factory.errors.NotFound('User'));
|
|
315
312
|
}
|
|
316
313
|
else {
|
|
@@ -353,7 +350,7 @@ class CognitoRepository {
|
|
|
353
350
|
else {
|
|
354
351
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
355
352
|
/* istanbul ignore if: please write tests */
|
|
356
|
-
if (data.Users === undefined) {
|
|
353
|
+
if ((data === null || data === void 0 ? void 0 : data.Users) === undefined) {
|
|
357
354
|
reject(new factory.errors.NotFound('User'));
|
|
358
355
|
}
|
|
359
356
|
else {
|
|
@@ -395,7 +392,7 @@ class CognitoRepository {
|
|
|
395
392
|
reject(listUsersErr);
|
|
396
393
|
}
|
|
397
394
|
else {
|
|
398
|
-
const username = (_b = (_a = data.Users) === null || _a === void 0 ? void 0 : _a.shift()) === null || _b === void 0 ? void 0 : _b.Username;
|
|
395
|
+
const username = (_b = (_a = data === null || data === void 0 ? void 0 : data.Users) === null || _a === void 0 ? void 0 : _a.shift()) === null || _b === void 0 ? void 0 : _b.Username;
|
|
399
396
|
if (typeof username !== 'string') {
|
|
400
397
|
reject(new factory.errors.NotFound('User'));
|
|
401
398
|
}
|
|
@@ -474,7 +471,7 @@ class CognitoRepository {
|
|
|
474
471
|
else {
|
|
475
472
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
476
473
|
/* istanbul ignore if: please write tests */
|
|
477
|
-
if (data.Users === undefined) {
|
|
474
|
+
if ((data === null || data === void 0 ? void 0 : data.Users) === undefined) {
|
|
478
475
|
reject(new factory.errors.NotFound('User'));
|
|
479
476
|
}
|
|
480
477
|
else {
|
|
@@ -13,8 +13,8 @@ interface IOperator {
|
|
|
13
13
|
* 施設のPOSリポジトリ
|
|
14
14
|
*/
|
|
15
15
|
export declare class MongoRepository {
|
|
16
|
+
readonly operator: IOperator;
|
|
16
17
|
private readonly placeModel;
|
|
17
|
-
private readonly operator;
|
|
18
18
|
constructor(connection: Connection, operater: IOperator);
|
|
19
19
|
search(params: {
|
|
20
20
|
limit?: number;
|
|
@@ -28,7 +28,7 @@ export declare class MongoRepository {
|
|
|
28
28
|
$eq?: string;
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
|
-
}): Promise<Pick<factory.place.movieTheater.IPOS, 'branchCode' | 'name'>[]>;
|
|
31
|
+
}): Promise<Pick<factory.place.movieTheater.IPOS, 'branchCode' | 'name' | 'id'>[]>;
|
|
32
32
|
createByBranchCode(params: Pick<factory.place.movieTheater.IPOS, 'branchCode' | 'name'> & {
|
|
33
33
|
project: {
|
|
34
34
|
id: string;
|
|
@@ -22,10 +22,13 @@
|
|
|
22
22
|
/// <reference types="mongoose/types/validation" />
|
|
23
23
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
-
import type { Connection } from 'mongoose';
|
|
25
|
+
import type { AnyExpression, Connection } from 'mongoose';
|
|
26
26
|
import * as factory from '../factory';
|
|
27
27
|
type IScreeningRoomSectionWithoutContainsPlace = Omit<factory.place.screeningRoomSection.IPlace, 'containsPlace'>;
|
|
28
28
|
export type IScreeningRoomFoundByBranchCode = Pick<factory.place.screeningRoom.IPlace, 'typeOf' | 'branchCode' | 'name' | 'containsPlace' | 'seatCount' | 'parentOrganization'>;
|
|
29
|
+
export type IMovieTheaterIncludingScreeningRooms = factory.place.movieTheater.IPlace & {
|
|
30
|
+
containsPlace: factory.place.screeningRoom.IPlace[];
|
|
31
|
+
};
|
|
29
32
|
/**
|
|
30
33
|
* 施設リポジトリ
|
|
31
34
|
*/
|
|
@@ -34,15 +37,18 @@ export declare class MongoRepository {
|
|
|
34
37
|
constructor(connection: Connection);
|
|
35
38
|
static CREATE_BUS_STOP_MONGO_CONDITIONS(params: factory.place.busStop.ISearchConditions): any[];
|
|
36
39
|
static CREATE_MOVIE_THEATER_MONGO_CONDITIONS(params: factory.place.movieTheater.ISearchConditions): any[];
|
|
40
|
+
static CREATE_SEARCH_SEATS_PROJECTION(params: factory.place.seat.IProjection): {
|
|
41
|
+
[field: string]: AnyExpression;
|
|
42
|
+
};
|
|
37
43
|
/**
|
|
38
44
|
* 施設を保管する
|
|
39
45
|
*/
|
|
40
|
-
saveMovieTheater(params: factory.place.movieTheater.
|
|
41
|
-
saveMovieTheaterByBranchCode4coa(params:
|
|
46
|
+
saveMovieTheater(params: factory.place.movieTheater.IPlace): Promise<factory.place.movieTheater.IPlace>;
|
|
47
|
+
saveMovieTheaterByBranchCode4coa(params: IMovieTheaterIncludingScreeningRooms): Promise<void>;
|
|
42
48
|
/**
|
|
43
49
|
* 施設検索
|
|
44
50
|
*/
|
|
45
|
-
searchMovieTheaters(params: factory.place.movieTheater.ISearchConditions
|
|
51
|
+
searchMovieTheaters(params: factory.place.movieTheater.ISearchConditions, inclusion: (keyof factory.place.movieTheater.IPlace | '_id' | 'url')[], exclusion: string[]): Promise<factory.place.movieTheater.IPlace[]>;
|
|
46
52
|
deleteMovieTheaterById(params: {
|
|
47
53
|
project: {
|
|
48
54
|
id: string;
|
|
@@ -156,11 +162,7 @@ export declare class MongoRepository {
|
|
|
156
162
|
};
|
|
157
163
|
typeOf: factory.placeType.ScreeningRoom;
|
|
158
164
|
}>;
|
|
159
|
-
searchScreeningRoomSections(searchConditions: factory.place.screeningRoomSection.ISearchConditions
|
|
160
|
-
$projection?: {
|
|
161
|
-
[key: string]: number;
|
|
162
|
-
};
|
|
163
|
-
}): Promise<IScreeningRoomSectionWithoutContainsPlace[]>;
|
|
165
|
+
searchScreeningRoomSections(searchConditions: factory.place.screeningRoomSection.ISearchConditions): Promise<IScreeningRoomSectionWithoutContainsPlace[]>;
|
|
164
166
|
deleteScreeningRoomSection(screeningRoomSection: {
|
|
165
167
|
project: {
|
|
166
168
|
id: string;
|
package/lib/chevre/repo/place.js
CHANGED
|
@@ -209,6 +209,43 @@ class MongoRepository {
|
|
|
209
209
|
}
|
|
210
210
|
return andConditions;
|
|
211
211
|
}
|
|
212
|
+
static CREATE_SEARCH_SEATS_PROJECTION(params) {
|
|
213
|
+
let includeScreeningRooms = true;
|
|
214
|
+
if (params['containedInPlace.containedInPlace'] === 0) {
|
|
215
|
+
includeScreeningRooms = false;
|
|
216
|
+
}
|
|
217
|
+
const projectStage = {
|
|
218
|
+
_id: 0,
|
|
219
|
+
typeOf: '$containsPlace.containsPlace.typeOf',
|
|
220
|
+
branchCode: '$containsPlace.containsPlace.branchCode',
|
|
221
|
+
name: '$containsPlace.containsPlace.name',
|
|
222
|
+
seatingType: '$containsPlace.containsPlace.seatingType',
|
|
223
|
+
containedInPlace: Object.assign({ typeOf: '$containsPlace.typeOf', branchCode: '$containsPlace.branchCode', name: '$containsPlace.name' }, (includeScreeningRooms)
|
|
224
|
+
? {
|
|
225
|
+
containedInPlace: {
|
|
226
|
+
typeOf: '$typeOf',
|
|
227
|
+
branchCode: '$branchCode',
|
|
228
|
+
name: '$name',
|
|
229
|
+
containedInPlace: {
|
|
230
|
+
id: '$containedInPlace.id',
|
|
231
|
+
typeOf: '$containedInPlace.typeOf',
|
|
232
|
+
branchCode: '$containedInPlace.branchCode',
|
|
233
|
+
name: '$containedInPlace.name'
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
: undefined),
|
|
238
|
+
additionalProperty: '$containsPlace.containsPlace.additionalProperty'
|
|
239
|
+
};
|
|
240
|
+
Object.keys(params)
|
|
241
|
+
.forEach((field) => {
|
|
242
|
+
if (typeof projectStage[field] === 'string') {
|
|
243
|
+
// tslint:disable-next-line:no-dynamic-delete
|
|
244
|
+
delete projectStage[field];
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
return projectStage;
|
|
248
|
+
}
|
|
212
249
|
/**
|
|
213
250
|
* 施設を保管する
|
|
214
251
|
*/
|
|
@@ -305,7 +342,9 @@ class MongoRepository {
|
|
|
305
342
|
let projection = {};
|
|
306
343
|
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
307
344
|
inclusion.forEach((field) => {
|
|
308
|
-
|
|
345
|
+
if (String(field) !== 'containsPlace' && String(field) !== 'hasPOS') { // 除外(2023-10-26~)
|
|
346
|
+
projection[field] = 1;
|
|
347
|
+
}
|
|
309
348
|
});
|
|
310
349
|
}
|
|
311
350
|
else {
|
|
@@ -314,7 +353,8 @@ class MongoRepository {
|
|
|
314
353
|
createdAt: 0,
|
|
315
354
|
updatedAt: 0,
|
|
316
355
|
// containsPlaceを含めるとデータサイズが大きくなるので、検索結果には含めない
|
|
317
|
-
containsPlace: 0
|
|
356
|
+
containsPlace: 0,
|
|
357
|
+
hasPOS: 0 // 除外(2023-10-26~)
|
|
318
358
|
};
|
|
319
359
|
if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
320
360
|
exclusion.forEach((field) => {
|
|
@@ -1193,11 +1233,6 @@ class MongoRepository {
|
|
|
1193
1233
|
}
|
|
1194
1234
|
});
|
|
1195
1235
|
}
|
|
1196
|
-
let includeScreeningRooms = true;
|
|
1197
|
-
if (params.$projection !== undefined && params.$projection !== null
|
|
1198
|
-
&& params.$projection['containedInPlace.containedInPlace'] === 0) {
|
|
1199
|
-
includeScreeningRooms = false;
|
|
1200
|
-
}
|
|
1201
1236
|
const additionalPropertyElemMatch = (_o = params.additionalProperty) === null || _o === void 0 ? void 0 : _o.$elemMatch;
|
|
1202
1237
|
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
1203
1238
|
matchStages.push({
|
|
@@ -1209,36 +1244,12 @@ class MongoRepository {
|
|
|
1209
1244
|
}
|
|
1210
1245
|
});
|
|
1211
1246
|
}
|
|
1247
|
+
const projectStage = MongoRepository.CREATE_SEARCH_SEATS_PROJECTION(Object.assign({}, params.$projection));
|
|
1212
1248
|
const aggregate = this.placeModel.aggregate([
|
|
1213
1249
|
{ $unwind: '$containsPlace' },
|
|
1214
1250
|
{ $unwind: '$containsPlace.containsPlace' },
|
|
1215
|
-
// { $unwind: '$containsPlace.containsPlace.containsPlace' },
|
|
1216
1251
|
...matchStages,
|
|
1217
|
-
{
|
|
1218
|
-
$project: {
|
|
1219
|
-
_id: 0,
|
|
1220
|
-
typeOf: '$containsPlace.containsPlace.typeOf',
|
|
1221
|
-
branchCode: '$containsPlace.containsPlace.branchCode',
|
|
1222
|
-
name: '$containsPlace.containsPlace.name',
|
|
1223
|
-
seatingType: '$containsPlace.containsPlace.seatingType',
|
|
1224
|
-
containedInPlace: Object.assign({ typeOf: '$containsPlace.typeOf', branchCode: '$containsPlace.branchCode', name: '$containsPlace.name' }, (includeScreeningRooms)
|
|
1225
|
-
? {
|
|
1226
|
-
containedInPlace: {
|
|
1227
|
-
typeOf: '$typeOf',
|
|
1228
|
-
branchCode: '$branchCode',
|
|
1229
|
-
name: '$name',
|
|
1230
|
-
containedInPlace: {
|
|
1231
|
-
id: '$containedInPlace.id',
|
|
1232
|
-
typeOf: '$containedInPlace.typeOf',
|
|
1233
|
-
branchCode: '$containedInPlace.branchCode',
|
|
1234
|
-
name: '$containedInPlace.name'
|
|
1235
|
-
}
|
|
1236
|
-
}
|
|
1237
|
-
}
|
|
1238
|
-
: undefined),
|
|
1239
|
-
additionalProperty: '$containsPlace.containsPlace.additionalProperty'
|
|
1240
|
-
}
|
|
1241
|
-
}
|
|
1252
|
+
{ $project: projectStage }
|
|
1242
1253
|
]);
|
|
1243
1254
|
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
1244
1255
|
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
/// <reference types="mongoose/types/validation" />
|
|
23
23
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
-
import { BulkWriteResult
|
|
25
|
+
import type { BulkWriteResult } from 'mongodb';
|
|
26
26
|
import type { Connection, UpdateWriteOpResult } from 'mongoose';
|
|
27
27
|
import * as factory from '../factory';
|
|
28
28
|
export interface IUpdatePartiallyParams {
|
|
@@ -63,7 +63,7 @@ export declare class MongoRepository {
|
|
|
63
63
|
reservationFor: factory.assetTransaction.reserve.IReservationFor;
|
|
64
64
|
underName?: factory.reservation.IUnderName<factory.reservationType.EventReservation>;
|
|
65
65
|
broker?: factory.reservation.IBroker<factory.reservationType>;
|
|
66
|
-
}): Promise<
|
|
66
|
+
}): Promise<BulkWriteResult | void>;
|
|
67
67
|
/**
|
|
68
68
|
* 予約取消
|
|
69
69
|
*/
|
|
@@ -61,13 +61,6 @@ function findEntranceGates(params) {
|
|
|
61
61
|
limit: 1,
|
|
62
62
|
page: 1,
|
|
63
63
|
id: { $eq: params.event.superEvent.location.id }
|
|
64
|
-
// $projection: {
|
|
65
|
-
// containsPlace: 0,
|
|
66
|
-
// hasPOS: 0,
|
|
67
|
-
// offers: 0,
|
|
68
|
-
// parentOrganization: 0,
|
|
69
|
-
// name: 0
|
|
70
|
-
// }
|
|
71
64
|
}, ['hasEntranceGate'], []);
|
|
72
65
|
movieTheater = searchMovieTheatersResult.shift();
|
|
73
66
|
// movieTheater = await repos.place.findById(
|
|
@@ -223,7 +223,7 @@ function searchEventSeatOffers(params) {
|
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
},
|
|
226
|
-
$projection: params.$projection
|
|
226
|
+
$projection: Object.assign({}, params.$projection)
|
|
227
227
|
});
|
|
228
228
|
if (seats.length > 0) {
|
|
229
229
|
const availabilities = yield repos.stockHolder.searchHolders({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { MongoRepository as ActionRepo } from '../repo/action';
|
|
2
2
|
import type { MongoRepository as CategoryCodeRepo } from '../repo/categoryCode';
|
|
3
|
+
import type { MongoRepository as CreativeWorkRepo } from '../repo/creativeWork';
|
|
3
4
|
import type { MongoRepository as EventRepo } from '../repo/event';
|
|
4
5
|
import type { MongoRepository as PlaceRepo } from '../repo/place';
|
|
5
6
|
import type { MongoRepository as ProjectRepo } from '../repo/project';
|
|
@@ -36,6 +37,7 @@ export declare function importFromCOA(params: {
|
|
|
36
37
|
}): (repos: {
|
|
37
38
|
action: ActionRepo;
|
|
38
39
|
categoryCode: CategoryCodeRepo;
|
|
40
|
+
creativeWork: CreativeWorkRepo;
|
|
39
41
|
event: EventRepo;
|
|
40
42
|
place: PlaceRepo;
|
|
41
43
|
seller: SellerRepo;
|
|
@@ -199,8 +199,8 @@ function importFromCOA(params) {
|
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
201
|
exports.importFromCOA = importFromCOA;
|
|
202
|
-
// tslint:disable-next-line:max-func-body-length
|
|
203
202
|
function saveScreeningEventSeries(params) {
|
|
203
|
+
// tslint:disable-next-line:max-func-body-length
|
|
204
204
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
205
205
|
const project = params.project;
|
|
206
206
|
const masterService = new COA.service.Master({
|
|
@@ -272,6 +272,25 @@ function saveScreeningEventSeries(params) {
|
|
|
272
272
|
yield repos.event.saveMany(saveParams);
|
|
273
273
|
debug('saved', saveParams.length, 'ScreeningEventSeries');
|
|
274
274
|
savedEventsCount = saveParams.length;
|
|
275
|
+
// コンテンツ永続化(2023-10-23~)
|
|
276
|
+
try {
|
|
277
|
+
debug('saving', saveParams.length, 'movies...');
|
|
278
|
+
yield repos.creativeWork.upsertMoviesByIdentifier(saveParams.map((saveScreeningEventSeriesParams) => {
|
|
279
|
+
var _a;
|
|
280
|
+
return {
|
|
281
|
+
attributes: Object.assign(Object.assign({ typeOf: factory.creativeWorkType.Movie, project: params.project, identifier: saveScreeningEventSeriesParams.attributes.workPerformed.identifier, name: { ja: (_a = saveScreeningEventSeriesParams.attributes.workPerformed.name) === null || _a === void 0 ? void 0 : _a.ja }, offers: { typeOf: factory.offerType.Offer } }, (typeof saveScreeningEventSeriesParams.attributes.workPerformed.contentRating === 'string')
|
|
282
|
+
? { contentRating: saveScreeningEventSeriesParams.attributes.workPerformed.contentRating }
|
|
283
|
+
: undefined), (typeof saveScreeningEventSeriesParams.attributes.workPerformed.duration === 'string')
|
|
284
|
+
? { duration: saveScreeningEventSeriesParams.attributes.workPerformed.duration }
|
|
285
|
+
: undefined)
|
|
286
|
+
};
|
|
287
|
+
}));
|
|
288
|
+
debug('saved', saveParams.length, 'movies');
|
|
289
|
+
}
|
|
290
|
+
catch (error) {
|
|
291
|
+
// tslint:disable-next-line:no-console
|
|
292
|
+
console.error('failed in upsertMoviesByIdentifier', error);
|
|
293
|
+
}
|
|
275
294
|
}
|
|
276
295
|
return { screeningEventSerieses, savedEventsCount };
|
|
277
296
|
});
|
|
@@ -38,15 +38,13 @@ export declare function searchEventSeatOffersWithPaging(params: {
|
|
|
38
38
|
event: {
|
|
39
39
|
id: string;
|
|
40
40
|
};
|
|
41
|
-
$projection?:
|
|
42
|
-
[key: string]: number;
|
|
43
|
-
};
|
|
41
|
+
$projection?: factory.place.seat.IProjection;
|
|
44
42
|
}): (repos: {
|
|
45
43
|
event: EventRepo;
|
|
46
44
|
priceSpecification: PriceSpecificationRepo;
|
|
47
45
|
stockHolder: StockHolderRepo;
|
|
48
46
|
place: PlaceRepo;
|
|
49
|
-
}) => Promise<factory.place.seat.IPlaceWithOffer[]>;
|
|
47
|
+
}) => Promise<Pick<factory.place.seat.IPlaceWithOffer, 'branchCode' | 'containedInPlace' | 'offers' | 'seatingType' | 'typeOf'>[]>;
|
|
50
48
|
/**
|
|
51
49
|
* イベント変更時処理
|
|
52
50
|
*/
|
|
@@ -88,7 +88,7 @@ function searchEventSeatOffersWithPaging(params) {
|
|
|
88
88
|
branchCode: { $eq: movieTheaterBranchCode }
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
} }));
|
|
91
|
+
}, $projection: Object.assign({}, params.$projection) }));
|
|
92
92
|
if (seats.length > 0) {
|
|
93
93
|
const availabilities = yield repos.stockHolder.searchHolders({
|
|
94
94
|
project: { id: event.project.id },
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.call = void 0;
|
|
13
13
|
const action_1 = require("../../repo/action");
|
|
14
14
|
const categoryCode_1 = require("../../repo/categoryCode");
|
|
15
|
+
const creativeWork_1 = require("../../repo/creativeWork");
|
|
15
16
|
const event_1 = require("../../repo/event");
|
|
16
17
|
const place_1 = require("../../repo/place");
|
|
17
18
|
const seller_1 = require("../../repo/seller");
|
|
@@ -24,6 +25,7 @@ function call(data) {
|
|
|
24
25
|
yield EventService.importFromCOA(data)({
|
|
25
26
|
action: new action_1.MongoRepository(settings.connection),
|
|
26
27
|
categoryCode: new categoryCode_1.MongoRepository(settings.connection),
|
|
28
|
+
creativeWork: new creativeWork_1.MongoRepository(settings.connection),
|
|
27
29
|
event: new event_1.MongoRepository(settings.connection),
|
|
28
30
|
place: new place_1.MongoRepository(settings.connection),
|
|
29
31
|
seller: new seller_1.MongoRepository(settings.connection)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as factory from '../../../factory';
|
|
2
2
|
import type { MongoRepository as PlaceRepo } from '../../../repo/place';
|
|
3
|
+
import type { MongoRepository as HasPOSRepo } from '../../../repo/place/hasPOS';
|
|
3
4
|
import type { MongoRepository as TaskRepo } from '../../../repo/task';
|
|
4
5
|
export declare function createInformHasPOSTasks(params: {
|
|
5
6
|
project: {
|
|
@@ -11,6 +12,7 @@ export declare function createInformHasPOSTasks(params: {
|
|
|
11
12
|
ids: string[];
|
|
12
13
|
typeOf: factory.placeType.MovieTheater;
|
|
13
14
|
}): (repos: {
|
|
15
|
+
hasPOS: HasPOSRepo;
|
|
14
16
|
place: PlaceRepo;
|
|
15
17
|
task: TaskRepo;
|
|
16
18
|
}) => Promise<void>;
|
|
@@ -18,19 +18,24 @@ function createInformHasPOSTasks(params) {
|
|
|
18
18
|
if (params.ids.length !== 1) {
|
|
19
19
|
throw new factory.errors.Argument('id', 'id.length must be 1');
|
|
20
20
|
}
|
|
21
|
-
// 施設のhasPOSを全て連携する
|
|
22
21
|
const movieTheaters = yield repos.place.searchMovieTheaters({
|
|
23
22
|
limit: 1,
|
|
24
23
|
page: 1,
|
|
25
24
|
project: { id: { $eq: params.project.id } },
|
|
26
25
|
id: { $eq: params.ids[0] }
|
|
27
|
-
}, ['
|
|
26
|
+
}, ['_id'], []);
|
|
28
27
|
const movieTheater = movieTheaters.shift();
|
|
29
28
|
if (movieTheater === undefined) {
|
|
30
29
|
throw new factory.errors.NotFound(factory.placeType.MovieTheater);
|
|
31
30
|
}
|
|
31
|
+
// 施設のhasPOSを全て連携する
|
|
32
|
+
repos.hasPOS.operator.id = movieTheater.id;
|
|
33
|
+
const hasPOS = yield repos.hasPOS.search({
|
|
34
|
+
project: { id: { $eq: params.project.id } }
|
|
35
|
+
});
|
|
32
36
|
const movieTheaters4inform = [{
|
|
33
|
-
hasPOS: (Array.isArray(movieTheater.hasPOS)) ? movieTheater.hasPOS : [],
|
|
37
|
+
// hasPOS: (Array.isArray(movieTheater.hasPOS)) ? movieTheater.hasPOS : [],
|
|
38
|
+
hasPOS: (Array.isArray(hasPOS)) ? hasPOS : [],
|
|
34
39
|
id: movieTheater.id,
|
|
35
40
|
typeOf: factory.placeType.MovieTheater
|
|
36
41
|
}];
|
|
@@ -11,6 +11,7 @@ import type { MongoRepository as OfferCatalogRepo } from '../../../repo/offerCat
|
|
|
11
11
|
import type { MongoRepository as OfferCatalogItemRepo } from '../../../repo/offerCatalogItem';
|
|
12
12
|
import type { MongoRepository as PaymentServiceProviderRepo } from '../../../repo/paymentServiceProvider';
|
|
13
13
|
import type { MongoRepository as PlaceRepo } from '../../../repo/place';
|
|
14
|
+
import type { MongoRepository as HasPOSRepo } from '../../../repo/place/hasPOS';
|
|
14
15
|
import type { MongoRepository as ProductRepo } from '../../../repo/product';
|
|
15
16
|
import type { MongoRepository as ProductOfferRepo } from '../../../repo/productOffer';
|
|
16
17
|
import type { MongoRepository as TaskRepo } from '../../../repo/task';
|
|
@@ -21,6 +22,7 @@ export declare function onResourceDeleted(params: factory.task.onResourceUpdated
|
|
|
21
22
|
categoryCode: CategoryCodeRepo;
|
|
22
23
|
creativeWork: CreativeWorkRepo;
|
|
23
24
|
event: EventRepo;
|
|
25
|
+
hasPOS: HasPOSRepo;
|
|
24
26
|
member: MemberRepo;
|
|
25
27
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
26
28
|
offer: OfferRepo;
|
|
@@ -23,6 +23,7 @@ const offerCatalog_1 = require("../../repo/offerCatalog");
|
|
|
23
23
|
const offerCatalogItem_1 = require("../../repo/offerCatalogItem");
|
|
24
24
|
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
25
25
|
const place_1 = require("../../repo/place");
|
|
26
|
+
const hasPOS_1 = require("../../repo/place/hasPOS");
|
|
26
27
|
const product_1 = require("../../repo/product");
|
|
27
28
|
const productOffer_1 = require("../../repo/productOffer");
|
|
28
29
|
const task_1 = require("../../repo/task");
|
|
@@ -43,6 +44,7 @@ function call(data) {
|
|
|
43
44
|
categoryCode: new categoryCode_1.MongoRepository(connectionSettings.connection),
|
|
44
45
|
creativeWork: new creativeWork_1.MongoRepository(connectionSettings.connection),
|
|
45
46
|
event: new event_1.MongoRepository(connectionSettings.connection),
|
|
47
|
+
hasPOS: new hasPOS_1.MongoRepository(connectionSettings.connection, { id: '' }),
|
|
46
48
|
member: new member_1.MongoRepository(connectionSettings.connection),
|
|
47
49
|
offer: new offer_1.MongoRepository(connectionSettings.connection),
|
|
48
50
|
offerCatalog: new offerCatalog_1.MongoRepository(connectionSettings.connection),
|
|
@@ -290,7 +292,7 @@ function createInformMovieTheaterTasks(params) {
|
|
|
290
292
|
'additionalProperty',
|
|
291
293
|
'branchCode',
|
|
292
294
|
'hasEntranceGate',
|
|
293
|
-
'hasPOS',
|
|
295
|
+
// 'hasPOS',
|
|
294
296
|
'kanaName',
|
|
295
297
|
'name',
|
|
296
298
|
'parentOrganization',
|
|
@@ -87,19 +87,12 @@ function createPaymentMethods(params) {
|
|
|
87
87
|
const paymentMethodOfInvoice = Object.assign({ identifier: paymentMethodType }, (typeof paymentMethodAmountCurrencyByAuthorizeAction === 'string') ?
|
|
88
88
|
{ amount: { currency: paymentMethodAmountCurrencyByAuthorizeAction } }
|
|
89
89
|
: undefined);
|
|
90
|
-
paymentMethods.push({
|
|
91
|
-
accountId: resultAsInvoice.accountId,
|
|
92
|
-
additionalProperty: (Array.isArray(resultAsInvoice.additionalProperty)) ? resultAsInvoice.additionalProperty : [],
|
|
93
|
-
issuedThrough: resultAsInvoice.issuedThrough,
|
|
94
|
-
name: resultAsInvoice.name,
|
|
95
|
-
paymentMethodId: resultAsInvoice.paymentMethodId,
|
|
96
|
-
paymentStatus: resultAsInvoice.paymentStatus,
|
|
97
|
-
totalPaymentDue: resultAsInvoice.totalPaymentDue,
|
|
98
|
-
typeOf: paymentMethodType,
|
|
90
|
+
paymentMethods.push(Object.assign({ accountId: resultAsInvoice.accountId, additionalProperty: (Array.isArray(resultAsInvoice.additionalProperty)) ? resultAsInvoice.additionalProperty : [], issuedThrough: resultAsInvoice.issuedThrough, name: resultAsInvoice.name, paymentMethodId: resultAsInvoice.paymentMethodId, paymentStatus: resultAsInvoice.paymentStatus, totalPaymentDue: resultAsInvoice.totalPaymentDue,
|
|
99
91
|
// CreditCardIFのカード通貨区分を追加(2023-08-15~)
|
|
100
92
|
// 決済方法区分を保証(2023-08-28~)
|
|
101
|
-
paymentMethod: paymentMethodOfInvoice
|
|
102
|
-
|
|
93
|
+
paymentMethod: paymentMethodOfInvoice }, {
|
|
94
|
+
typeOf: paymentMethodType // IFとして廃止だが、互換性維持対応として(2023-10-30~)
|
|
95
|
+
}));
|
|
103
96
|
});
|
|
104
97
|
// 決済方法から注文金額の計算
|
|
105
98
|
price += authorizePaymentActions
|
package/package.json
CHANGED
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@
|
|
13
|
-
"@
|
|
12
|
+
"@aws-sdk/credential-providers": "3.433.0",
|
|
13
|
+
"@chevre/factory": "4.337.0",
|
|
14
|
+
"@cinerino/sdk": "5.0.0-alpha.3",
|
|
14
15
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
16
|
"@motionpicture/gmo-service": "5.2.0",
|
|
16
17
|
"@sendgrid/mail": "6.4.0",
|
|
@@ -33,6 +34,7 @@
|
|
|
33
34
|
},
|
|
34
35
|
"description": "Chevre Domain Library for Node.js",
|
|
35
36
|
"devDependencies": {
|
|
37
|
+
"@aws-sdk/client-cognito-identity-provider": "^3.433.0",
|
|
36
38
|
"@types/debug": "0.0.30",
|
|
37
39
|
"@types/google-libphonenumber": "^7.4.19",
|
|
38
40
|
"@types/http-status": "^0.2.30",
|
|
@@ -51,7 +53,6 @@
|
|
|
51
53
|
"@types/sinon-mongoose": "^1.3.11",
|
|
52
54
|
"@types/uniqid": "^4.1.3",
|
|
53
55
|
"@types/uuid": "^3.4.10",
|
|
54
|
-
"aws-sdk": "2.1348.0",
|
|
55
56
|
"coveralls": "^3.1.0",
|
|
56
57
|
"csvtojson": "^2.0.10",
|
|
57
58
|
"googleapis": "^85.0.0",
|
|
@@ -72,7 +73,7 @@
|
|
|
72
73
|
"typescript": "5.0.3"
|
|
73
74
|
},
|
|
74
75
|
"peerDependencies": {
|
|
75
|
-
"aws-sdk": "^
|
|
76
|
+
"@aws-sdk/client-cognito-identity-provider": "^3.433.0",
|
|
76
77
|
"mongoose": "^7.0.5",
|
|
77
78
|
"redis": "^4.6.5"
|
|
78
79
|
},
|
|
@@ -81,6 +82,7 @@
|
|
|
81
82
|
"npm": ">=6.0.0"
|
|
82
83
|
},
|
|
83
84
|
"keywords": [],
|
|
85
|
+
"license": "UNLICENSED",
|
|
84
86
|
"main": "./lib/index.js",
|
|
85
87
|
"types": "./lib/index.d.ts",
|
|
86
88
|
"files": [
|
|
@@ -115,5 +117,5 @@
|
|
|
115
117
|
"postversion": "git push origin --tags",
|
|
116
118
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
117
119
|
},
|
|
118
|
-
"version": "21.13.0
|
|
120
|
+
"version": "21.13.0"
|
|
119
121
|
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
// import * as moment from 'moment';
|
|
3
|
-
// import * as mongoose from 'mongoose';
|
|
4
|
-
// tslint:disable-next-line:no-implicit-dependencies
|
|
5
|
-
import * as csv from 'csvtojson';
|
|
6
|
-
import * as fs from 'fs';
|
|
7
|
-
import * as json2csv from 'json2csv';
|
|
8
|
-
|
|
9
|
-
import { chevre } from '../../../lib/index';
|
|
10
|
-
|
|
11
|
-
const csvFilePath = `${__dirname}/transactions.csv`;
|
|
12
|
-
|
|
13
|
-
async function main() {
|
|
14
|
-
|
|
15
|
-
const personRepo = new chevre.repository.Person({
|
|
16
|
-
userPoolId: ''
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
const transactions = await csv()
|
|
20
|
-
.fromFile(csvFilePath);
|
|
21
|
-
console.log(transactions);
|
|
22
|
-
|
|
23
|
-
const reports = [];
|
|
24
|
-
for (const transaction of transactions) {
|
|
25
|
-
const people = await personRepo.search({
|
|
26
|
-
id: transaction.personId
|
|
27
|
-
});
|
|
28
|
-
console.log(people.length, people[0]?.memberOf?.membershipNumber, 'people found');
|
|
29
|
-
|
|
30
|
-
reports.push({
|
|
31
|
-
id: transaction.id,
|
|
32
|
-
transactionNumber: transaction.transactionNumber,
|
|
33
|
-
startDate: transaction.startDate,
|
|
34
|
-
personId: transaction.personId,
|
|
35
|
-
username: people[0]?.memberOf?.membershipNumber
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
// console.log(reports);
|
|
39
|
-
console.log(reports.length);
|
|
40
|
-
const fields = ['id', 'transactionNumber', 'startDate', 'personId', 'username'];
|
|
41
|
-
const opts = { fields };
|
|
42
|
-
|
|
43
|
-
try {
|
|
44
|
-
const usernamesCsv = json2csv.parse(reports, opts);
|
|
45
|
-
const usernameCsvPath = `${__dirname}/usernames.csv`;
|
|
46
|
-
// tslint:disable-next-line:non-literal-fs-path
|
|
47
|
-
fs.writeFileSync(usernameCsvPath, usernamesCsv);
|
|
48
|
-
} catch (err) {
|
|
49
|
-
console.error(err);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
main()
|
|
54
|
-
.then(() => {
|
|
55
|
-
console.log('success!');
|
|
56
|
-
})
|
|
57
|
-
.catch(console.error);
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console no-magic-numbers
|
|
2
|
-
import * as mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../../lib/index';
|
|
5
|
-
|
|
6
|
-
type IPermitOwnershipInfo = chevre.factory.ownershipInfo.IOwnershipInfo<chevre.factory.ownershipInfo.IPermitAsGood>;
|
|
7
|
-
|
|
8
|
-
const project = { id: <string>process.env.PROJECT_ID };
|
|
9
|
-
|
|
10
|
-
async function main() {
|
|
11
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
12
|
-
|
|
13
|
-
const now = new Date();
|
|
14
|
-
|
|
15
|
-
const ownershipInfoRepo = new chevre.repository.OwnershipInfo(mongoose.connection);
|
|
16
|
-
const newPersonRepo = new chevre.repository.Person({
|
|
17
|
-
userPoolId: <string>process.env.USERPOOL_ID_NEW
|
|
18
|
-
});
|
|
19
|
-
const oldPersonRepo = new chevre.repository.Person({
|
|
20
|
-
userPoolId: <string>process.env.USERPOOL_ID_OLD
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const id = 'a7909268-a584-425e-8212-d7d10f344093';
|
|
24
|
-
|
|
25
|
-
const profile = await newPersonRepo.findById({
|
|
26
|
-
userId: id
|
|
27
|
-
});
|
|
28
|
-
console.log('profile found');
|
|
29
|
-
|
|
30
|
-
let oldUser;
|
|
31
|
-
const userIdentitiesStr = profile.additionalProperty?.find((p) => p.name === 'identities')?.value;
|
|
32
|
-
if (typeof userIdentitiesStr === 'string' && userIdentitiesStr.length > 0) {
|
|
33
|
-
try {
|
|
34
|
-
const identities = JSON.parse(userIdentitiesStr);
|
|
35
|
-
if (Array.isArray(identities) && identities.length > 0) {
|
|
36
|
-
const userIdByIdentities = identities[0].userId;
|
|
37
|
-
if (typeof userIdByIdentities === 'string' && userIdByIdentities.length > 0) {
|
|
38
|
-
// oldUserは必ず存在するはず
|
|
39
|
-
oldUser = await oldPersonRepo.findById({ userId: userIdByIdentities });
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
} catch (error) {
|
|
43
|
-
// tslint:disable-next-line:no-console
|
|
44
|
-
console.error('person2username throwed', error);
|
|
45
|
-
throw error;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const paymentCardOwnershipInfos = <IPermitOwnershipInfo[]>
|
|
50
|
-
await ownershipInfoRepo.search({
|
|
51
|
-
sort: { ownedFrom: chevre.factory.sortType.Ascending },
|
|
52
|
-
limit: 1,
|
|
53
|
-
page: 1,
|
|
54
|
-
project: { id: { $eq: project.id } },
|
|
55
|
-
ownedFrom: now,
|
|
56
|
-
ownedThrough: now,
|
|
57
|
-
ownedBy: { id },
|
|
58
|
-
typeOfGood: {
|
|
59
|
-
issuedThrough: { typeOf: { $eq: chevre.factory.product.ProductType.PaymentCard } }
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
const paymentCardOwnershipInfo = paymentCardOwnershipInfos.shift();
|
|
63
|
-
console.log('paymentCard found');
|
|
64
|
-
|
|
65
|
-
console.log({
|
|
66
|
-
id,
|
|
67
|
-
// ...profile,
|
|
68
|
-
accountNumber: paymentCardOwnershipInfo?.typeOfGood.identifier,
|
|
69
|
-
...oldUser
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
main()
|
|
74
|
-
.then(() => {
|
|
75
|
-
console.log('success!');
|
|
76
|
-
})
|
|
77
|
-
.catch(console.error);
|