@chevre/domain 22.14.0-alpha.9 → 23.0.0-alpha.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/{createEventBySchedule.ts → addEventBySchedule.ts} +2 -2
- package/example/src/chevre/aggregateEventPublicFields.ts +1 -1
- package/example/src/chevre/aggregation/createAggregateEventTasks.ts +1 -1
- package/example/src/chevre/authorizeEventServiceOffer.ts +119 -0
- package/example/src/chevre/findAnyEventById.ts +1 -1
- package/example/src/chevre/findReservationByCode.ts +0 -1
- package/example/src/chevre/productOffer/publishMemberTierToken.ts +92 -0
- package/example/src/chevre/reIndex.ts +3 -1
- package/example/src/chevre/roles/addAdminProductOfferPermissionIfNotExists.ts +48 -0
- package/example/src/chevre/roles/removeConsolePermissionIfExists.ts +1 -2
- package/example/src/chevre/updateEventPartiallyById.ts +1 -1
- package/lib/chevre/factory/event.d.ts +2 -4
- package/lib/chevre/repo/accountingReport.d.ts +4 -4
- package/lib/chevre/repo/accountingReport.js +1 -1
- package/lib/chevre/repo/action.d.ts +1 -1
- package/lib/chevre/repo/aggregateReservation.d.ts +2 -2
- package/lib/chevre/repo/creativeWork.d.ts +1 -3
- package/lib/chevre/repo/creativeWork.js +65 -47
- package/lib/chevre/repo/event.d.ts +44 -48
- package/lib/chevre/repo/event.js +13 -111
- package/lib/chevre/repo/eventSeries.d.ts +14 -14
- package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +2 -15
- package/lib/chevre/repo/mongoose/schemas/aggregateReservation.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +2 -5
- package/lib/chevre/repo/mongoose/schemas/eventSeries.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/place.js +13 -14
- package/lib/chevre/repo/mongoose/schemas/product.js +14 -4
- package/lib/chevre/repo/mongoose/schemas/{offer/event.d.ts → productOffer.d.ts} +6 -3
- package/lib/chevre/repo/mongoose/schemas/{offer/event.js → productOffer.js} +26 -29
- package/lib/chevre/repo/mongoose/schemas/seller.js +17 -6
- package/lib/chevre/repo/productOffer.d.ts +36 -61
- package/lib/chevre/repo/productOffer.js +163 -157
- package/lib/chevre/repository.d.ts +0 -5
- package/lib/chevre/repository.js +2 -15
- package/lib/chevre/service/aggregation/event/aggregateOffers.d.ts +1 -1
- package/lib/chevre/service/aggregation/event/aggregateOffers.js +2 -6
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +3 -19
- package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.d.ts +1 -3
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createReservation.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createStartParams.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createStartParams.js +1 -6
- package/lib/chevre/service/assetTransaction/reserve/start.d.ts +0 -2
- package/lib/chevre/service/assetTransaction/reserve/start.js +4 -4
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.d.ts +3 -3
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +57 -32
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +2 -2
- package/lib/chevre/service/offer/event/authorize/factory.js +2 -2
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +2 -4
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +2 -2
- package/lib/chevre/service/offer/event/authorize.d.ts +0 -2
- package/lib/chevre/service/offer/event/authorize.js +2 -2
- package/lib/chevre/service/offer/event/checkAvailability.d.ts +1 -1
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +1 -1
- package/lib/chevre/service/offer/event/searchOffersByIds.d.ts +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +1 -1
- package/lib/chevre/service/offer/onEventChanged.js +2 -19
- package/lib/chevre/service/offer/product.d.ts +0 -3
- package/lib/chevre/service/offer/product.js +29 -38
- package/lib/chevre/service/order/createAccountingReportIfNotExist.js +0 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +1 -1
- package/lib/chevre/service/payment/movieTicket/factory.d.ts +2 -2
- package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.d.ts +1 -1
- package/lib/chevre/service/reserve/useReservation.js +2 -3
- package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +0 -2
- package/lib/chevre/service/task/checkResource.d.ts +2 -2
- package/lib/chevre/service/task/checkResource.js +8 -6
- package/lib/chevre/service/task/createAccountingReport.d.ts +2 -2
- package/lib/chevre/service/task/createAccountingReport.js +15 -15
- package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.d.ts +1 -1
- package/lib/chevre/service/task/createEvent/createEventBySchedule.d.ts +1 -1
- package/lib/chevre/service/task/createEvent/createEventBySchedule.js +2 -1
- package/lib/chevre/service/task/createEvent/createEventSeries.d.ts +1 -1
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +7 -6
- package/lib/chevre/service/task/useReservation.js +1 -2
- package/lib/chevre/service/taskHandler.js +2 -0
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.d.ts +0 -1
- package/package.json +3 -3
- package/example/src/chevre/eventOffer/adminEventOffers.ts +0 -67
- package/example/src/chevre/roles/addPermissionIfNotExists.ts +0 -48
- package/example/src/chevre/upsertMoviesByIdentifier.ts +0 -58
- package/lib/chevre/repo/offer/event.d.ts +0 -38
- package/lib/chevre/repo/offer/event.js +0 -142
|
@@ -15,8 +15,8 @@ async function main() {
|
|
|
15
15
|
typeOf: chevre.factory.eventType.ScreeningEvent,
|
|
16
16
|
eventSchedule: { id: '672bf38b5d6d3f5642d658fc' }
|
|
17
17
|
},
|
|
18
|
-
|
|
19
|
-
typeOf: chevre.factory.actionType.
|
|
18
|
+
targetCollection: { typeOf: chevre.factory.eventType.ScreeningEvent },
|
|
19
|
+
typeOf: chevre.factory.actionType.AddAction
|
|
20
20
|
})(
|
|
21
21
|
{
|
|
22
22
|
connection: mongoose.connection,
|
|
@@ -10,7 +10,7 @@ async function main() {
|
|
|
10
10
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
11
11
|
|
|
12
12
|
const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
13
|
-
const result = await eventRepo.aggregatePublicFields
|
|
13
|
+
const result = await eventRepo.aggregatePublicFields(
|
|
14
14
|
{
|
|
15
15
|
limit: 10,
|
|
16
16
|
page: 1,
|
|
@@ -15,7 +15,7 @@ async function main() {
|
|
|
15
15
|
const events = <Pick<
|
|
16
16
|
chevre.factory.event.IEvent<chevre.factory.eventType.ScreeningEvent>,
|
|
17
17
|
'id' | 'typeOf' | 'startDate' | 'project'
|
|
18
|
-
>[]>await eventRepo.projectEventFields
|
|
18
|
+
>[]>await eventRepo.projectEventFields(
|
|
19
19
|
{
|
|
20
20
|
typeOf: chevre.factory.eventType.ScreeningEvent,
|
|
21
21
|
project: { id: { $eq: PROJECT.id } },
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
import * as redis from 'redis';
|
|
4
|
+
|
|
5
|
+
import { chevre } from '../../../lib/index';
|
|
6
|
+
|
|
7
|
+
const project = {
|
|
8
|
+
id: String(process.env.PROJECT_ID),
|
|
9
|
+
typeOf: <chevre.factory.organizationType.Project>chevre.factory.organizationType.Project
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// tslint:disable-next-line:max-func-body-length
|
|
13
|
+
async function main() {
|
|
14
|
+
const redisClient = redis.createClient<redis.RedisDefaultModules, Record<string, never>, Record<string, never>>({
|
|
15
|
+
socket: {
|
|
16
|
+
port: Number(<string>process.env.REDIS_PORT),
|
|
17
|
+
host: <string>process.env.REDIS_HOST
|
|
18
|
+
},
|
|
19
|
+
password: <string>process.env.REDIS_KEY
|
|
20
|
+
});
|
|
21
|
+
await redisClient.connect();
|
|
22
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
23
|
+
|
|
24
|
+
const action = await (await chevre.service.offer.createService()).event.authorize(
|
|
25
|
+
{
|
|
26
|
+
project: project,
|
|
27
|
+
object: {
|
|
28
|
+
acceptedOffer: [],
|
|
29
|
+
reservationFor: {
|
|
30
|
+
id: 'bmcvkft63',
|
|
31
|
+
offers: {
|
|
32
|
+
validForMemberTier: {
|
|
33
|
+
token: 'xx',
|
|
34
|
+
isTierOf: { identifier: 'DefaultMemberProgram' }
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
agent: { id: 'xxx' },
|
|
41
|
+
transaction: { id: 'xxx' },
|
|
42
|
+
validateEventOfferPeriod: true,
|
|
43
|
+
validateEvent: false,
|
|
44
|
+
store: { id: 'xxx' }
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
noOfferSpecified: true,
|
|
48
|
+
maxReservationGracePeriodInDays: 93
|
|
49
|
+
}
|
|
50
|
+
)(
|
|
51
|
+
{
|
|
52
|
+
action: await chevre.repository.Action.createInstance(mongoose.connection),
|
|
53
|
+
advanceBookingRequirement: await chevre.repository.AdvanceBookingRequirement.createInstance(mongoose.connection),
|
|
54
|
+
assetTransaction: await chevre.repository.AssetTransaction.createInstance(mongoose.connection),
|
|
55
|
+
authorization: await chevre.repository.Authorization.createInstance(mongoose.connection),
|
|
56
|
+
event: await chevre.repository.Event.createInstance(mongoose.connection),
|
|
57
|
+
eventSeries: await chevre.repository.EventSeries.createInstance(mongoose.connection),
|
|
58
|
+
issuer: await chevre.repository.Issuer.createInstance(mongoose.connection),
|
|
59
|
+
memberProgram: await chevre.repository.MemberProgram.createInstance(mongoose.connection),
|
|
60
|
+
stockHolder: await chevre.repository.StockHolder.createInstance({ connection: mongoose.connection }),
|
|
61
|
+
offer: await chevre.repository.Offer.createInstance(mongoose.connection),
|
|
62
|
+
offerCatalog: await chevre.repository.OfferCatalog.createInstance(mongoose.connection),
|
|
63
|
+
offerCatalogItem: await chevre.repository.OfferCatalogItem.createInstance(mongoose.connection),
|
|
64
|
+
offerRateLimit: await chevre.repository.rateLimit.Offer.createInstance(redisClient),
|
|
65
|
+
orderInTransaction: await chevre.repository.OrderInTransaction.createInstance(mongoose.connection),
|
|
66
|
+
orderNumber: await chevre.repository.OrderNumber.createInstance({ connection: mongoose.connection }),
|
|
67
|
+
paymentService: await chevre.repository.PaymentService.createInstance(mongoose.connection),
|
|
68
|
+
priceSpecification: await chevre.repository.PriceSpecification.createInstance(mongoose.connection),
|
|
69
|
+
product: await chevre.repository.Product.createInstance(mongoose.connection),
|
|
70
|
+
productOffer: await chevre.repository.ProductOffer.createInstance(mongoose.connection),
|
|
71
|
+
project: await chevre.repository.Project.createInstance(mongoose.connection),
|
|
72
|
+
seat: await chevre.repository.place.Seat.createInstance(mongoose.connection),
|
|
73
|
+
setting: await chevre.repository.Setting.createInstance(mongoose.connection),
|
|
74
|
+
task: await chevre.repository.Task.createInstance(mongoose.connection),
|
|
75
|
+
ticket: await chevre.repository.Ticket.createInstance(mongoose.connection),
|
|
76
|
+
transaction: await chevre.repository.Transaction.createInstance(mongoose.connection),
|
|
77
|
+
transactionNumber: await chevre.repository.TransactionNumber.createInstance({ connection: mongoose.connection })
|
|
78
|
+
},
|
|
79
|
+
new chevre.settings.Settings({
|
|
80
|
+
// notification: {
|
|
81
|
+
// // tslint:disable-next-line:no-magic-numbers
|
|
82
|
+
// timeout: (process.env.TRIGGER_WEBHOOK_TIMEOUT !== undefined) ? Number(process.env.TRIGGER_WEBHOOK_TIMEOUT) : 15000,
|
|
83
|
+
// useFetchAPI: process.env.USE_FETCH_API === '1',
|
|
84
|
+
// secretKey: (typeof process.env.TRIGGER_WEBHOOK_SECRET_KEY === 'string')
|
|
85
|
+
// ? process.env.TRIGGER_WEBHOOK_SECRET_KEY
|
|
86
|
+
// : '',
|
|
87
|
+
// headerIdentifier: (typeof process.env.TRIGGER_WEBHOOK_HEADER_IDENTIFIER === 'string')
|
|
88
|
+
// ? process.env.TRIGGER_WEBHOOK_HEADER_IDENTIFIER
|
|
89
|
+
// : ''
|
|
90
|
+
// },
|
|
91
|
+
abortedTasksWithoutReport: (typeof process.env.ABORTED_TASKS_WITHOUT_REPORT === 'string')
|
|
92
|
+
? process.env.ABORTED_TASKS_WITHOUT_REPORT.split(' ')
|
|
93
|
+
: [],
|
|
94
|
+
numTryConfirmReserveTransaction: (typeof process.env.NUM_TRY_CONFIRM_RESERVE_TRANSACTION === 'string')
|
|
95
|
+
? Number(process.env.NUM_TRY_CONFIRM_RESERVE_TRANSACTION)
|
|
96
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
97
|
+
: 10,
|
|
98
|
+
deliverOrderLimit: (typeof process.env.DELIVER_ORDER_LIMIT === 'string')
|
|
99
|
+
? Number(process.env.DELIVER_ORDER_LIMIT)
|
|
100
|
+
: 1,
|
|
101
|
+
coa: {
|
|
102
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
103
|
+
timeout: (typeof process.env.COA_TIMEOUT === 'string') ? Number(process.env.COA_TIMEOUT) : 20000
|
|
104
|
+
},
|
|
105
|
+
gmo: <any>{
|
|
106
|
+
useFetch: process.env.GMO_USE_FETCH === '1'
|
|
107
|
+
},
|
|
108
|
+
movieticketReserve: <any>{
|
|
109
|
+
},
|
|
110
|
+
// useAssetTransactionSyncProcessing: process.env.USE_ASSET_TRANSACTION_SYNC_PROCESSING === '1',
|
|
111
|
+
useExperimentalFeature: process.env.USE_EXPERIMENTAL_FEATURE === '1'
|
|
112
|
+
})
|
|
113
|
+
);
|
|
114
|
+
console.log('authorized.', action);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
main()
|
|
118
|
+
.then(console.log)
|
|
119
|
+
.catch(console.error);
|
|
@@ -9,7 +9,7 @@ async function main() {
|
|
|
9
9
|
|
|
10
10
|
const eventRepo: chevre.repository.Event = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
11
11
|
|
|
12
|
-
const event = await eventRepo.findAnyEventById
|
|
12
|
+
const event = await eventRepo.findAnyEventById({
|
|
13
13
|
id: { $eq: 'blxonxv1m' },
|
|
14
14
|
project: { id: { $eq: PROJECT_ID } }
|
|
15
15
|
// organizer: { id: { $eq: 'xxx' } }
|
|
@@ -22,7 +22,6 @@ async function main() {
|
|
|
22
22
|
|
|
23
23
|
await (await chevre.service.reserve.createService()).verifyToken4reservation({
|
|
24
24
|
project: { id: project.id },
|
|
25
|
-
agent: { id: project.id, typeOf: chevre.factory.organizationType.Project },
|
|
26
25
|
reservationId: RESERVATION_ID,
|
|
27
26
|
ticket: {
|
|
28
27
|
ticketToken: CODE
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import { sign } from 'jsonwebtoken';
|
|
3
|
+
import * as mongoose from 'mongoose';
|
|
4
|
+
|
|
5
|
+
import { chevre } from '../../../../lib/index';
|
|
6
|
+
|
|
7
|
+
const project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
+
|
|
9
|
+
async function main() {
|
|
10
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
11
|
+
|
|
12
|
+
const productOfferRepo = await chevre.repository.ProductOffer.createInstance(mongoose.connection);
|
|
13
|
+
const issuerRepo = await chevre.repository.Issuer.createInstance(mongoose.connection);
|
|
14
|
+
const memberProgramRepo = await chevre.repository.MemberProgram.createInstance(mongoose.connection);
|
|
15
|
+
|
|
16
|
+
const productOffer = (await productOfferRepo.findProductOffers(
|
|
17
|
+
{
|
|
18
|
+
limit: 1,
|
|
19
|
+
page: 1,
|
|
20
|
+
project: { id: { $eq: project.id } },
|
|
21
|
+
id: { $eq: '68d378a0c6f90b6bea9427ee' }
|
|
22
|
+
},
|
|
23
|
+
['validForMemberTier']
|
|
24
|
+
)).shift();
|
|
25
|
+
if (productOffer === undefined) {
|
|
26
|
+
throw new chevre.factory.errors.NotFound(chevre.factory.offerType.Offer);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const tierIdentifier = productOffer.validForMemberTier?.identifier;
|
|
30
|
+
if (typeof tierIdentifier !== 'string') {
|
|
31
|
+
throw new chevre.factory.errors.NotFound('productOffer.validForMemberTier.identifier');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const tier = (await memberProgramRepo.projectMemberProgramTiers(
|
|
35
|
+
{
|
|
36
|
+
limit: 1,
|
|
37
|
+
page: 1,
|
|
38
|
+
project: { id: { $eq: project.id } },
|
|
39
|
+
identifier: { $eq: tierIdentifier }
|
|
40
|
+
}
|
|
41
|
+
)).shift();
|
|
42
|
+
if (tier === undefined) {
|
|
43
|
+
throw new chevre.factory.errors.NotFound('MemberProgramTier');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const { url, tokenSecret } = await issuerRepo.findByIdentifier({
|
|
47
|
+
identifier: tier.isTierOf.hostingOrganization.identifier,
|
|
48
|
+
project: { id: project.id }
|
|
49
|
+
});
|
|
50
|
+
if (typeof tokenSecret !== 'string') {
|
|
51
|
+
throw new chevre.factory.errors.NotFound('issuer.tokenSecret');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const payload = {
|
|
55
|
+
member: {
|
|
56
|
+
memberOf: {
|
|
57
|
+
identifier: tierIdentifier,
|
|
58
|
+
isTierOf: { identifier: tier.isTierOf.identifier }
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const token = await new Promise<string>((resolve, reject) => {
|
|
64
|
+
// 所有権を暗号化する
|
|
65
|
+
sign(
|
|
66
|
+
payload,
|
|
67
|
+
tokenSecret,
|
|
68
|
+
{
|
|
69
|
+
// algorithm: jwtSetting.algorithm,
|
|
70
|
+
issuer: url,
|
|
71
|
+
expiresIn: 1800
|
|
72
|
+
// subject,
|
|
73
|
+
},
|
|
74
|
+
(err, encoded) => {
|
|
75
|
+
if (err instanceof Error) {
|
|
76
|
+
reject(err);
|
|
77
|
+
} else {
|
|
78
|
+
if (typeof encoded !== 'string') {
|
|
79
|
+
reject(new Error('cannot be signed unexpectedly'));
|
|
80
|
+
} else {
|
|
81
|
+
resolve(encoded);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
});
|
|
87
|
+
console.log(token);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
main()
|
|
91
|
+
.then()
|
|
92
|
+
.catch(console.error);
|
|
@@ -11,7 +11,9 @@ 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.place.ScreeningRoom.createInstance(mongoose.connection);
|
|
15
|
+
await chevre.repository.Seller.createInstance(mongoose.connection);
|
|
16
|
+
await chevre.repository.ProductOffer.createInstance(mongoose.connection);
|
|
15
17
|
console.log('success!');
|
|
16
18
|
}
|
|
17
19
|
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
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 roleRepo = await chevre.repository.Role.createInstance(mongoose.connection);
|
|
10
|
+
|
|
11
|
+
let roleNames = [
|
|
12
|
+
chevre.factory.role.organizationRole.RoleName.InventoryManager,
|
|
13
|
+
chevre.factory.role.organizationRole.RoleName.SellersOwner,
|
|
14
|
+
chevre.factory.role.organizationRole.RoleName.SellersInventoryManager
|
|
15
|
+
];
|
|
16
|
+
let permissions = [
|
|
17
|
+
'admin.sellers.productOffers.*'
|
|
18
|
+
];
|
|
19
|
+
for (const roleName of roleNames) {
|
|
20
|
+
for (const permission of permissions) {
|
|
21
|
+
const result = await roleRepo.addPermissionIfNotExists({
|
|
22
|
+
roleName: { $eq: roleName },
|
|
23
|
+
permission
|
|
24
|
+
});
|
|
25
|
+
console.log('permission added.', result, roleName);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
roleNames = [
|
|
30
|
+
chevre.factory.role.organizationRole.RoleName.TicketClerk
|
|
31
|
+
];
|
|
32
|
+
permissions = [
|
|
33
|
+
'admin.sellers.productOffers.read'
|
|
34
|
+
];
|
|
35
|
+
for (const roleName of roleNames) {
|
|
36
|
+
for (const permission of permissions) {
|
|
37
|
+
const result = await roleRepo.addPermissionIfNotExists({
|
|
38
|
+
roleName: { $eq: roleName },
|
|
39
|
+
permission
|
|
40
|
+
});
|
|
41
|
+
console.log('permission added.', result, roleName);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
main()
|
|
47
|
+
.then()
|
|
48
|
+
.catch(console.error);
|
|
@@ -9,8 +9,7 @@ async function main() {
|
|
|
9
9
|
const roleRepo = await chevre.repository.Role.createInstance(mongoose.connection);
|
|
10
10
|
|
|
11
11
|
const permissions = [
|
|
12
|
-
'
|
|
13
|
-
'notes.read'
|
|
12
|
+
'eventOffers.*'
|
|
14
13
|
];
|
|
15
14
|
for (const permission of permissions) {
|
|
16
15
|
const roles = await roleRepo.projectFields(
|
|
@@ -9,7 +9,7 @@ async function main() {
|
|
|
9
9
|
|
|
10
10
|
const eventRepo: chevre.repository.Event = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
11
11
|
|
|
12
|
-
const result = await eventRepo.updatePartiallyById
|
|
12
|
+
const result = await eventRepo.updatePartiallyById({
|
|
13
13
|
project: { id: PROJECT_ID },
|
|
14
14
|
id: 'blxd1grxw',
|
|
15
15
|
attributes: { typeOf: chevre.factory.eventType.ScreeningEvent, eventStatus: chevre.factory.eventStatusType.EventScheduled }
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import * as factory from '../factory';
|
|
2
|
-
export type IMinimizedIndividualEvent
|
|
3
|
-
superEvent?: never;
|
|
4
|
-
} : never;
|
|
2
|
+
export type IMinimizedIndividualEvent = Pick<factory.event.IEvent<factory.eventType.ScreeningEvent>, 'project' | 'organizer' | 'id' | 'typeOf' | 'name' | 'doorTime' | 'endDate' | 'eventStatus' | 'location' | 'startDate' | 'superEvent' | 'offers' | 'coaInfo' | 'identifier' | 'maximumPhysicalAttendeeCapacity'>;
|
|
5
3
|
/**
|
|
6
4
|
* 興行イベントのsuperEventを作成する
|
|
7
5
|
*/
|
|
8
6
|
export declare function minimizeSuperEvent(params: {
|
|
9
|
-
superEventFromDB: Pick<factory.
|
|
7
|
+
superEventFromDB: Pick<factory.eventSeries.IEvent, 'additionalProperty' | 'alternativeHeadline' | 'description' | 'dubLanguage' | 'endDate' | 'headline' | 'id' | 'kanaName' | 'location' | 'name' | 'soundFormat' | 'startDate' | 'subtitleLanguage' | 'typeOf' | 'videoFormat' | 'workPerformed'>;
|
|
10
8
|
}): factory.event.screeningEvent.ISuperEvent;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { Connection, PipelineStage } from 'mongoose';
|
|
2
|
-
import { IAccountingReport, IChildReport, IOrder4report } from './mongoose/schemas/accountingReport';
|
|
3
2
|
import * as factory from '../factory';
|
|
3
|
+
import { IDocType } from './mongoose/schemas/accountingReport';
|
|
4
4
|
type IMatchStage = PipelineStage.Match;
|
|
5
|
-
export { IAccountingReport, IChildReport, IOrder4report };
|
|
6
5
|
/**
|
|
7
6
|
* 経理レポートリポジトリ
|
|
8
7
|
*/
|
|
@@ -14,7 +13,7 @@ export declare class AccountingReportRepo {
|
|
|
14
13
|
id?: string;
|
|
15
14
|
};
|
|
16
15
|
}): IMatchStage[];
|
|
17
|
-
syncMainEntity(params:
|
|
16
|
+
syncMainEntity(params: IDocType): Promise<void>;
|
|
18
17
|
/**
|
|
19
18
|
* 注文番号で削除する
|
|
20
19
|
*/
|
|
@@ -34,7 +33,7 @@ export declare class AccountingReportRepo {
|
|
|
34
33
|
mainEntity: {
|
|
35
34
|
orderNumber: string;
|
|
36
35
|
};
|
|
37
|
-
hasPart: IChildReport;
|
|
36
|
+
hasPart: factory.report.accountingReport.IChildReport;
|
|
38
37
|
}): Promise<void>;
|
|
39
38
|
search(params: factory.report.accountingReport.ISearchConditions & {
|
|
40
39
|
seller?: {
|
|
@@ -46,3 +45,4 @@ export declare class AccountingReportRepo {
|
|
|
46
45
|
$unset: any;
|
|
47
46
|
}): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
48
47
|
}
|
|
48
|
+
export {};
|
|
@@ -10,9 +10,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.AccountingReportRepo = void 0;
|
|
13
|
-
const accountingReport_1 = require("./mongoose/schemas/accountingReport");
|
|
14
13
|
const errorHandler_1 = require("../errorHandler");
|
|
15
14
|
const factory = require("../factory");
|
|
15
|
+
const accountingReport_1 = require("./mongoose/schemas/accountingReport");
|
|
16
16
|
const DEFAULT_SEARCH_LIMIT = 100;
|
|
17
17
|
/**
|
|
18
18
|
* 経理レポートリポジトリ
|
|
@@ -2,7 +2,7 @@ import { factory as surfrockFactory } from '@surfrock/sdk';
|
|
|
2
2
|
import { Connection, FilterQuery, UpdateQuery } from 'mongoose';
|
|
3
3
|
import * as factory from '../factory';
|
|
4
4
|
export type IAction4transaction<T extends factory.actionType.AcceptAction | factory.actionType.AuthorizeAction> = T extends factory.actionType.AcceptAction ? factory.action.accept.coaOffer.IAction | factory.action.accept.pay.IAction : T extends factory.actionType.AuthorizeAction ? (factory.action.authorize.offer.eventService.IAction | factory.action.authorize.offer.moneyTransfer.IAction | factory.action.authorize.offer.product.IAction | factory.action.authorize.paymentMethod.any.IAction) : never;
|
|
5
|
-
export type IAction<T extends factory.actionType> = T extends factory.actionType.OrderAction ? factory.action.trade.order.IAction : T extends factory.actionType.AcceptAction ? IAction4transaction<factory.actionType.AcceptAction> : T extends factory.actionType.AuthorizeAction ? factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>> : T extends factory.actionType.CheckAction ? (factory.action.check.paymentMethod.movieTicket.IAction | factory.action.check.
|
|
5
|
+
export type IAction<T extends factory.actionType> = T extends factory.actionType.OrderAction ? factory.action.trade.order.IAction : T extends factory.actionType.AcceptAction ? IAction4transaction<factory.actionType.AcceptAction> : T extends factory.actionType.AuthorizeAction ? factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>> : T extends factory.actionType.CheckAction ? (factory.action.check.paymentMethod.movieTicket.IAction | factory.action.check.thing.IAction) : T extends factory.actionType.CreateAction ? factory.action.create.IAction : T extends factory.actionType.MoneyTransfer ? factory.action.transfer.moneyTransfer.IAction : T extends factory.actionType.AddAction ? factory.action.update.add.IAction : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IAction : T extends factory.actionType.UpdateAction ? factory.action.update.update.IAction : T extends factory.actionType.InformAction ? factory.action.interact.inform.IAction<factory.action.interact.inform.IAttributes<factory.action.interact.inform.IObject>> & {
|
|
6
6
|
error?: any;
|
|
7
7
|
purpose?: never;
|
|
8
8
|
} : factory.action.IAction<factory.action.IAttributes<T, any, any>>;
|
|
@@ -4,8 +4,8 @@ import { IAggregateReservation } from './mongoose/schemas/aggregateReservation';
|
|
|
4
4
|
type IMatchStage = PipelineStage.Match;
|
|
5
5
|
export interface IUpdateAggregateReservationParams {
|
|
6
6
|
$set: {
|
|
7
|
-
aggregateOffer?: factory.event.
|
|
8
|
-
aggregateEntranceGate?: factory.event.
|
|
7
|
+
aggregateOffer?: factory.event.screeningEvent.IAggregateOffer;
|
|
8
|
+
aggregateEntranceGate?: factory.event.screeningEvent.IAggregateEntranceGate;
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
11
|
type ISearchWithReservationForIdResult = Pick<IAggregateReservation, 'aggregateOffer'> & {
|
|
@@ -30,9 +30,7 @@ export declare class CreativeWorkRepo {
|
|
|
30
30
|
$unset?: {
|
|
31
31
|
[key in keyof factory.creativeWork.movie.ICreativeWork]?: 1;
|
|
32
32
|
};
|
|
33
|
-
}[]
|
|
34
|
-
replace?: boolean;
|
|
35
|
-
}): Promise<{
|
|
33
|
+
}[]): Promise<{
|
|
36
34
|
bulkWriteResult: BulkWriteResult;
|
|
37
35
|
} | void>;
|
|
38
36
|
/**
|
|
@@ -159,7 +159,11 @@ class CreativeWorkRepo {
|
|
|
159
159
|
* コードをキーにして冪等作成
|
|
160
160
|
*/
|
|
161
161
|
// tslint:disable-next-line:max-func-body-length
|
|
162
|
-
upsertMoviesByIdentifier(params
|
|
162
|
+
upsertMoviesByIdentifier(params
|
|
163
|
+
// options?: {
|
|
164
|
+
// replace?: boolean;
|
|
165
|
+
// }
|
|
166
|
+
) {
|
|
163
167
|
return __awaiter(this, void 0, void 0, function* () {
|
|
164
168
|
const bulkWriteOps = [];
|
|
165
169
|
if (Array.isArray(params)) {
|
|
@@ -167,56 +171,70 @@ class CreativeWorkRepo {
|
|
|
167
171
|
params.forEach(({ $set, $unset }) => {
|
|
168
172
|
// リソースのユニークネスを保証するfilter
|
|
169
173
|
const filter = {
|
|
170
|
-
typeOf: $set.typeOf,
|
|
174
|
+
typeOf: { $eq: $set.typeOf },
|
|
171
175
|
'project.id': { $eq: $set.project.id },
|
|
172
176
|
identifier: { $eq: $set.identifier }
|
|
173
177
|
};
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
// const replaceOne: ReplaceOneModel<factory.creativeWork.movie.ICreativeWork> = {
|
|
178
|
-
// filter,
|
|
179
|
-
// replacement,
|
|
180
|
-
// upsert: true
|
|
181
|
-
// };
|
|
182
|
-
// bulkWriteOps.push({ replaceOne });
|
|
183
|
-
const { id, identifier, project, typeOf } = $set, setFields = __rest($set, ["id", "identifier", "project", "typeOf"]);
|
|
184
|
-
if (typeof identifier !== 'string' || identifier.length === 0) {
|
|
185
|
-
throw new factory.errors.ArgumentNull('identifier');
|
|
186
|
-
}
|
|
187
|
-
const setOnInsert = {
|
|
188
|
-
typeOf,
|
|
189
|
-
project,
|
|
190
|
-
identifier
|
|
191
|
-
};
|
|
192
|
-
const updateFilter = Object.assign({ $setOnInsert: setOnInsert, $set: setFields }, ($unset !== undefined) ? { $unset } : undefined);
|
|
193
|
-
const updateOne = {
|
|
194
|
-
filter,
|
|
195
|
-
update: updateFilter,
|
|
196
|
-
upsert: true
|
|
197
|
-
};
|
|
198
|
-
bulkWriteOps.push({ updateOne });
|
|
199
|
-
}
|
|
200
|
-
else {
|
|
201
|
-
const { typeOf, project, identifier, duration, name, additionalProperty, contentRating, headline, distributor, thumbnailUrl, datePublished } = $set, setOnInsertFields = __rest($set, ["typeOf", "project", "identifier", "duration", "name", "additionalProperty", "contentRating", "headline", "distributor", "thumbnailUrl", "datePublished"]);
|
|
202
|
-
if (typeof identifier !== 'string' || identifier.length === 0) {
|
|
203
|
-
throw new factory.errors.ArgumentNull('identifier');
|
|
204
|
-
}
|
|
205
|
-
const setOnInsert = Object.assign(Object.assign({}, setOnInsertFields), { typeOf,
|
|
206
|
-
project,
|
|
207
|
-
identifier });
|
|
208
|
-
const updateFilter = {
|
|
209
|
-
$setOnInsert: setOnInsert,
|
|
210
|
-
// 変更可能な属性のみ上書き
|
|
211
|
-
$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 } : [])
|
|
212
|
-
};
|
|
213
|
-
const updateOne = {
|
|
214
|
-
filter,
|
|
215
|
-
update: updateFilter,
|
|
216
|
-
upsert: true
|
|
217
|
-
};
|
|
218
|
-
bulkWriteOps.push({ updateOne });
|
|
178
|
+
const { id, identifier, project, typeOf } = $set, setFields = __rest($set, ["id", "identifier", "project", "typeOf"]);
|
|
179
|
+
if (typeof identifier !== 'string' || identifier.length === 0) {
|
|
180
|
+
throw new factory.errors.ArgumentNull('identifier');
|
|
219
181
|
}
|
|
182
|
+
const setOnInsert = {
|
|
183
|
+
typeOf,
|
|
184
|
+
project,
|
|
185
|
+
identifier
|
|
186
|
+
};
|
|
187
|
+
const updateFilter = Object.assign({ $setOnInsert: setOnInsert, $set: setFields }, ($unset !== undefined) ? { $unset } : undefined);
|
|
188
|
+
const updateOne = {
|
|
189
|
+
filter,
|
|
190
|
+
update: updateFilter,
|
|
191
|
+
upsert: true
|
|
192
|
+
};
|
|
193
|
+
bulkWriteOps.push({ updateOne });
|
|
194
|
+
// if (options?.replace === true) {
|
|
195
|
+
// } else {
|
|
196
|
+
// const {
|
|
197
|
+
// typeOf, project, identifier,
|
|
198
|
+
// duration,
|
|
199
|
+
// name,
|
|
200
|
+
// additionalProperty,
|
|
201
|
+
// contentRating,
|
|
202
|
+
// headline,
|
|
203
|
+
// distributor,
|
|
204
|
+
// thumbnailUrl,
|
|
205
|
+
// datePublished,
|
|
206
|
+
// ...setOnInsertFields
|
|
207
|
+
// } = $set;
|
|
208
|
+
// if (typeof identifier !== 'string' || identifier.length === 0) {
|
|
209
|
+
// throw new factory.errors.ArgumentNull('identifier');
|
|
210
|
+
// }
|
|
211
|
+
// const setOnInsert: MatchKeysAndValues<factory.creativeWork.movie.ICreativeWork> = {
|
|
212
|
+
// ...setOnInsertFields,
|
|
213
|
+
// typeOf,
|
|
214
|
+
// project,
|
|
215
|
+
// identifier
|
|
216
|
+
// };
|
|
217
|
+
// const updateFilter: UpdateFilter<factory.creativeWork.movie.ICreativeWork> = {
|
|
218
|
+
// $setOnInsert: setOnInsert,
|
|
219
|
+
// // 変更可能な属性のみ上書き
|
|
220
|
+
// $set: {
|
|
221
|
+
// ...(name !== undefined) ? { name } : undefined,
|
|
222
|
+
// ...(contentRating !== undefined) ? { contentRating } : undefined,
|
|
223
|
+
// ...(duration !== undefined) ? { duration } : undefined,
|
|
224
|
+
// ...(headline !== undefined) ? { headline } : undefined,
|
|
225
|
+
// ...(datePublished !== undefined) ? { datePublished } : undefined,
|
|
226
|
+
// ...(distributor !== undefined) ? { distributor } : undefined,
|
|
227
|
+
// ...(typeof thumbnailUrl === 'string') ? { thumbnailUrl } : undefined,
|
|
228
|
+
// ...(Array.isArray(additionalProperty)) ? { additionalProperty } : []
|
|
229
|
+
// }
|
|
230
|
+
// };
|
|
231
|
+
// const updateOne: UpdateOneModel<factory.creativeWork.movie.ICreativeWork> = {
|
|
232
|
+
// filter,
|
|
233
|
+
// update: updateFilter,
|
|
234
|
+
// upsert: true
|
|
235
|
+
// };
|
|
236
|
+
// bulkWriteOps.push({ updateOne });
|
|
237
|
+
// }
|
|
220
238
|
});
|
|
221
239
|
}
|
|
222
240
|
if (bulkWriteOps.length > 0) {
|