@chevre/domain 26.0.0-alpha.32 → 26.0.0-alpha.33
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/inform.js +2 -8
- package/lib/chevre/repo/action/update.d.ts +2 -11
- package/lib/chevre/repo/action/use.d.ts +5 -8
- package/lib/chevre/repo/action/use.js +17 -10
- package/lib/chevre/repo/mongoose/schemas/action/inform.d.ts +1 -3
- package/lib/chevre/repo/mongoose/schemas/action/inform.js +0 -4
- package/lib/chevre/repo/mongoose/schemas/action/use.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/action/use.js +0 -1
- package/lib/chevre/service/reserve/useReservation.js +1 -1
- package/package.json +2 -2
|
@@ -78,10 +78,7 @@ class InformActionRepo {
|
|
|
78
78
|
return { id, startDate, typeOf: creatingAction.typeOf };
|
|
79
79
|
}
|
|
80
80
|
async completeInformAction(params) {
|
|
81
|
-
const doc = await this.informActionModel.findOneAndUpdate({
|
|
82
|
-
_id: { $eq: params.id },
|
|
83
|
-
typeOf: { $eq: params.typeOf }
|
|
84
|
-
}, {
|
|
81
|
+
const doc = await this.informActionModel.findOneAndUpdate({ _id: { $eq: params.id } }, {
|
|
85
82
|
$set: {
|
|
86
83
|
actionStatus: factory_1.factory.actionStatusType.CompletedActionStatus,
|
|
87
84
|
result: params.result,
|
|
@@ -101,10 +98,7 @@ class InformActionRepo {
|
|
|
101
98
|
const actionError = Array.isArray(params.error)
|
|
102
99
|
? params.error.map(unknown2actionError_1.unknown2actionError)
|
|
103
100
|
: (0, unknown2actionError_1.unknown2actionError)(params.error);
|
|
104
|
-
const doc = await this.informActionModel.findOneAndUpdate({
|
|
105
|
-
typeOf: { $eq: params.typeOf },
|
|
106
|
-
_id: { $eq: params.id }
|
|
107
|
-
}, {
|
|
101
|
+
const doc = await this.informActionModel.findOneAndUpdate({ _id: { $eq: params.id } }, {
|
|
108
102
|
$set: {
|
|
109
103
|
actionStatus: factory_1.factory.actionStatusType.FailedActionStatus,
|
|
110
104
|
error: actionError,
|
|
@@ -4,23 +4,14 @@ 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
6
|
type IKeyOfProjection = keyof IDocType;
|
|
7
|
-
type IFindParams =
|
|
8
|
-
id?: string;
|
|
9
|
-
typeOf?: StartableActionType;
|
|
10
|
-
object?: {
|
|
11
|
-
id?: string;
|
|
12
|
-
};
|
|
13
|
-
result?: {
|
|
14
|
-
id?: string;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
7
|
+
type IFindParams = factory.action.update.update.IFindParams;
|
|
17
8
|
/**
|
|
18
9
|
* リソース編集アクションリポジトリ
|
|
19
10
|
*/
|
|
20
11
|
export declare class UpdateActionRepo {
|
|
21
12
|
private readonly updateActionModel;
|
|
22
13
|
constructor(connection: Connection);
|
|
23
|
-
static CREATE_MONGO_CONDITIONS(params: IFindParams): FilterQuery<IDocType>[];
|
|
14
|
+
static CREATE_MONGO_CONDITIONS(params: Pick<IFindParams, 'id' | 'object' | 'project' | 'result' | 'startFrom' | 'startThrough' | 'typeOf'>): FilterQuery<IDocType>[];
|
|
24
15
|
/**
|
|
25
16
|
* アクション開始
|
|
26
17
|
*/
|
|
@@ -6,13 +6,7 @@ type IAction = IDocType & {
|
|
|
6
6
|
id: string;
|
|
7
7
|
};
|
|
8
8
|
type IKeyOfProjection = keyof IDocType;
|
|
9
|
-
type IFindParams =
|
|
10
|
-
actionStatus?: factory.actionStatusType;
|
|
11
|
-
id?: string;
|
|
12
|
-
object?: {
|
|
13
|
-
id?: string;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
9
|
+
type IFindParams = factory.action.consume.use.reservation.IFindParams;
|
|
16
10
|
/**
|
|
17
11
|
* 予約使用アクションリポジトリ
|
|
18
12
|
*/
|
|
@@ -27,7 +21,6 @@ export declare class UseActionRepo {
|
|
|
27
21
|
completeUseAction(params: {
|
|
28
22
|
typeOf: StartableActionType;
|
|
29
23
|
id: string;
|
|
30
|
-
result: factory.action.consume.use.reservation.IResult;
|
|
31
24
|
}): Promise<void>;
|
|
32
25
|
/**
|
|
33
26
|
* アクション失敗
|
|
@@ -38,5 +31,9 @@ export declare class UseActionRepo {
|
|
|
38
31
|
error: Error | Error[] | unknown;
|
|
39
32
|
}): Promise<void>;
|
|
40
33
|
findUseActions(params: IFindParams, inclusion: IKeyOfProjection[]): Promise<IAction[]>;
|
|
34
|
+
/**
|
|
35
|
+
* 移行処理
|
|
36
|
+
*/
|
|
37
|
+
migrateUseAction(params: factory.action.consume.use.reservation.IAction): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
41
38
|
}
|
|
42
39
|
export {};
|
|
@@ -10,7 +10,6 @@ const AVAILABLE_PROJECT_FIELDS = [
|
|
|
10
10
|
'actionStatus',
|
|
11
11
|
'typeOf',
|
|
12
12
|
'agent',
|
|
13
|
-
'result',
|
|
14
13
|
'error',
|
|
15
14
|
'object',
|
|
16
15
|
'startDate',
|
|
@@ -72,13 +71,10 @@ class UseActionRepo {
|
|
|
72
71
|
return { id, startDate, typeOf: creatingAction.typeOf };
|
|
73
72
|
}
|
|
74
73
|
async completeUseAction(params) {
|
|
75
|
-
const doc = await this.useActionModel.findOneAndUpdate({
|
|
76
|
-
_id: { $eq: params.id },
|
|
77
|
-
typeOf: { $eq: params.typeOf }
|
|
78
|
-
}, {
|
|
74
|
+
const doc = await this.useActionModel.findOneAndUpdate({ _id: { $eq: params.id } }, {
|
|
79
75
|
$set: {
|
|
80
76
|
actionStatus: factory_1.factory.actionStatusType.CompletedActionStatus,
|
|
81
|
-
result: params.result,
|
|
77
|
+
// result: params.result,
|
|
82
78
|
endDate: new Date()
|
|
83
79
|
}
|
|
84
80
|
}, { new: false, projection: { _id: 1 } })
|
|
@@ -95,10 +91,7 @@ class UseActionRepo {
|
|
|
95
91
|
const actionError = Array.isArray(params.error)
|
|
96
92
|
? params.error.map(unknown2actionError_1.unknown2actionError)
|
|
97
93
|
: (0, unknown2actionError_1.unknown2actionError)(params.error);
|
|
98
|
-
const doc = await this.useActionModel.findOneAndUpdate({
|
|
99
|
-
typeOf: { $eq: params.typeOf },
|
|
100
|
-
_id: { $eq: params.id }
|
|
101
|
-
}, {
|
|
94
|
+
const doc = await this.useActionModel.findOneAndUpdate({ _id: { $eq: params.id } }, {
|
|
102
95
|
$set: {
|
|
103
96
|
actionStatus: factory_1.factory.actionStatusType.FailedActionStatus,
|
|
104
97
|
error: actionError,
|
|
@@ -138,5 +131,19 @@ class UseActionRepo {
|
|
|
138
131
|
.lean() // 2024-08-26~
|
|
139
132
|
.exec();
|
|
140
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* 移行処理
|
|
136
|
+
*/
|
|
137
|
+
async migrateUseAction(params) {
|
|
138
|
+
const { id, ...upserting } = params;
|
|
139
|
+
return this.useActionModel.updateOne({
|
|
140
|
+
_id: { $eq: id }
|
|
141
|
+
}, {
|
|
142
|
+
$setOnInsert: {
|
|
143
|
+
...upserting,
|
|
144
|
+
_id: id
|
|
145
|
+
}
|
|
146
|
+
}, { upsert: true });
|
|
147
|
+
}
|
|
141
148
|
}
|
|
142
149
|
exports.UseActionRepo = UseActionRepo;
|
|
@@ -1,9 +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'
|
|
5
|
-
error?: any;
|
|
6
|
-
};
|
|
4
|
+
type IDocType = Pick<factory.action.interact.inform.IAction, 'about' | 'actionStatus' | 'agent' | 'endDate' | 'object' | 'project' | 'recipient' | 'result' | 'startDate' | 'target' | 'typeOf' | 'purpose' | 'error'>;
|
|
7
5
|
type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
|
|
8
6
|
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
9
7
|
type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition, IDocType>;
|
|
@@ -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' | '
|
|
4
|
+
type IDocType = Pick<factory.action.consume.use.reservation.IAction, 'actionStatus' | 'agent' | 'endDate' | 'error' | 'instrument' | 'location' | 'object' | 'project' | 'startDate' | 'typeOf'>;
|
|
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>;
|
|
@@ -16,7 +16,6 @@ const schemaDefinition = {
|
|
|
16
16
|
startDate: { type: Date, required: true },
|
|
17
17
|
instrument: mongoose_1.SchemaTypes.Mixed,
|
|
18
18
|
location: mongoose_1.SchemaTypes.Mixed,
|
|
19
|
-
result: mongoose_1.SchemaTypes.Mixed,
|
|
20
19
|
error: mongoose_1.SchemaTypes.Mixed,
|
|
21
20
|
endDate: Date,
|
|
22
21
|
};
|
|
@@ -82,7 +82,7 @@ function useReservation(params) {
|
|
|
82
82
|
}
|
|
83
83
|
throw error;
|
|
84
84
|
}
|
|
85
|
-
await repos.actions.use.completeUseAction({ typeOf: action.typeOf, id: action.id
|
|
85
|
+
await repos.actions.use.completeUseAction({ typeOf: action.typeOf, id: action.id });
|
|
86
86
|
await (0, onReservationUsed_1.onReservationUsed)(attendedReservation, {
|
|
87
87
|
...actionAttributes,
|
|
88
88
|
id: action.id,
|
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.7",
|
|
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.33"
|
|
92
92
|
}
|