@chevre/domain 26.0.0-alpha.34 → 26.0.0-alpha.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/chevre/repo/action/actionProcess.d.ts +1 -1
- package/lib/chevre/repo/action/inform.js +6 -2
- package/lib/chevre/repo/action/update.d.ts +2 -1
- package/lib/chevre/repo/action/update.js +5 -1
- package/lib/chevre/repo/action/use.js +6 -2
- package/lib/chevre/repo/mongoose/schemas/action/inform.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/action/inform.js +9 -4
- package/lib/chevre/repo/mongoose/schemas/action/update.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/action/update.js +13 -8
- package/lib/chevre/repo/mongoose/schemas/action/use.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/action/use.js +11 -6
- package/lib/chevre/repository.d.ts +0 -5
- package/lib/chevre/repository.js +0 -11
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +1 -3
- package/lib/chevre/service/task/checkResource.js +14 -57
- package/lib/chevre/service/validation/validateOrder.d.ts +0 -4
- package/lib/chevre/service/validation/validateOrder.js +1 -1
- package/package.json +2 -2
- package/lib/chevre/repo/action/checkThing.d.ts +0 -8
- package/lib/chevre/repo/action/checkThing.js +0 -13
- package/lib/chevre/repo/mongoose/schemas/pendingReservationAggregate.d.ts +0 -25
- package/lib/chevre/repo/mongoose/schemas/pendingReservationAggregate.js +0 -100
- package/lib/chevre/service/validation/validateEvent.d.ts +0 -11
- package/lib/chevre/service/validation/validateEvent.js +0 -21
|
@@ -3,7 +3,7 @@ import { factory } from '../../factory';
|
|
|
3
3
|
import { IModel as IActionModel } from '../mongoose/schemas/action';
|
|
4
4
|
import { IModel as IActionRecipeModel } from '../mongoose/schemas/actionRecipe';
|
|
5
5
|
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.paymentMethod.any.IAction) : never;
|
|
6
|
-
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 ?
|
|
6
|
+
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 : T extends factory.actionType.CreateAction ? factory.action.create.IAction : factory.action.IAction<factory.action.IAttributes<T, any, any>>;
|
|
7
7
|
export interface ICancelActionAction {
|
|
8
8
|
typeOf: factory.actionType.CancelAction;
|
|
9
9
|
agent: factory.action.IParticipantAsPerson | factory.action.IParticipantAsProject | factory.action.IParticipantAsWebApplication;
|
|
@@ -18,8 +18,10 @@ const AVAILABLE_PROJECT_FIELDS = [
|
|
|
18
18
|
'about',
|
|
19
19
|
'purpose',
|
|
20
20
|
'recipient',
|
|
21
|
-
'target'
|
|
21
|
+
'target',
|
|
22
|
+
'expires'
|
|
22
23
|
];
|
|
24
|
+
const EXPIRE_AFTER_SECONDS = 2592000; // 30 days
|
|
23
25
|
/**
|
|
24
26
|
* 通知アクションリポジトリ
|
|
25
27
|
*/
|
|
@@ -65,10 +67,12 @@ class InformActionRepo {
|
|
|
65
67
|
*/
|
|
66
68
|
async startInformAction(attributes) {
|
|
67
69
|
const startDate = new Date();
|
|
70
|
+
const expires = new Date(startDate.getTime() + EXPIRE_AFTER_SECONDS * 1000);
|
|
68
71
|
const creatingAction = {
|
|
69
72
|
...attributes,
|
|
70
73
|
actionStatus: factory_1.factory.actionStatusType.ActiveActionStatus,
|
|
71
|
-
startDate
|
|
74
|
+
startDate,
|
|
75
|
+
expires
|
|
72
76
|
};
|
|
73
77
|
const result = await this.informActionModel.insertMany(creatingAction, { rawResult: true });
|
|
74
78
|
const id = result.insertedIds?.[0]?.toHexString();
|
|
@@ -3,6 +3,7 @@ import { factory } from '../../factory';
|
|
|
3
3
|
import { IDocType } from '../mongoose/schemas/action/update';
|
|
4
4
|
type StartableActionType = factory.actionType.AddAction | factory.actionType.UpdateAction | factory.actionType.ReplaceAction | factory.actionType.DeleteAction;
|
|
5
5
|
type IAction<T extends StartableActionType> = 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.DeleteAction ? factory.action.update.deleteAction.IAction : never;
|
|
6
|
+
type IActionAttributes<T extends StartableActionType> = T extends factory.actionType.AddAction ? factory.action.update.add.IAttributes : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IAttributes : T extends factory.actionType.UpdateAction ? factory.action.update.update.IAttributes : T extends factory.actionType.DeleteAction ? factory.action.update.deleteAction.IAttributes : never;
|
|
6
7
|
type IKeyOfProjection = keyof IDocType;
|
|
7
8
|
type IFindParams = factory.action.update.update.IFindParams;
|
|
8
9
|
/**
|
|
@@ -15,7 +16,7 @@ export declare class UpdateActionRepo {
|
|
|
15
16
|
/**
|
|
16
17
|
* アクション開始
|
|
17
18
|
*/
|
|
18
|
-
startUpdateAction<T extends StartableActionType>(attributes:
|
|
19
|
+
startUpdateAction<T extends StartableActionType>(attributes: IActionAttributes<T>): Promise<Pick<IAction<T>, 'id' | 'typeOf' | 'startDate'>>;
|
|
19
20
|
completeUpdateAction(params: {
|
|
20
21
|
typeOf: StartableActionType;
|
|
21
22
|
id: string;
|
|
@@ -18,7 +18,9 @@ const AVAILABLE_PROJECT_FIELDS = [
|
|
|
18
18
|
'instrument',
|
|
19
19
|
'targetCollection',
|
|
20
20
|
'sameAs',
|
|
21
|
+
'expires'
|
|
21
22
|
];
|
|
23
|
+
const EXPIRE_AFTER_SECONDS = 2592000; // 30 days
|
|
22
24
|
/**
|
|
23
25
|
* リソース編集アクションリポジトリ
|
|
24
26
|
*/
|
|
@@ -63,10 +65,12 @@ class UpdateActionRepo {
|
|
|
63
65
|
*/
|
|
64
66
|
async startUpdateAction(attributes) {
|
|
65
67
|
const startDate = new Date();
|
|
68
|
+
const expires = new Date(startDate.getTime() + EXPIRE_AFTER_SECONDS * 1000);
|
|
66
69
|
const creatingAction = {
|
|
67
70
|
...attributes,
|
|
68
71
|
actionStatus: factory_1.factory.actionStatusType.ActiveActionStatus,
|
|
69
|
-
startDate
|
|
72
|
+
startDate,
|
|
73
|
+
expires
|
|
70
74
|
};
|
|
71
75
|
const result = await this.updateActionModel.insertMany(creatingAction, { rawResult: true });
|
|
72
76
|
const id = result.insertedIds?.[0]?.toHexString();
|
|
@@ -15,8 +15,10 @@ const AVAILABLE_PROJECT_FIELDS = [
|
|
|
15
15
|
'startDate',
|
|
16
16
|
'endDate',
|
|
17
17
|
'instrument',
|
|
18
|
-
'location'
|
|
18
|
+
'location',
|
|
19
|
+
'expires'
|
|
19
20
|
];
|
|
21
|
+
const EXPIRE_AFTER_SECONDS = 2592000; // 30 days
|
|
20
22
|
/**
|
|
21
23
|
* 予約使用アクションリポジトリ
|
|
22
24
|
*/
|
|
@@ -58,10 +60,12 @@ class UseActionRepo {
|
|
|
58
60
|
*/
|
|
59
61
|
async startUseAction(attributes) {
|
|
60
62
|
const startDate = new Date();
|
|
63
|
+
const expires = new Date(startDate.getTime() + EXPIRE_AFTER_SECONDS * 1000);
|
|
61
64
|
const creatingAction = {
|
|
62
65
|
...attributes,
|
|
63
66
|
actionStatus: factory_1.factory.actionStatusType.ActiveActionStatus,
|
|
64
|
-
startDate
|
|
67
|
+
startDate,
|
|
68
|
+
expires
|
|
65
69
|
};
|
|
66
70
|
const result = await this.useActionModel.insertMany(creatingAction, { rawResult: true });
|
|
67
71
|
const id = result.insertedIds?.[0]?.toHexString();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
2
|
import { IVirtuals } from '../../virtuals';
|
|
3
3
|
import { factory } from '../../../../factory';
|
|
4
|
-
type IDocType = Pick<factory.action.interact.inform.IAction, 'about' | 'actionStatus' | 'agent' | 'endDate' | 'object' | 'project' | 'recipient' | 'result' | 'startDate' | 'target' | 'typeOf' | 'purpose' | 'error'>;
|
|
4
|
+
type IDocType = Pick<factory.action.interact.inform.IAction, 'about' | 'actionStatus' | 'agent' | 'endDate' | 'object' | 'project' | 'recipient' | 'result' | 'startDate' | 'target' | 'typeOf' | 'purpose' | 'error' | 'expires'>;
|
|
5
5
|
type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
|
|
6
6
|
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
7
7
|
type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition, IDocType>;
|
|
@@ -14,6 +14,7 @@ const schemaDefinition = {
|
|
|
14
14
|
agent: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
15
15
|
object: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
16
16
|
startDate: { type: Date, required: true },
|
|
17
|
+
expires: { type: Date, required: true },
|
|
17
18
|
target: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
18
19
|
recipient: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
19
20
|
result: mongoose_1.SchemaTypes.Mixed,
|
|
@@ -48,14 +49,18 @@ const schemaOptions = {
|
|
|
48
49
|
};
|
|
49
50
|
const indexes = [
|
|
50
51
|
[
|
|
51
|
-
{
|
|
52
|
+
{ expires: 1 },
|
|
52
53
|
{
|
|
53
|
-
name: '
|
|
54
|
-
expireAfterSeconds:
|
|
54
|
+
name: 'expires',
|
|
55
|
+
expireAfterSeconds: 0
|
|
55
56
|
}
|
|
56
57
|
],
|
|
57
58
|
[
|
|
58
|
-
{
|
|
59
|
+
{ startDate: -1 },
|
|
60
|
+
{ name: 'startDate' }
|
|
61
|
+
],
|
|
62
|
+
[
|
|
63
|
+
{ 'project.id': 1, startDate: -1 },
|
|
59
64
|
{ name: 'projectId' }
|
|
60
65
|
],
|
|
61
66
|
];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
2
|
import { IVirtuals } from '../../virtuals';
|
|
3
3
|
import { factory } from '../../../../factory';
|
|
4
|
-
type Keys = 'actionStatus' | 'agent' | 'endDate' | 'error' | 'instrument' | 'object' | 'project' | 'result' | 'sameAs' | 'startDate' | 'targetCollection' | 'typeOf';
|
|
4
|
+
type Keys = 'actionStatus' | 'agent' | 'endDate' | 'error' | 'instrument' | 'object' | 'project' | 'result' | 'sameAs' | 'startDate' | 'targetCollection' | 'typeOf' | 'expires';
|
|
5
5
|
type IDocType = Pick<factory.action.update.add.IAction, Keys> | Pick<factory.action.update.replace.IAction, Keys> | Pick<factory.action.update.update.IAction, Keys> | Pick<factory.action.update.deleteAction.IAction, Keys>;
|
|
6
6
|
type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
|
|
7
7
|
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
@@ -14,6 +14,7 @@ const schemaDefinition = {
|
|
|
14
14
|
agent: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
15
15
|
object: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
16
16
|
startDate: { type: Date, required: true },
|
|
17
|
+
expires: { type: Date, required: true },
|
|
17
18
|
result: mongoose_1.SchemaTypes.Mixed,
|
|
18
19
|
error: mongoose_1.SchemaTypes.Mixed,
|
|
19
20
|
endDate: Date,
|
|
@@ -47,22 +48,26 @@ const schemaOptions = {
|
|
|
47
48
|
};
|
|
48
49
|
const indexes = [
|
|
49
50
|
[
|
|
50
|
-
{
|
|
51
|
+
{ expires: 1 },
|
|
51
52
|
{
|
|
52
|
-
name: '
|
|
53
|
-
expireAfterSeconds:
|
|
53
|
+
name: 'expires',
|
|
54
|
+
expireAfterSeconds: 0
|
|
54
55
|
}
|
|
55
56
|
],
|
|
56
57
|
[
|
|
57
|
-
{
|
|
58
|
+
{ startDate: -1 },
|
|
59
|
+
{ name: 'startDate' }
|
|
60
|
+
],
|
|
61
|
+
[
|
|
62
|
+
{ 'project.id': 1, startDate: -1 },
|
|
58
63
|
{ name: 'projectId' }
|
|
59
64
|
],
|
|
60
65
|
[
|
|
61
|
-
{ typeOf: 1, startDate: 1 },
|
|
66
|
+
{ typeOf: 1, startDate: -1 },
|
|
62
67
|
{ name: 'typeOf' }
|
|
63
68
|
],
|
|
64
69
|
[
|
|
65
|
-
{ 'object.id': 1, startDate: 1 },
|
|
70
|
+
{ 'object.id': 1, startDate: -1 },
|
|
66
71
|
{
|
|
67
72
|
name: 'objectId',
|
|
68
73
|
partialFilterExpression: {
|
|
@@ -71,7 +76,7 @@ const indexes = [
|
|
|
71
76
|
}
|
|
72
77
|
],
|
|
73
78
|
[
|
|
74
|
-
{ 'result.id': 1, startDate: 1 },
|
|
79
|
+
{ 'result.id': 1, startDate: -1 },
|
|
75
80
|
{
|
|
76
81
|
name: 'resultId',
|
|
77
82
|
partialFilterExpression: {
|
|
@@ -80,7 +85,7 @@ const indexes = [
|
|
|
80
85
|
}
|
|
81
86
|
],
|
|
82
87
|
[
|
|
83
|
-
{ 'sameAs.id': 1, startDate: 1 },
|
|
88
|
+
{ 'sameAs.id': 1, startDate: -1 },
|
|
84
89
|
{
|
|
85
90
|
name: 'sameAsId',
|
|
86
91
|
partialFilterExpression: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
2
|
import { IVirtuals } from '../../virtuals';
|
|
3
3
|
import { factory } from '../../../../factory';
|
|
4
|
-
type IDocType = Pick<factory.action.consume.use.reservation.IAction, 'actionStatus' | 'agent' | 'endDate' | 'error' | 'instrument' | 'location' | 'object' | 'project' | 'startDate' | 'typeOf'>;
|
|
4
|
+
type IDocType = Pick<factory.action.consume.use.reservation.IAction, 'actionStatus' | 'agent' | 'endDate' | 'error' | 'instrument' | 'location' | 'object' | 'project' | 'startDate' | 'typeOf' | 'expires'>;
|
|
5
5
|
type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
|
|
6
6
|
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
7
7
|
type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition, IDocType>;
|
|
@@ -14,6 +14,7 @@ const schemaDefinition = {
|
|
|
14
14
|
agent: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
15
15
|
object: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
16
16
|
startDate: { type: Date, required: true },
|
|
17
|
+
expires: { type: Date, required: true },
|
|
17
18
|
instrument: mongoose_1.SchemaTypes.Mixed,
|
|
18
19
|
location: mongoose_1.SchemaTypes.Mixed,
|
|
19
20
|
error: mongoose_1.SchemaTypes.Mixed,
|
|
@@ -45,22 +46,26 @@ const schemaOptions = {
|
|
|
45
46
|
};
|
|
46
47
|
const indexes = [
|
|
47
48
|
[
|
|
48
|
-
{
|
|
49
|
+
{ expires: 1 },
|
|
49
50
|
{
|
|
50
|
-
name: '
|
|
51
|
-
expireAfterSeconds:
|
|
51
|
+
name: 'expires',
|
|
52
|
+
expireAfterSeconds: 0
|
|
52
53
|
}
|
|
53
54
|
],
|
|
54
55
|
[
|
|
55
|
-
{
|
|
56
|
+
{ startDate: -1 },
|
|
57
|
+
{ name: 'startDate' }
|
|
58
|
+
],
|
|
59
|
+
[
|
|
60
|
+
{ 'project.id': 1, startDate: -1 },
|
|
56
61
|
{ name: 'projectId' }
|
|
57
62
|
],
|
|
58
63
|
[
|
|
59
|
-
{ actionStatus: 1, startDate: 1 },
|
|
64
|
+
{ actionStatus: 1, startDate: -1 },
|
|
60
65
|
{ name: 'actionStatus' }
|
|
61
66
|
],
|
|
62
67
|
[
|
|
63
|
-
{ 'object.id': 1, startDate: 1 },
|
|
68
|
+
{ 'object.id': 1, startDate: -1 },
|
|
64
69
|
{
|
|
65
70
|
name: 'objectId',
|
|
66
71
|
partialFilterExpression: {
|
|
@@ -12,7 +12,6 @@ import type { AuthorizeOfferActionRepo } from './repo/action/authorizeOffer';
|
|
|
12
12
|
import type { AuthorizePaymentMethodActionRepo } from './repo/action/authorizePaymentMethod';
|
|
13
13
|
import type { AuthorizeTicketedObjectActionRepo } from './repo/action/authorizeTicketedObject';
|
|
14
14
|
import type { CheckMovieTicketActionRepo } from './repo/action/checkMovieTicket';
|
|
15
|
-
import type { CheckThingActionRepo } from './repo/action/checkThing';
|
|
16
15
|
import type { InformActionRepo } from './repo/action/inform';
|
|
17
16
|
import type { PayActionRepo } from './repo/action/pay';
|
|
18
17
|
import type { RefundActionRepo } from './repo/action/refund';
|
|
@@ -157,10 +156,6 @@ export declare namespace action {
|
|
|
157
156
|
namespace CheckMovieTicket {
|
|
158
157
|
function createInstance(...params: ConstructorParameters<typeof CheckMovieTicketActionRepo>): Promise<CheckMovieTicketActionRepo>;
|
|
159
158
|
}
|
|
160
|
-
type CheckThing = CheckThingActionRepo;
|
|
161
|
-
namespace CheckThing {
|
|
162
|
-
function createInstance(...params: ConstructorParameters<typeof CheckThingActionRepo>): Promise<CheckThingActionRepo>;
|
|
163
|
-
}
|
|
164
159
|
type Pay = PayActionRepo;
|
|
165
160
|
namespace Pay {
|
|
166
161
|
function createInstance(...params: ConstructorParameters<typeof PayActionRepo>): Promise<PayActionRepo>;
|
package/lib/chevre/repository.js
CHANGED
|
@@ -125,17 +125,6 @@ var action;
|
|
|
125
125
|
}
|
|
126
126
|
CheckMovieTicket.createInstance = createInstance;
|
|
127
127
|
})(CheckMovieTicket = action.CheckMovieTicket || (action.CheckMovieTicket = {}));
|
|
128
|
-
let CheckThing;
|
|
129
|
-
(function (CheckThing) {
|
|
130
|
-
let repo;
|
|
131
|
-
async function createInstance(...params) {
|
|
132
|
-
if (repo === undefined) {
|
|
133
|
-
repo = (await import('./repo/action/checkThing.js')).CheckThingActionRepo;
|
|
134
|
-
}
|
|
135
|
-
return new repo(...params);
|
|
136
|
-
}
|
|
137
|
-
CheckThing.createInstance = createInstance;
|
|
138
|
-
})(CheckThing = action.CheckThing || (action.CheckThing = {}));
|
|
139
128
|
let Pay;
|
|
140
129
|
(function (Pay) {
|
|
141
130
|
let repo;
|
|
@@ -134,9 +134,7 @@ function createCheckResourceTask(order) {
|
|
|
134
134
|
object: {
|
|
135
135
|
orderNumber: order.orderNumber,
|
|
136
136
|
typeOf: order.typeOf
|
|
137
|
-
}
|
|
138
|
-
// project: order.project,
|
|
139
|
-
typeOf: factory_1.factory.actionType.CheckAction
|
|
137
|
+
}
|
|
140
138
|
};
|
|
141
139
|
const taskIdentifier = (0, util_1.format)('%s:%s:%s:%s', order.project.id, factory_1.factory.taskName.CheckResource, order.typeOf, order.orderNumber);
|
|
142
140
|
return {
|
|
@@ -3,72 +3,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.call = call;
|
|
4
4
|
const factory_1 = require("../../factory");
|
|
5
5
|
const acceptedOffer_1 = require("../../repo/acceptedOffer");
|
|
6
|
-
const checkThing_1 = require("../../repo/action/checkThing");
|
|
7
6
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
8
|
-
const event_1 = require("../../repo/event");
|
|
9
7
|
const order_1 = require("../../repo/order");
|
|
10
|
-
const setting_1 = require("../../repo/setting");
|
|
11
|
-
const stockHolder_1 = require("../../repo/stockHolder");
|
|
12
|
-
const task_1 = require("../../repo/task");
|
|
13
|
-
const validateEvent_1 = require("../validation/validateEvent");
|
|
14
8
|
const validateOrder_1 = require("../validation/validateOrder");
|
|
15
9
|
/**
|
|
16
10
|
* タスク実行関数
|
|
17
11
|
*/
|
|
18
12
|
function call(params) {
|
|
19
|
-
return async ({ connection
|
|
20
|
-
if (redisClient === undefined) {
|
|
21
|
-
throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
|
|
22
|
-
}
|
|
23
|
-
const actionRepo = new checkThing_1.CheckThingActionRepo(connection);
|
|
13
|
+
return async ({ connection }) => {
|
|
24
14
|
const { data } = params;
|
|
25
|
-
const actionAttributes = {
|
|
26
|
-
agent: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project },
|
|
27
|
-
object: data.object,
|
|
28
|
-
project: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project },
|
|
29
|
-
typeOf: factory_1.factory.actionType.CheckAction,
|
|
30
|
-
sameAs: { id: params.id, typeOf: 'Task' } // add sameAs(2025-09-22~)
|
|
31
|
-
};
|
|
32
|
-
const action = await actionRepo.start(actionAttributes);
|
|
33
15
|
const objectTypeOf = data.object.typeOf;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
break;
|
|
48
|
-
// support ScreeningEvent(2025-05-01~)
|
|
49
|
-
case factory_1.factory.eventType.ScreeningEvent:
|
|
50
|
-
await (0, validateEvent_1.validateEvent)({
|
|
51
|
-
id: data.object.id,
|
|
52
|
-
project: { id: params.project.id }
|
|
53
|
-
})({
|
|
54
|
-
event: new event_1.EventRepo(connection),
|
|
55
|
-
stockHolder: new stockHolder_1.StockHolderRepo({ connection })
|
|
56
|
-
});
|
|
57
|
-
break;
|
|
58
|
-
default:
|
|
59
|
-
throw new factory_1.factory.errors.NotImplemented(`${objectTypeOf} not implemented`);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
try {
|
|
64
|
-
await actionRepo.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
65
|
-
}
|
|
66
|
-
catch (__) {
|
|
67
|
-
// 失敗したら仕方ない
|
|
68
|
-
}
|
|
69
|
-
throw error;
|
|
16
|
+
switch (objectTypeOf) {
|
|
17
|
+
case factory_1.factory.order.OrderType.Order:
|
|
18
|
+
await (0, validateOrder_1.validateOrder)({
|
|
19
|
+
orderNumber: data.object.orderNumber,
|
|
20
|
+
project: { id: params.project.id }
|
|
21
|
+
})({
|
|
22
|
+
acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
|
|
23
|
+
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
24
|
+
order: new order_1.OrderRepo(connection),
|
|
25
|
+
});
|
|
26
|
+
break;
|
|
27
|
+
default:
|
|
28
|
+
throw new factory_1.factory.errors.NotImplemented(`${objectTypeOf} not implemented`);
|
|
70
29
|
}
|
|
71
|
-
const actionResult = {}; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
72
|
-
await actionRepo.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
73
30
|
};
|
|
74
31
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { AcceptedOfferRepo } from '../../repo/acceptedOffer';
|
|
2
2
|
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
3
3
|
import type { OrderRepo } from '../../repo/order';
|
|
4
|
-
import type { SettingRepo } from '../../repo/setting';
|
|
5
|
-
import type { TaskRepo } from '../../repo/task';
|
|
6
4
|
export declare function validateOrder(params: {
|
|
7
5
|
orderNumber: string;
|
|
8
6
|
project: {
|
|
@@ -12,6 +10,4 @@ export declare function validateOrder(params: {
|
|
|
12
10
|
acceptedOffer: AcceptedOfferRepo;
|
|
13
11
|
assetTransaction: AssetTransactionRepo;
|
|
14
12
|
order: OrderRepo;
|
|
15
|
-
setting: SettingRepo;
|
|
16
|
-
task: TaskRepo;
|
|
17
13
|
}) => Promise<void>;
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.validateOrder = validateOrder;
|
|
7
7
|
// import createDebug from 'debug';
|
|
8
8
|
const moment_1 = __importDefault(require("moment"));
|
|
9
|
+
// import type { SettingRepo } from '../../repo/setting';
|
|
9
10
|
const factory_1 = require("../../factory");
|
|
10
11
|
const factory_2 = require("../offer/event/authorize/factory");
|
|
11
|
-
// import { acceptedOffers2amount as acceptedOffers2amount4product } from '../offer/product/factory';
|
|
12
12
|
const validateMovieTicket_1 = require("../transaction/placeOrder/confirm/validation/validateMovieTicket");
|
|
13
13
|
function validateOrder(params) {
|
|
14
14
|
return async (repos) => {
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.1090.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.1090.0",
|
|
14
|
-
"@chevre/factory": "10.3.0-alpha.
|
|
14
|
+
"@chevre/factory": "10.3.0-alpha.10",
|
|
15
15
|
"@motionpicture/coa-service": "10.0.0",
|
|
16
16
|
"@motionpicture/gmo-service": "6.1.0-alpha.0",
|
|
17
17
|
"@sendgrid/client": "8.1.4",
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
"postversion": "git push origin --tags",
|
|
89
89
|
"prepublishOnly": "npm run clean && npm run build"
|
|
90
90
|
},
|
|
91
|
-
"version": "26.0.0-alpha.
|
|
91
|
+
"version": "26.0.0-alpha.36"
|
|
92
92
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { factory } from '../../factory';
|
|
2
|
-
import { ActionProcessRepo } from './actionProcess';
|
|
3
|
-
export type ICheckThingAction = factory.action.check.thing.IAction;
|
|
4
|
-
/**
|
|
5
|
-
* 汎用リソース検証アクションリポジトリ
|
|
6
|
-
*/
|
|
7
|
-
export declare class CheckThingActionRepo extends ActionProcessRepo<ICheckThingAction, never> {
|
|
8
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CheckThingActionRepo = void 0;
|
|
4
|
-
// import { MONGO_MAX_TIME_MS } from '../settings';
|
|
5
|
-
// import { createSchema, IModel as IActionModel, modelName } from './mongoose/schemas/action';
|
|
6
|
-
// import { createSchema as createRecipeSchema, IModel as IActionRecipeModel, modelName as recipeModelName } from './mongoose/schemas/actionRecipe';
|
|
7
|
-
const actionProcess_1 = require("./actionProcess");
|
|
8
|
-
/**
|
|
9
|
-
* 汎用リソース検証アクションリポジトリ
|
|
10
|
-
*/
|
|
11
|
-
class CheckThingActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
12
|
-
}
|
|
13
|
-
exports.CheckThingActionRepo = CheckThingActionRepo;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
|
-
import { factory } from '../../../factory';
|
|
3
|
-
import { IVirtuals } from '../virtuals';
|
|
4
|
-
interface IAggregateReservation {
|
|
5
|
-
project: {
|
|
6
|
-
id: string;
|
|
7
|
-
typeOf: factory.organizationType.Project;
|
|
8
|
-
};
|
|
9
|
-
typeOf: 'AggregateReservation';
|
|
10
|
-
reservationCount: number;
|
|
11
|
-
reservationFor: {
|
|
12
|
-
id: string;
|
|
13
|
-
startDate: Date;
|
|
14
|
-
};
|
|
15
|
-
reservationIds: string[];
|
|
16
|
-
expires: Date;
|
|
17
|
-
}
|
|
18
|
-
type IDocType = IAggregateReservation;
|
|
19
|
-
type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
|
|
20
|
-
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
21
|
-
type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition, IDocType>;
|
|
22
|
-
declare const modelName = "PendingReservationAggregate";
|
|
23
|
-
declare const indexes: [d: IndexDefinition, o: IndexOptions][];
|
|
24
|
-
declare function createSchema(): ISchema;
|
|
25
|
-
export { createSchema, IDocType, IModel, IAggregateReservation, indexes, modelName };
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.modelName = exports.indexes = void 0;
|
|
4
|
-
exports.createSchema = createSchema;
|
|
5
|
-
const mongoose_1 = require("mongoose");
|
|
6
|
-
const settings_1 = require("../../../settings");
|
|
7
|
-
const writeConcern_1 = require("../writeConcern");
|
|
8
|
-
const modelName = 'PendingReservationAggregate';
|
|
9
|
-
exports.modelName = modelName;
|
|
10
|
-
const schemaDefinition = {
|
|
11
|
-
project: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
12
|
-
typeOf: { type: String, required: true },
|
|
13
|
-
expires: { type: Date, required: true },
|
|
14
|
-
reservationCount: { type: Number, required: true },
|
|
15
|
-
reservationFor: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
16
|
-
reservationIds: [mongoose_1.SchemaTypes.Mixed]
|
|
17
|
-
};
|
|
18
|
-
const schemaOptions = {
|
|
19
|
-
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
20
|
-
autoCreate: false,
|
|
21
|
-
collection: 'pendingReservationAggregates',
|
|
22
|
-
id: true,
|
|
23
|
-
read: settings_1.MONGO_READ_PREFERENCE,
|
|
24
|
-
writeConcern: writeConcern_1.writeConcern,
|
|
25
|
-
strict: true,
|
|
26
|
-
strictQuery: false,
|
|
27
|
-
timestamps: false,
|
|
28
|
-
versionKey: false,
|
|
29
|
-
toJSON: {
|
|
30
|
-
getters: false,
|
|
31
|
-
virtuals: false,
|
|
32
|
-
minimize: false,
|
|
33
|
-
versionKey: false
|
|
34
|
-
},
|
|
35
|
-
toObject: {
|
|
36
|
-
getters: false,
|
|
37
|
-
virtuals: true,
|
|
38
|
-
minimize: false,
|
|
39
|
-
versionKey: false
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
const indexes = [
|
|
43
|
-
[
|
|
44
|
-
{ expires: -1 },
|
|
45
|
-
{ name: 'expires' }
|
|
46
|
-
],
|
|
47
|
-
// [
|
|
48
|
-
// { 'project.id': 1, expires: -1 },
|
|
49
|
-
// { name: 'projectId' }
|
|
50
|
-
// ],
|
|
51
|
-
// [
|
|
52
|
-
// { 'reservationFor.id': 1, expires: -1 },
|
|
53
|
-
// { name: 'reservationForId' }
|
|
54
|
-
// ],
|
|
55
|
-
// [
|
|
56
|
-
// { reservationIds: 1, expires: -1 },
|
|
57
|
-
// { name: 'reservationIds' }
|
|
58
|
-
// ], // このindexで性能下がる?
|
|
59
|
-
// [
|
|
60
|
-
// { reservationIds: 1 },
|
|
61
|
-
// { name: 'reservationIds' }
|
|
62
|
-
// ], // このindexで性能下がる?
|
|
63
|
-
[
|
|
64
|
-
{ 'reservationFor.id': 1 },
|
|
65
|
-
{
|
|
66
|
-
unique: true,
|
|
67
|
-
name: 'uniqueReservationForId'
|
|
68
|
-
}
|
|
69
|
-
],
|
|
70
|
-
[
|
|
71
|
-
{
|
|
72
|
-
'reservationFor.id': 1,
|
|
73
|
-
reservationCount: 1
|
|
74
|
-
},
|
|
75
|
-
{ name: 'increaseReservationCount' }
|
|
76
|
-
],
|
|
77
|
-
[
|
|
78
|
-
{
|
|
79
|
-
'reservationFor.id': 1,
|
|
80
|
-
reservationIds: 1
|
|
81
|
-
},
|
|
82
|
-
{ name: 'decreaseReservationCount' }
|
|
83
|
-
]
|
|
84
|
-
];
|
|
85
|
-
exports.indexes = indexes;
|
|
86
|
-
/**
|
|
87
|
-
* 保留予約集計スキーマ
|
|
88
|
-
*/
|
|
89
|
-
let schema;
|
|
90
|
-
function createSchema() {
|
|
91
|
-
if (schema === undefined) {
|
|
92
|
-
schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
|
|
93
|
-
if (settings_1.MONGO_AUTO_INDEX) {
|
|
94
|
-
indexes.forEach((indexParams) => {
|
|
95
|
-
schema?.index(...indexParams);
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return schema;
|
|
100
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { EventRepo } from '../../repo/event';
|
|
2
|
-
import type { StockHolderRepo } from '../../repo/stockHolder';
|
|
3
|
-
export declare function validateEvent(__: {
|
|
4
|
-
id: string;
|
|
5
|
-
project: {
|
|
6
|
-
id: string;
|
|
7
|
-
};
|
|
8
|
-
}): (__2: {
|
|
9
|
-
event: EventRepo;
|
|
10
|
-
stockHolder: StockHolderRepo;
|
|
11
|
-
}) => Promise<void>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// import createDebug from 'debug';
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.validateEvent = validateEvent;
|
|
5
|
-
// import { factory } from '../../factory';
|
|
6
|
-
// const debug = createDebug('chevre-domain:service:validation');
|
|
7
|
-
function validateEvent(__) {
|
|
8
|
-
return async (__2) => {
|
|
9
|
-
// const event: Pick<factory.event.screeningEvent.IEvent, 'id' | 'startDate'> =
|
|
10
|
-
// await repos.event.projectEventFieldsById(
|
|
11
|
-
// { id: params.id },
|
|
12
|
-
// ['startDate']
|
|
13
|
-
// );
|
|
14
|
-
// discontinue redis(2025-08-17~)
|
|
15
|
-
// debug('validateEvent: conflicted?', params.project.id, event.id, event.startDate);
|
|
16
|
-
// await repos.stockHolder.checkIfConflicted({
|
|
17
|
-
// eventId: event.id,
|
|
18
|
-
// startDate: event.startDate
|
|
19
|
-
// });
|
|
20
|
-
};
|
|
21
|
-
}
|