@chevre/domain 22.2.0-alpha.21 → 22.2.0-alpha.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/example/src/chevre/projectFields.ts +5 -7
- package/example/src/chevre/unsetUnnecessaryFields.ts +2 -15
- package/lib/chevre/repo/categoryCode.d.ts +4 -0
- package/lib/chevre/repo/categoryCode.js +6 -0
- package/lib/chevre/repo/role.d.ts +2 -9
- package/lib/chevre/repo/role.js +20 -10
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +3 -3
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +3 -2
- package/lib/chevre/service/offer/event/authorize.d.ts +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer/authorize.d.ts +2 -2
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer/factory.d.ts +3 -3
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +4 -2
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +8 -5
- package/lib/chevre/service/offer/eventServiceByCOA/validateAcceptedOffers.d.ts +1 -1
- package/package.json +3 -3
|
@@ -3,7 +3,7 @@ import * as mongoose from 'mongoose';
|
|
|
3
3
|
|
|
4
4
|
import { chevre } from '../../../lib/index';
|
|
5
5
|
|
|
6
|
-
const project = { id: String(process.env.PROJECT_ID) };
|
|
6
|
+
// const project = { id: String(process.env.PROJECT_ID) };
|
|
7
7
|
|
|
8
8
|
mongoose.Model.on('index', (...args) => {
|
|
9
9
|
console.error('******** index event emitted. ********\n', args);
|
|
@@ -12,16 +12,14 @@ mongoose.Model.on('index', (...args) => {
|
|
|
12
12
|
async function main() {
|
|
13
13
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const roleRepo = await chevre.repository.Role.createInstance(mongoose.connection);
|
|
16
16
|
|
|
17
|
-
const docs = await
|
|
17
|
+
const docs = await roleRepo.projectFields(
|
|
18
18
|
{
|
|
19
19
|
limit: 1,
|
|
20
20
|
page: 1,
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
[],
|
|
24
|
-
['hasMerchantReturnPolicy', 'makesOffer', 'additionalProperty']
|
|
21
|
+
roleName: { $eq: 'customer' }
|
|
22
|
+
}
|
|
25
23
|
);
|
|
26
24
|
// tslint:disable-next-line:no-null-keyword
|
|
27
25
|
console.dir(docs, { depth: null });
|
|
@@ -6,23 +6,10 @@ import { chevre } from '../../../lib/index';
|
|
|
6
6
|
async function main() {
|
|
7
7
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
8
8
|
|
|
9
|
-
const
|
|
10
|
-
const sellerRepo = await chevre.repository.Seller.createInstance(mongoose.connection);
|
|
9
|
+
const categoryCodeRepo = await chevre.repository.CategoryCode.createInstance(mongoose.connection);
|
|
11
10
|
|
|
12
11
|
let updateResult: any;
|
|
13
|
-
updateResult = await
|
|
14
|
-
filter: {
|
|
15
|
-
_id: { $exists: true }
|
|
16
|
-
},
|
|
17
|
-
$unset: {
|
|
18
|
-
createdAt: 1,
|
|
19
|
-
updatedAt: 1,
|
|
20
|
-
__v: 1
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
console.log(updateResult);
|
|
24
|
-
|
|
25
|
-
updateResult = await sellerRepo.unsetUnnecessaryFields({
|
|
12
|
+
updateResult = await categoryCodeRepo.unsetUnnecessaryFields({
|
|
26
13
|
filter: {
|
|
27
14
|
_id: { $exists: true }
|
|
28
15
|
},
|
|
@@ -83,5 +83,9 @@ export declare class CategoryCodeRepo {
|
|
|
83
83
|
};
|
|
84
84
|
}): Promise<void>;
|
|
85
85
|
getCursor(conditions: FilterQuery<factory.categoryCode.ICategoryCode>, projection: any): import("mongoose").Cursor<any, import("mongoose").QueryOptions<any>>;
|
|
86
|
+
unsetUnnecessaryFields(params: {
|
|
87
|
+
filter: FilterQuery<factory.categoryCode.ICategoryCode>;
|
|
88
|
+
$unset: any;
|
|
89
|
+
}): Promise<import("mongodb").UpdateResult>;
|
|
86
90
|
}
|
|
87
91
|
export {};
|
|
@@ -344,5 +344,11 @@ class CategoryCodeRepo {
|
|
|
344
344
|
.sort({ codeValue: factory.sortType.Ascending })
|
|
345
345
|
.cursor();
|
|
346
346
|
}
|
|
347
|
+
unsetUnnecessaryFields(params) {
|
|
348
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
349
|
+
return this.categoryCodeModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
|
|
350
|
+
.exec();
|
|
351
|
+
});
|
|
352
|
+
}
|
|
347
353
|
}
|
|
348
354
|
exports.CategoryCodeRepo = CategoryCodeRepo;
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import type { Connection } from 'mongoose';
|
|
2
2
|
import * as factory from '../factory';
|
|
3
|
-
export
|
|
4
|
-
OrganizationRole = "OrganizationRole"
|
|
5
|
-
}
|
|
6
|
-
export interface IRole {
|
|
7
|
-
typeOf: RoleType;
|
|
8
|
-
roleName: string;
|
|
9
|
-
permissions: string[];
|
|
10
|
-
}
|
|
3
|
+
export type IRole = Pick<factory.iam.IRole, 'permissions' | 'roleName' | 'typeOf'>;
|
|
11
4
|
/**
|
|
12
5
|
* IAMロールリポジトリ
|
|
13
6
|
*/
|
|
@@ -15,7 +8,7 @@ export declare class RoleRepo {
|
|
|
15
8
|
private readonly roleModel;
|
|
16
9
|
constructor(connection: Connection);
|
|
17
10
|
static CREATE_MONGO_CONDITIONS(params: factory.iam.IRoleSearchConditions): any[];
|
|
18
|
-
|
|
11
|
+
projectFields(params: factory.iam.IRoleSearchConditions): Promise<IRole[]>;
|
|
19
12
|
aggregatePermissions(params: {
|
|
20
13
|
roleName: {
|
|
21
14
|
$in: string[];
|
package/lib/chevre/repo/role.js
CHANGED
|
@@ -9,13 +9,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.RoleRepo =
|
|
13
|
-
const role_1 = require("./mongoose/schemas/role");
|
|
12
|
+
exports.RoleRepo = void 0;
|
|
14
13
|
const settings_1 = require("../settings");
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
const role_1 = require("./mongoose/schemas/role");
|
|
15
|
+
const AVAILABLE_PROJECT_FIELDS = [
|
|
16
|
+
'typeOf',
|
|
17
|
+
'permissions',
|
|
18
|
+
'roleName'
|
|
19
|
+
];
|
|
19
20
|
/**
|
|
20
21
|
* IAMロールリポジトリ
|
|
21
22
|
*/
|
|
@@ -39,10 +40,19 @@ class RoleRepo {
|
|
|
39
40
|
}
|
|
40
41
|
return andConditions;
|
|
41
42
|
}
|
|
42
|
-
|
|
43
|
+
projectFields(params) {
|
|
43
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
45
|
const conditions = RoleRepo.CREATE_MONGO_CONDITIONS(params);
|
|
45
|
-
const
|
|
46
|
+
const positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
|
|
47
|
+
// if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
48
|
+
// positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
49
|
+
// } else {
|
|
50
|
+
// if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
51
|
+
// positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
|
|
52
|
+
// }
|
|
53
|
+
// }
|
|
54
|
+
const projection = Object.assign({ _id: 0 }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
|
|
55
|
+
const query = this.roleModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
|
|
46
56
|
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
47
57
|
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
48
58
|
query.limit(params.limit)
|
|
@@ -56,8 +66,8 @@ class RoleRepo {
|
|
|
56
66
|
// const explainResult = await (<any>query).explain();
|
|
57
67
|
// console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
|
|
58
68
|
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
59
|
-
.
|
|
60
|
-
.
|
|
69
|
+
.lean() // 2024-08-23~
|
|
70
|
+
.exec();
|
|
61
71
|
});
|
|
62
72
|
}
|
|
63
73
|
aggregatePermissions(params) {
|
|
@@ -4,7 +4,7 @@ declare function createReserveTransactionStartParams(params: {
|
|
|
4
4
|
project: {
|
|
5
5
|
id: string;
|
|
6
6
|
};
|
|
7
|
-
acceptedOffers: factory.action.authorize.offer.eventService.
|
|
7
|
+
acceptedOffers: factory.action.authorize.offer.eventService.IAcceptedOffer[];
|
|
8
8
|
event: {
|
|
9
9
|
id: string;
|
|
10
10
|
};
|
|
@@ -26,13 +26,13 @@ declare function acceptedOffers2amount(params: {
|
|
|
26
26
|
acceptedOffers: IResultAcceptedOffer[];
|
|
27
27
|
}): number;
|
|
28
28
|
declare function acceptedOffers2authorizeResult(params: {
|
|
29
|
-
acceptedOffers: factory.action.authorize.offer.eventService.
|
|
29
|
+
acceptedOffers: factory.action.authorize.offer.eventService.IAcceptedOffer[];
|
|
30
30
|
acceptedOffers4result: IResultAcceptedOffer[];
|
|
31
31
|
noOfferSpecified: boolean;
|
|
32
32
|
ticketOffers: factory.product.ITicketOffer[];
|
|
33
33
|
}): factory.action.authorize.offer.eventService.IResult;
|
|
34
34
|
type IObjectSubReservation = factory.assetTransaction.reserve.IObjectSubReservation;
|
|
35
|
-
type IResultAcceptedOffer = factory.
|
|
35
|
+
export type IResultAcceptedOffer = factory.order.IAcceptedOffer<factory.order.IReservation>;
|
|
36
36
|
declare function responseBody2acceptedOffers4result(params: {
|
|
37
37
|
issuedThrough: factory.assetTransaction.reserve.IIssuedThrough;
|
|
38
38
|
reservationFor: factory.assetTransaction.reserve.IReservationFor;
|
|
@@ -17,8 +17,9 @@ import type { OfferRateLimitRepo } from '../../../../repo/rateLimit/offer';
|
|
|
17
17
|
import type { StockHolderRepo } from '../../../../repo/stockHolder';
|
|
18
18
|
import type { TaskRepo } from '../../../../repo/task';
|
|
19
19
|
import type { TicketRepo } from '../../../../repo/ticket';
|
|
20
|
+
import { IResultAcceptedOffer } from './factory';
|
|
20
21
|
declare function processStartReserve4chevre(params: {
|
|
21
|
-
acceptedOffers: factory.action.authorize.offer.eventService.
|
|
22
|
+
acceptedOffers: factory.action.authorize.offer.eventService.IAcceptedOffer[];
|
|
22
23
|
event: Pick<IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>, 'id'>;
|
|
23
24
|
broker?: factory.reservation.IBroker<factory.reservationType>;
|
|
24
25
|
transactionNumber: string;
|
|
@@ -57,6 +58,6 @@ declare function processStartReserve4chevre(params: {
|
|
|
57
58
|
}, credentials: {
|
|
58
59
|
jwt: JWTCredentials;
|
|
59
60
|
}) => Promise<{
|
|
60
|
-
acceptedOffers4result:
|
|
61
|
+
acceptedOffers4result: IResultAcceptedOffer[];
|
|
61
62
|
}>;
|
|
62
63
|
export { processStartReserve4chevre };
|
|
@@ -48,7 +48,7 @@ type IAuthorizeOperation<T> = (repos: IAuthorizeRepos, credentials: {
|
|
|
48
48
|
jwt: JWTCredentials;
|
|
49
49
|
}) => Promise<T>;
|
|
50
50
|
type IAuthorizeOfferAction = factory.action.authorize.offer.eventService.IAction<factory.service.webAPI.Identifier>;
|
|
51
|
-
type IObjectWithoutDetail = factory.action.authorize.offer.eventService.IObjectWithoutDetail
|
|
51
|
+
type IObjectWithoutDetail = factory.action.authorize.offer.eventService.IObjectWithoutDetail;
|
|
52
52
|
interface IAuthorizeOptions {
|
|
53
53
|
/**
|
|
54
54
|
* オファーID指定なしに座席をおさえる場合true
|
|
@@ -10,12 +10,12 @@ export interface IAppliesToSurfrock {
|
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
12
|
export declare function createAcceptedOffersWithoutDetails(params: {
|
|
13
|
-
object: factory.action.
|
|
13
|
+
object: factory.action.accept.coaOffer.IObjectWithoutDetail4COA;
|
|
14
14
|
coaInfo: Pick<factory.event.screeningEvent.ICOAInfo, 'dateJouei' | 'screenCode' | 'theaterCode' | 'timeBegin' | 'timeEnd' | 'titleBranchNum' | 'titleCode'>;
|
|
15
15
|
}): (repos: {
|
|
16
16
|
reserveService: COA.service.Reserve;
|
|
17
17
|
}) => Promise<IAcceptedOfferWithoutDetail[]>;
|
|
18
|
-
type IAcceptedOfferBeforeAuthorize4COA = factory.action.
|
|
18
|
+
type IAcceptedOfferBeforeAuthorize4COA = factory.action.accept.coaOffer.IAcceptedOfferBeforeAuthorize4COA;
|
|
19
19
|
export declare function validateOffers(coaInfo: Pick<factory.event.screeningEvent.ICOAInfo, 'dateJouei' | 'screenCode' | 'theaterCode' | 'timeBegin' | 'timeEnd' | 'titleBranchNum' | 'titleCode'>, offers: IAcceptedOfferWithoutDetail[], appliesToSurfrock: IAppliesToSurfrock, flgMember: COA.factory.reserve.FlgMember): (repos: {
|
|
20
20
|
reserveService: COA.service.Reserve;
|
|
21
21
|
masterService: COA.service.Master;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as factory from '../../../../factory';
|
|
2
|
-
type IAcceptedOfferWithoutDetail = factory.action.
|
|
2
|
+
type IAcceptedOfferWithoutDetail = factory.action.accept.coaOffer.IAcceptedOfferWithoutDetail4COA & {
|
|
3
3
|
additionalProperty?: factory.propertyValue.IPropertyValue<string>[];
|
|
4
|
-
ticketInfo: factory.action.
|
|
4
|
+
ticketInfo: factory.action.accept.coaOffer.ICOATicketInfo & {
|
|
5
5
|
spseatAdd1: number;
|
|
6
6
|
spseatAdd2: number;
|
|
7
7
|
spseatKbn: string;
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
10
|
declare function createUpdTmpReserveSeatArgs(params: {
|
|
11
|
-
object: factory.action.
|
|
11
|
+
object: factory.action.accept.coaOffer.IObjectWithoutDetail4COA;
|
|
12
12
|
coaInfo: Pick<factory.event.screeningEvent.ICOAInfo, 'dateJouei' | 'screenCode' | 'theaterCode' | 'timeBegin' | 'timeEnd' | 'titleBranchNum' | 'titleCode'>;
|
|
13
13
|
}): factory.action.accept.coaOffer.IUpdTmpReserveSeatArgs;
|
|
14
14
|
declare function processUpdTmpReserveSeatResult2recipe(params: {
|
|
@@ -6,8 +6,10 @@ import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
|
|
|
6
6
|
import type { OrderNumberRepo } from '../../../repo/orderNumber';
|
|
7
7
|
import type { ProjectRepo } from '../../../repo/project';
|
|
8
8
|
import type { TransactionRepo } from '../../../repo/transaction';
|
|
9
|
+
import { IRequestBody, IResponseBody } from './factory';
|
|
9
10
|
import { IAcceptedOfferBeforeAuthorize4COA } from './validateAcceptedOffers';
|
|
10
11
|
import * as factory from '../../../factory';
|
|
12
|
+
export { IRequestBody, IResponseBody };
|
|
11
13
|
export import WebAPIIdentifier = factory.service.webAPI.Identifier;
|
|
12
14
|
export type IAuthorizeActionResult = factory.action.authorize.offer.eventService.IResult;
|
|
13
15
|
export interface IAuthorizeRepos {
|
|
@@ -51,8 +53,8 @@ export declare function authorize(params: {
|
|
|
51
53
|
id: string;
|
|
52
54
|
};
|
|
53
55
|
result: {
|
|
54
|
-
requestBody:
|
|
55
|
-
responseBody:
|
|
56
|
+
requestBody: IRequestBody;
|
|
57
|
+
responseBody: IResponseBody;
|
|
56
58
|
};
|
|
57
59
|
options: {};
|
|
58
60
|
}): IAuthorizeOperation<IAuthorizeOfferAction>;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import type * as COAService from '@motionpicture/coa-service';
|
|
1
2
|
import * as factory from '../../../factory';
|
|
2
3
|
import { IMinimizedIndividualEvent } from '../../../factory/event';
|
|
3
4
|
export import WebAPIIdentifier = factory.service.webAPI.Identifier;
|
|
4
|
-
export type IAcceptedOffer4COA = factory.action.
|
|
5
|
+
export type IAcceptedOffer4COA = factory.action.accept.coaOffer.IAcceptedOffer4COA;
|
|
6
|
+
export type IRequestBody = COAService.factory.reserve.IUpdTmpReserveSeatArgs;
|
|
7
|
+
export type IResponseBody = COAService.factory.reserve.IUpdTmpReserveSeatResult;
|
|
5
8
|
export declare function createAuthorizeSeatReservationActionAttributes(params: {
|
|
6
9
|
acceptAction: {
|
|
7
10
|
id: string;
|
|
8
11
|
};
|
|
9
|
-
acceptedOffers: factory.action.
|
|
12
|
+
acceptedOffers: factory.action.accept.coaOffer.IAcceptedOffer4COA[];
|
|
10
13
|
event: {
|
|
11
14
|
id: string;
|
|
12
15
|
typeOf: factory.eventType.ScreeningEvent;
|
|
@@ -21,13 +24,13 @@ export declare function offers2resultPrice(offers: IAcceptedOffer4COA[]): {
|
|
|
21
24
|
price: number;
|
|
22
25
|
eligibleMonetaryAmount: factory.offer.IEligibleMonetaryAmount[];
|
|
23
26
|
};
|
|
24
|
-
type IResultAcceptedOffer = factory.
|
|
27
|
+
type IResultAcceptedOffer = factory.order.IAcceptedOffer<factory.order.IReservation>;
|
|
25
28
|
/**
|
|
26
29
|
* COA仮予約結果から注文アイテムを生成する
|
|
27
30
|
*/
|
|
28
31
|
export declare function responseBody2acceptedOffers4result(params: {
|
|
29
|
-
responseBody:
|
|
30
|
-
acceptedOffer: factory.action.
|
|
32
|
+
responseBody: IResponseBody;
|
|
33
|
+
acceptedOffer: factory.action.accept.coaOffer.IAcceptedOffer4COA[];
|
|
31
34
|
event: Pick<IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>, 'coaInfo' | 'doorTime' | 'endDate' | 'id' | 'location' | 'startDate' | 'superEvent' | 'typeOf' | 'identifier' | 'name'>;
|
|
32
35
|
seller: Pick<factory.transaction.placeOrder.ISeller, 'typeOf' | 'name'>;
|
|
33
36
|
bookingTime: Date;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as factory from '../../../factory';
|
|
2
2
|
import type { OfferRepo } from '../../../repo/offer';
|
|
3
3
|
import { IAcceptedOffer4COA } from './factory';
|
|
4
|
-
export type IAcceptedOfferBeforeAuthorize4COA = factory.action.
|
|
4
|
+
export type IAcceptedOfferBeforeAuthorize4COA = factory.action.accept.coaOffer.IAcceptedOfferBeforeAuthorize4COA;
|
|
5
5
|
/**
|
|
6
6
|
* 受け入れらたオファーの内容を検証
|
|
7
7
|
*/
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.381.0
|
|
13
|
-
"@cinerino/sdk": "10.7.0
|
|
12
|
+
"@chevre/factory": "4.381.0",
|
|
13
|
+
"@cinerino/sdk": "10.7.0",
|
|
14
14
|
"@motionpicture/coa-service": "9.4.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.3.0",
|
|
16
16
|
"@sendgrid/mail": "6.4.0",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"postversion": "git push origin --tags",
|
|
111
111
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
112
112
|
},
|
|
113
|
-
"version": "22.2.0-alpha.
|
|
113
|
+
"version": "22.2.0-alpha.22"
|
|
114
114
|
}
|