@chevre/domain 22.4.0-alpha.2 → 22.4.0-alpha.3
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.
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../lib/index';
|
|
5
|
+
|
|
6
|
+
const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
+
|
|
8
|
+
async function main() {
|
|
9
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
10
|
+
|
|
11
|
+
const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
12
|
+
|
|
13
|
+
const result = await eventRepo.cancelEvent({
|
|
14
|
+
project: { id: project.id },
|
|
15
|
+
id: '7iri6w0m1h1hu5y'
|
|
16
|
+
});
|
|
17
|
+
console.log(result);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
main()
|
|
21
|
+
.then()
|
|
22
|
+
.catch(console.error);
|
|
@@ -1179,7 +1179,7 @@ class ActionRepo {
|
|
|
1179
1179
|
};
|
|
1180
1180
|
const options = {
|
|
1181
1181
|
upsert: true,
|
|
1182
|
-
|
|
1182
|
+
includeResultMetadata: true
|
|
1183
1183
|
};
|
|
1184
1184
|
return this.actionRecipeModel.updateOne(filter, update, options)
|
|
1185
1185
|
.exec();
|
|
@@ -1204,7 +1204,7 @@ class ActionRepo {
|
|
|
1204
1204
|
};
|
|
1205
1205
|
const options = {
|
|
1206
1206
|
upsert: true,
|
|
1207
|
-
|
|
1207
|
+
includeResultMetadata: true
|
|
1208
1208
|
};
|
|
1209
1209
|
return this.actionModel.updateOne(filter, update, options)
|
|
1210
1210
|
.exec();
|
|
@@ -1535,7 +1535,7 @@ class ActionRepo {
|
|
|
1535
1535
|
};
|
|
1536
1536
|
const options = {
|
|
1537
1537
|
upsert: true,
|
|
1538
|
-
|
|
1538
|
+
includeResultMetadata: true
|
|
1539
1539
|
};
|
|
1540
1540
|
return this.actionRecipeModel.updateOne(filter, update, options)
|
|
1541
1541
|
.exec();
|
package/lib/chevre/repo/event.js
CHANGED
|
@@ -753,10 +753,10 @@ class EventRepo {
|
|
|
753
753
|
*/
|
|
754
754
|
cancelEvent(params) {
|
|
755
755
|
return __awaiter(this, void 0, void 0, function* () {
|
|
756
|
-
|
|
756
|
+
return this.eventModel.updateOne({
|
|
757
757
|
_id: { $eq: params.id },
|
|
758
758
|
'project.id': { $eq: params.project.id }
|
|
759
|
-
}, { $set: { eventStatus: factory.eventStatusType.EventCancelled } }, {
|
|
759
|
+
}, { $set: { eventStatus: factory.eventStatusType.EventCancelled } }, { includeResultMetadata: true })
|
|
760
760
|
.exec();
|
|
761
761
|
});
|
|
762
762
|
}
|
|
@@ -922,31 +922,10 @@ class EventRepo {
|
|
|
922
922
|
$push: {
|
|
923
923
|
'offers.seller.makesOffer': params.offers.seller.makesOffer
|
|
924
924
|
}
|
|
925
|
-
}, {
|
|
925
|
+
}, { includeResultMetadata: true })
|
|
926
926
|
.exec();
|
|
927
927
|
});
|
|
928
928
|
}
|
|
929
|
-
// public async deleteAvailableAtOrFrom(params: {
|
|
930
|
-
// id: string;
|
|
931
|
-
// offers: {
|
|
932
|
-
// seller: {
|
|
933
|
-
// makesOffer: { availableAtOrFrom: { id: string } };
|
|
934
|
-
// };
|
|
935
|
-
// };
|
|
936
|
-
// }): Promise<void> {
|
|
937
|
-
// await this.eventModel.updateOne(
|
|
938
|
-
// { _id: { $eq: params.id } },
|
|
939
|
-
// {
|
|
940
|
-
// $pull: {
|
|
941
|
-
// 'offers.seller.makesOffer': {
|
|
942
|
-
// 'availableAtOrFrom.id': { $eq: params.offers.seller.makesOffer.availableAtOrFrom.id }
|
|
943
|
-
// }
|
|
944
|
-
// }
|
|
945
|
-
// },
|
|
946
|
-
// { rawResult: true }
|
|
947
|
-
// )
|
|
948
|
-
// .exec();
|
|
949
|
-
// }
|
|
950
929
|
unsetUnnecessaryFields(params) {
|
|
951
930
|
return __awaiter(this, void 0, void 0, function* () {
|
|
952
931
|
return this.eventModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
|
package/package.json
CHANGED