@chevre/domain 22.14.0-alpha.15 → 22.14.0-alpha.16
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/productOffer.d.ts +1 -71
- package/lib/chevre/repo/productOffer.js +8 -191
- package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.d.ts +0 -2
- package/lib/chevre/service/assetTransaction/reserve/start.d.ts +0 -2
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +0 -2
- package/lib/chevre/service/offer/event/authorize.d.ts +0 -2
- package/lib/chevre/service/offer/product.d.ts +0 -3
- package/lib/chevre/service/offer/product.js +29 -38
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +0 -2
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +7 -5
- package/lib/chevre/service/task/onResourceUpdated.js +1 -2
- package/package.json +1 -1
|
@@ -1,77 +1,7 @@
|
|
|
1
1
|
import { Connection } from 'mongoose';
|
|
2
|
-
import * as factory from '../factory';
|
|
3
2
|
/**
|
|
4
3
|
* プロダクトオファーリポジトリ
|
|
5
4
|
*/
|
|
6
5
|
export declare class ProductOfferRepo {
|
|
7
|
-
|
|
8
|
-
constructor(connection: Connection);
|
|
9
|
-
/**
|
|
10
|
-
* プロダクトオファー検索
|
|
11
|
-
*/
|
|
12
|
-
search(params: {
|
|
13
|
-
limit?: number;
|
|
14
|
-
page?: number;
|
|
15
|
-
project?: {
|
|
16
|
-
id?: {
|
|
17
|
-
$eq?: string;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
itemOffered?: {
|
|
21
|
-
id?: {
|
|
22
|
-
$eq?: string;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
seller?: {
|
|
26
|
-
id?: {
|
|
27
|
-
$eq?: string;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
}): Promise<(Pick<factory.product.IOffer, 'availabilityEnds' | 'availabilityStarts' | 'seller' | 'validFrom' | 'validThrough'> & {
|
|
31
|
-
itemOffered: Pick<factory.product.IProduct, 'id' | 'name' | 'typeOf'>;
|
|
32
|
-
})[]>;
|
|
33
|
-
create(params: factory.product.IOffer & {
|
|
34
|
-
project: {
|
|
35
|
-
id: string;
|
|
36
|
-
};
|
|
37
|
-
itemOffered: {
|
|
38
|
-
/**
|
|
39
|
-
* プロダクトID
|
|
40
|
-
*/
|
|
41
|
-
id: string;
|
|
42
|
-
};
|
|
43
|
-
}): Promise<{
|
|
44
|
-
id: string;
|
|
45
|
-
}>;
|
|
46
|
-
update(params: factory.product.IOffer & {
|
|
47
|
-
project: {
|
|
48
|
-
id: string;
|
|
49
|
-
};
|
|
50
|
-
itemOffered: {
|
|
51
|
-
/**
|
|
52
|
-
* プロダクトID
|
|
53
|
-
*/
|
|
54
|
-
id: string;
|
|
55
|
-
};
|
|
56
|
-
}): Promise<{
|
|
57
|
-
id: string;
|
|
58
|
-
}>;
|
|
59
|
-
deleteOne(params: Pick<factory.product.IOffer, 'seller'> & {
|
|
60
|
-
project: {
|
|
61
|
-
id: string;
|
|
62
|
-
};
|
|
63
|
-
itemOffered: {
|
|
64
|
-
/**
|
|
65
|
-
* プロダクトID
|
|
66
|
-
*/
|
|
67
|
-
id: string;
|
|
68
|
-
};
|
|
69
|
-
}): Promise<{
|
|
70
|
-
id: string;
|
|
71
|
-
}>;
|
|
72
|
-
deleteManyBySellerId(params: Pick<factory.product.IOffer, 'seller'> & {
|
|
73
|
-
project: {
|
|
74
|
-
id: string;
|
|
75
|
-
};
|
|
76
|
-
}): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
6
|
+
constructor(__: Connection);
|
|
77
7
|
}
|
|
@@ -1,201 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.ProductOfferRepo = void 0;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
// import * as factory from '../factory';
|
|
5
|
+
// import { MONGO_MAX_TIME_MS } from '../settings';
|
|
6
|
+
// import { createSchema, IModel, modelName } from './mongoose/schemas/product';
|
|
7
|
+
// type IMatchStage = PipelineStage.Match;
|
|
17
8
|
/**
|
|
18
9
|
* プロダクトオファーリポジトリ
|
|
19
10
|
*/
|
|
11
|
+
// tslint:disable-next-line:no-unnecessary-class
|
|
20
12
|
class ProductOfferRepo {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* プロダクトオファー検索
|
|
26
|
-
*/
|
|
27
|
-
search(params) {
|
|
28
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
var _a, _b, _c, _d, _e, _f;
|
|
30
|
-
const matchStages = [{
|
|
31
|
-
$match: {
|
|
32
|
-
typeOf: {
|
|
33
|
-
$in: [
|
|
34
|
-
factory.product.ProductType.MembershipService,
|
|
35
|
-
factory.product.ProductType.PaymentCard
|
|
36
|
-
]
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}];
|
|
40
|
-
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
41
|
-
if (typeof projectIdEq === 'string') {
|
|
42
|
-
matchStages.push({ $match: { 'project.id': { $eq: projectIdEq } } });
|
|
43
|
-
}
|
|
44
|
-
const itemOfferedIdEq = (_d = (_c = params.itemOffered) === null || _c === void 0 ? void 0 : _c.id) === null || _d === void 0 ? void 0 : _d.$eq;
|
|
45
|
-
if (typeof itemOfferedIdEq === 'string') {
|
|
46
|
-
matchStages.push({ $match: { _id: { $eq: new mongoose_1.Types.ObjectId(itemOfferedIdEq) } } });
|
|
47
|
-
}
|
|
48
|
-
const sellerIdEq = (_f = (_e = params.seller) === null || _e === void 0 ? void 0 : _e.id) === null || _f === void 0 ? void 0 : _f.$eq;
|
|
49
|
-
if (typeof sellerIdEq === 'string') {
|
|
50
|
-
matchStages.push({ $match: { 'offers.seller.id': { $exists: true, $eq: sellerIdEq } } });
|
|
51
|
-
}
|
|
52
|
-
const aggregate = this.productModel.aggregate([
|
|
53
|
-
{ $sort: { productID: factory.sortType.Ascending } },
|
|
54
|
-
{
|
|
55
|
-
$unwind: {
|
|
56
|
-
path: '$offers'
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
...matchStages,
|
|
60
|
-
{
|
|
61
|
-
$project: {
|
|
62
|
-
_id: 0,
|
|
63
|
-
itemOffered: {
|
|
64
|
-
id: { $toString: '$_id' },
|
|
65
|
-
name: '$name',
|
|
66
|
-
typeOf: '$typeOf'
|
|
67
|
-
},
|
|
68
|
-
availabilityEnds: '$offers.availabilityEnds',
|
|
69
|
-
availabilityStarts: '$offers.availabilityStarts',
|
|
70
|
-
validFrom: '$offers.validFrom',
|
|
71
|
-
validThrough: '$offers.validThrough',
|
|
72
|
-
seller: '$offers.seller'
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
]);
|
|
76
|
-
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
77
|
-
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
78
|
-
aggregate.limit(params.limit * page)
|
|
79
|
-
.skip(params.limit * (page - 1));
|
|
80
|
-
}
|
|
81
|
-
return aggregate.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
82
|
-
.exec();
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
create(params) {
|
|
86
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
-
var _a;
|
|
88
|
-
const sellerId = (_a = params.seller) === null || _a === void 0 ? void 0 : _a.id;
|
|
89
|
-
if (typeof sellerId !== 'string' || sellerId.length === 0) {
|
|
90
|
-
throw new factory.errors.ArgumentNull('seller.id');
|
|
91
|
-
}
|
|
92
|
-
// プロダクト存在確認
|
|
93
|
-
let doc = yield this.productModel.findOne({
|
|
94
|
-
'project.id': { $eq: params.project.id },
|
|
95
|
-
_id: { $eq: params.itemOffered.id }
|
|
96
|
-
}, { _id: 1 })
|
|
97
|
-
.exec();
|
|
98
|
-
if (doc === null) {
|
|
99
|
-
throw new factory.errors.NotFound('Product');
|
|
100
|
-
}
|
|
101
|
-
const creatingOffer = {
|
|
102
|
-
priceCurrency: factory.priceCurrency.JPY,
|
|
103
|
-
availabilityEnds: params.availabilityEnds,
|
|
104
|
-
availabilityStarts: params.availabilityStarts,
|
|
105
|
-
validFrom: params.validFrom,
|
|
106
|
-
validThrough: params.validThrough,
|
|
107
|
-
seller: { id: sellerId },
|
|
108
|
-
typeOf: factory.offerType.Offer
|
|
109
|
-
};
|
|
110
|
-
doc = yield this.productModel.findOneAndUpdate({
|
|
111
|
-
'project.id': { $eq: params.project.id },
|
|
112
|
-
_id: { $eq: params.itemOffered.id },
|
|
113
|
-
'offers.seller.id': { $ne: sellerId }
|
|
114
|
-
}, {
|
|
115
|
-
$push: { offers: creatingOffer }
|
|
116
|
-
}, {
|
|
117
|
-
new: true,
|
|
118
|
-
projection: { _id: 1 }
|
|
119
|
-
})
|
|
120
|
-
.exec();
|
|
121
|
-
// 存在しなければプロバイダーID重複
|
|
122
|
-
if (doc === null) {
|
|
123
|
-
throw new factory.errors.AlreadyInUse('offers.seller', ['id']);
|
|
124
|
-
}
|
|
125
|
-
return doc.toObject();
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
update(params) {
|
|
129
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
-
var _a;
|
|
131
|
-
const sellerId = (_a = params.seller) === null || _a === void 0 ? void 0 : _a.id;
|
|
132
|
-
if (typeof sellerId !== 'string' || sellerId.length === 0) {
|
|
133
|
-
throw new factory.errors.ArgumentNull('seller.id');
|
|
134
|
-
}
|
|
135
|
-
const doc = yield this.productModel.findOneAndUpdate({
|
|
136
|
-
'project.id': { $eq: params.project.id },
|
|
137
|
-
_id: { $eq: params.itemOffered.id },
|
|
138
|
-
'offers.seller.id': { $exists: true, $eq: sellerId }
|
|
139
|
-
}, Object.assign(Object.assign(Object.assign(Object.assign({}, (params.availabilityEnds instanceof Date)
|
|
140
|
-
? { 'offers.$[offerBySeller].availabilityEnds': params.availabilityEnds }
|
|
141
|
-
: undefined), (params.availabilityStarts instanceof Date)
|
|
142
|
-
? { 'offers.$[offerBySeller].availabilityStarts': params.availabilityStarts }
|
|
143
|
-
: undefined), (params.validFrom instanceof Date)
|
|
144
|
-
? { 'offers.$[offerBySeller].validFrom': params.validFrom }
|
|
145
|
-
: undefined), (params.validThrough instanceof Date)
|
|
146
|
-
? { 'offers.$[offerBySeller].validThrough': params.validThrough }
|
|
147
|
-
: undefined), {
|
|
148
|
-
new: true,
|
|
149
|
-
arrayFilters: [
|
|
150
|
-
{ 'offerBySeller.seller.id': { $eq: sellerId } }
|
|
151
|
-
],
|
|
152
|
-
projection: { _id: 1 }
|
|
153
|
-
})
|
|
154
|
-
.exec();
|
|
155
|
-
if (doc === null) {
|
|
156
|
-
throw new factory.errors.NotFound('Product');
|
|
157
|
-
}
|
|
158
|
-
return doc.toObject();
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
deleteOne(params) {
|
|
162
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
163
|
-
var _a;
|
|
164
|
-
const sellerId = (_a = params.seller) === null || _a === void 0 ? void 0 : _a.id;
|
|
165
|
-
if (typeof sellerId !== 'string' || sellerId.length === 0) {
|
|
166
|
-
throw new factory.errors.ArgumentNull('seller.id');
|
|
167
|
-
}
|
|
168
|
-
const doc = yield this.productModel.findOneAndUpdate({
|
|
169
|
-
'project.id': { $eq: params.project.id },
|
|
170
|
-
_id: { $eq: params.itemOffered.id },
|
|
171
|
-
'offers.seller.id': { $exists: true, $eq: sellerId }
|
|
172
|
-
}, {
|
|
173
|
-
$pull: { offers: { 'seller.id': { $exists: true, $eq: sellerId } } }
|
|
174
|
-
}, {
|
|
175
|
-
projection: { _id: 1 }
|
|
176
|
-
})
|
|
177
|
-
.exec();
|
|
178
|
-
if (doc === null) {
|
|
179
|
-
throw new factory.errors.NotFound('Product');
|
|
180
|
-
}
|
|
181
|
-
return doc.toObject();
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
deleteManyBySellerId(params) {
|
|
185
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
186
|
-
var _a;
|
|
187
|
-
const sellerId = (_a = params.seller) === null || _a === void 0 ? void 0 : _a.id;
|
|
188
|
-
if (typeof sellerId !== 'string' || sellerId.length === 0) {
|
|
189
|
-
throw new factory.errors.ArgumentNull('seller.id');
|
|
190
|
-
}
|
|
191
|
-
return this.productModel.updateMany({
|
|
192
|
-
'project.id': { $eq: params.project.id },
|
|
193
|
-
'offers.seller.id': { $exists: true, $eq: sellerId }
|
|
194
|
-
}, {
|
|
195
|
-
$pull: { offers: { 'seller.id': { $exists: true, $eq: sellerId } } }
|
|
196
|
-
})
|
|
197
|
-
.exec();
|
|
198
|
-
});
|
|
13
|
+
// private readonly productModel: IModel;
|
|
14
|
+
constructor(__) {
|
|
15
|
+
// this.productModel = connection.model(modelName, createSchema());
|
|
199
16
|
}
|
|
200
17
|
}
|
|
201
18
|
exports.ProductOfferRepo = ProductOfferRepo;
|
|
@@ -5,7 +5,6 @@ import type { OfferRepo } from '../../../../repo/offer/unitPriceInCatalog';
|
|
|
5
5
|
import type { OfferCatalogRepo } from '../../../../repo/offerCatalog';
|
|
6
6
|
import type { PaymentServiceRepo } from '../../../../repo/paymentService';
|
|
7
7
|
import type { ProductRepo } from '../../../../repo/product';
|
|
8
|
-
import type { ProductOfferRepo } from '../../../../repo/productOffer';
|
|
9
8
|
type IObjectSubReservation = factory.assetTransaction.reserve.IObjectSubReservation;
|
|
10
9
|
declare function createSubReservations(params: {
|
|
11
10
|
acceptedOffers: factory.assetTransaction.reserve.IAcceptedTicketOfferWithoutDetail[];
|
|
@@ -25,6 +24,5 @@ declare function createSubReservations(params: {
|
|
|
25
24
|
offerCatalog: OfferCatalogRepo;
|
|
26
25
|
paymentService: PaymentServiceRepo;
|
|
27
26
|
product: ProductRepo;
|
|
28
|
-
productOffer: ProductOfferRepo;
|
|
29
27
|
}) => Promise<IObjectSubReservation[]>;
|
|
30
28
|
export { createSubReservations };
|
|
@@ -14,7 +14,6 @@ import type { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
|
14
14
|
import { SeatRepo } from '../../../repo/place/seat';
|
|
15
15
|
import type { PriceSpecificationRepo } from '../../../repo/priceSpecification';
|
|
16
16
|
import type { ProductRepo } from '../../../repo/product';
|
|
17
|
-
import type { ProductOfferRepo } from '../../../repo/productOffer';
|
|
18
17
|
import type { ProjectRepo } from '../../../repo/project';
|
|
19
18
|
import type { OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
|
|
20
19
|
import type { SettingRepo } from '../../../repo/setting';
|
|
@@ -34,7 +33,6 @@ interface IStartOperationRepos {
|
|
|
34
33
|
offerRateLimit: OfferRateLimitRepo;
|
|
35
34
|
paymentService: PaymentServiceRepo;
|
|
36
35
|
product: ProductRepo;
|
|
37
|
-
productOffer: ProductOfferRepo;
|
|
38
36
|
priceSpecification: PriceSpecificationRepo;
|
|
39
37
|
project: ProjectRepo;
|
|
40
38
|
seat: SeatRepo;
|
|
@@ -16,7 +16,6 @@ import type { PaymentServiceRepo } from '../../../../repo/paymentService';
|
|
|
16
16
|
import type { SeatRepo } from '../../../../repo/place/seat';
|
|
17
17
|
import type { PriceSpecificationRepo } from '../../../../repo/priceSpecification';
|
|
18
18
|
import type { ProductRepo } from '../../../../repo/product';
|
|
19
|
-
import type { ProductOfferRepo } from '../../../../repo/productOffer';
|
|
20
19
|
import type { ProjectRepo } from '../../../../repo/project';
|
|
21
20
|
import type { OfferRateLimitRepo } from '../../../../repo/rateLimit/offer';
|
|
22
21
|
import type { SettingRepo } from '../../../../repo/setting';
|
|
@@ -63,7 +62,6 @@ declare function processStartReserve4chevre(params: {
|
|
|
63
62
|
offerRateLimit: OfferRateLimitRepo;
|
|
64
63
|
paymentService: PaymentServiceRepo;
|
|
65
64
|
product: ProductRepo;
|
|
66
|
-
productOffer: ProductOfferRepo;
|
|
67
65
|
priceSpecification: PriceSpecificationRepo;
|
|
68
66
|
project: ProjectRepo;
|
|
69
67
|
seat: SeatRepo;
|
|
@@ -18,7 +18,6 @@ import type { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
|
18
18
|
import type { SeatRepo } from '../../../repo/place/seat';
|
|
19
19
|
import type { PriceSpecificationRepo } from '../../../repo/priceSpecification';
|
|
20
20
|
import type { ProductRepo } from '../../../repo/product';
|
|
21
|
-
import type { ProductOfferRepo } from '../../../repo/productOffer';
|
|
22
21
|
import type { ProjectRepo } from '../../../repo/project';
|
|
23
22
|
import type { OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
|
|
24
23
|
import type { SettingRepo } from '../../../repo/setting';
|
|
@@ -47,7 +46,6 @@ interface IAuthorizeRepos {
|
|
|
47
46
|
paymentService: PaymentServiceRepo;
|
|
48
47
|
priceSpecification: PriceSpecificationRepo;
|
|
49
48
|
product: ProductRepo;
|
|
50
|
-
productOffer: ProductOfferRepo;
|
|
51
49
|
project: ProjectRepo;
|
|
52
50
|
seat: SeatRepo;
|
|
53
51
|
setting: SettingRepo;
|
|
@@ -8,7 +8,6 @@ import type { OrderInTransactionRepo } from '../../repo/orderInTransaction';
|
|
|
8
8
|
import type { OrderNumberRepo } from '../../repo/orderNumber';
|
|
9
9
|
import type { OwnershipInfoRepo } from '../../repo/ownershipInfo';
|
|
10
10
|
import type { ProductRepo } from '../../repo/product';
|
|
11
|
-
import type { ProductOfferRepo } from '../../repo/productOffer';
|
|
12
11
|
import type { ProjectRepo } from '../../repo/project';
|
|
13
12
|
import type { ServiceOutputRepo } from '../../repo/serviceOutput';
|
|
14
13
|
import type { ServiceOutputIdentifierRepo } from '../../repo/serviceOutputIdentifier';
|
|
@@ -24,7 +23,6 @@ export interface IAuthorizeOperationRepos {
|
|
|
24
23
|
orderNumber: OrderNumberRepo;
|
|
25
24
|
ownershipInfo: OwnershipInfoRepo;
|
|
26
25
|
product: ProductRepo;
|
|
27
|
-
productOffer: ProductOfferRepo;
|
|
28
26
|
project: ProjectRepo;
|
|
29
27
|
serviceOutput: ServiceOutputRepo;
|
|
30
28
|
serviceOutputIdentifier: ServiceOutputIdentifierRepo;
|
|
@@ -65,7 +63,6 @@ export declare function search(params: {
|
|
|
65
63
|
offer: OfferRepo;
|
|
66
64
|
offerCatalog: OfferCatalogRepo;
|
|
67
65
|
product: ProductRepo;
|
|
68
|
-
productOffer: ProductOfferRepo;
|
|
69
66
|
}) => Promise<{
|
|
70
67
|
offers: factory.product.ITicketOffer[];
|
|
71
68
|
product: Pick<factory.product.IProduct, "id" | "productID" | "typeOf" | "name" | "project" | "serviceOutput" | "serviceType" | "description">;
|
|
@@ -13,7 +13,6 @@ exports.ERROR_MESSAGE_ALREADY_REGISTERED = void 0;
|
|
|
13
13
|
exports.search = search;
|
|
14
14
|
exports.authorize = authorize;
|
|
15
15
|
exports.voidTransaction = voidTransaction;
|
|
16
|
-
const moment = require("moment");
|
|
17
16
|
const factory = require("../../factory");
|
|
18
17
|
const accountTransactionIdentifier_1 = require("../../factory/accountTransactionIdentifier");
|
|
19
18
|
const availableProductTypes_1 = require("../../factory/availableProductTypes");
|
|
@@ -28,8 +27,8 @@ exports.ERROR_MESSAGE_ALREADY_REGISTERED = 'Already registered';
|
|
|
28
27
|
*/
|
|
29
28
|
function search(params) {
|
|
30
29
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
// const now = moment();
|
|
31
31
|
var _a;
|
|
32
|
-
const now = moment();
|
|
33
32
|
const searchProductsResult = yield repos.product.projectFields({
|
|
34
33
|
limit: 1,
|
|
35
34
|
page: 1,
|
|
@@ -47,28 +46,24 @@ function search(params) {
|
|
|
47
46
|
|| product.typeOf === factory.product.ProductType.PaymentCard) {
|
|
48
47
|
const sellerId = (_a = params.seller) === null || _a === void 0 ? void 0 : _a.id;
|
|
49
48
|
if (typeof sellerId === 'string') {
|
|
50
|
-
//
|
|
51
|
-
//
|
|
49
|
+
// productsドキュメント参照のoffers検証は廃止(2025-09-22~)
|
|
50
|
+
// const productOffers = await repos.productOffer.search({
|
|
51
|
+
// project: { id: { $eq: params.project.id } },
|
|
52
|
+
// itemOffered: { id: { $eq: params.itemOffered.id } },
|
|
53
|
+
// seller: { id: { $eq: sellerId } }
|
|
54
|
+
// });
|
|
55
|
+
// const hasValidOffer = productOffers.some((o) => {
|
|
56
|
+
// return o.seller?.id === sellerId
|
|
57
|
+
// && o.validFrom !== undefined
|
|
58
|
+
// && moment(o.validFrom)
|
|
59
|
+
// .isSameOrBefore(now)
|
|
60
|
+
// && o.validThrough !== undefined
|
|
61
|
+
// && moment(o.validThrough)
|
|
62
|
+
// .isSameOrAfter(now);
|
|
63
|
+
// });
|
|
64
|
+
// if (!hasValidOffer) {
|
|
52
65
|
// return { offers: [], product };
|
|
53
66
|
// }
|
|
54
|
-
const productOffers = yield repos.productOffer.search({
|
|
55
|
-
project: { id: { $eq: params.project.id } },
|
|
56
|
-
itemOffered: { id: { $eq: params.itemOffered.id } },
|
|
57
|
-
seller: { id: { $eq: sellerId } }
|
|
58
|
-
});
|
|
59
|
-
const hasValidOffer = productOffers.some((o) => {
|
|
60
|
-
var _a;
|
|
61
|
-
return ((_a = o.seller) === null || _a === void 0 ? void 0 : _a.id) === sellerId
|
|
62
|
-
&& o.validFrom !== undefined
|
|
63
|
-
&& moment(o.validFrom)
|
|
64
|
-
.isSameOrBefore(now)
|
|
65
|
-
&& o.validThrough !== undefined
|
|
66
|
-
&& moment(o.validThrough)
|
|
67
|
-
.isSameOrAfter(now);
|
|
68
|
-
});
|
|
69
|
-
if (!hasValidOffer) {
|
|
70
|
-
return { offers: [], product };
|
|
71
|
-
}
|
|
72
67
|
}
|
|
73
68
|
}
|
|
74
69
|
const offers = yield (0, searchProductOffers_1.searchProductOffers)({
|
|
@@ -282,7 +277,7 @@ function processVoidRegisterServiceTransaction(params) {
|
|
|
282
277
|
* 受け入れらたオファーの内容を検証
|
|
283
278
|
*/
|
|
284
279
|
function validateAcceptedOffers(params) {
|
|
285
|
-
return (
|
|
280
|
+
return (__) => __awaiter(this, void 0, void 0, function* () {
|
|
286
281
|
let acceptedOfferWithoutDetail = params.object;
|
|
287
282
|
if (!Array.isArray(acceptedOfferWithoutDetail)) {
|
|
288
283
|
acceptedOfferWithoutDetail = [acceptedOfferWithoutDetail];
|
|
@@ -297,22 +292,18 @@ function validateAcceptedOffers(params) {
|
|
|
297
292
|
typeOf: params.seller.typeOf
|
|
298
293
|
};
|
|
299
294
|
// 販売者を検証
|
|
300
|
-
//
|
|
301
|
-
//
|
|
302
|
-
//
|
|
295
|
+
// productsドキュメント参照のoffers検証は廃止(2025-09-22~)
|
|
296
|
+
// const productOffers = await repos.productOffer.search({
|
|
297
|
+
// project: { id: { $eq: params.product.project.id } },
|
|
298
|
+
// itemOffered: { id: { $eq: String(params.product.id) } },
|
|
299
|
+
// seller: { id: { $eq: params.seller.id } }
|
|
300
|
+
// });
|
|
301
|
+
// const hasValidOffer = productOffers.some((o) => {
|
|
302
|
+
// return o.seller?.id === params.seller.id;
|
|
303
|
+
// });
|
|
304
|
+
// if (!hasValidOffer) {
|
|
305
|
+
// throw new factory.errors.Argument('Product', 'Product has no valid offer');
|
|
303
306
|
// }
|
|
304
|
-
const productOffers = yield repos.productOffer.search({
|
|
305
|
-
project: { id: { $eq: params.product.project.id } },
|
|
306
|
-
itemOffered: { id: { $eq: String(params.product.id) } },
|
|
307
|
-
seller: { id: { $eq: params.seller.id } }
|
|
308
|
-
});
|
|
309
|
-
const hasValidOffer = productOffers.some((o) => {
|
|
310
|
-
var _a;
|
|
311
|
-
return ((_a = o.seller) === null || _a === void 0 ? void 0 : _a.id) === params.seller.id;
|
|
312
|
-
});
|
|
313
|
-
if (!hasValidOffer) {
|
|
314
|
-
throw new factory.errors.Argument('Product', 'Product has no valid offer');
|
|
315
|
-
}
|
|
316
307
|
// 利用可能なチケットオファーであれば受け入れる
|
|
317
308
|
return Promise.all(acceptedOfferWithoutDetail.map((offerWithoutDetail) => {
|
|
318
309
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
@@ -17,7 +17,6 @@ import type { MovieTheaterRepo } from '../../../repo/place/movieTheater';
|
|
|
17
17
|
import type { ScreeningRoomRepo } from '../../../repo/place/screeningRoom';
|
|
18
18
|
import type { ProductRepo } from '../../../repo/product';
|
|
19
19
|
import type { ProductModelRepo } from '../../../repo/productModel';
|
|
20
|
-
import type { ProductOfferRepo } from '../../../repo/productOffer';
|
|
21
20
|
import type { SettingRepo } from '../../../repo/setting';
|
|
22
21
|
import type { TaskRepo } from '../../../repo/task';
|
|
23
22
|
export declare function onResourceDeleted(params: factory.task.onResourceUpdated.IData): (repos: {
|
|
@@ -39,7 +38,6 @@ export declare function onResourceDeleted(params: factory.task.onResourceUpdated
|
|
|
39
38
|
screeningRoom: ScreeningRoomRepo;
|
|
40
39
|
product: ProductRepo;
|
|
41
40
|
productModel: ProductModelRepo;
|
|
42
|
-
productOffer: ProductOfferRepo;
|
|
43
41
|
setting: SettingRepo;
|
|
44
42
|
task: TaskRepo;
|
|
45
43
|
}) => Promise<void>;
|
|
@@ -252,11 +252,12 @@ function deleteResourcesBySeller(params) {
|
|
|
252
252
|
project: { id: params.project.id },
|
|
253
253
|
id: sellerId
|
|
254
254
|
});
|
|
255
|
+
// productsドキュメント参照のoffers検証は廃止(2025-09-22~)
|
|
255
256
|
// プロダクトオファー削除
|
|
256
|
-
const deleteProductOfferResult =
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
});
|
|
257
|
+
// const deleteProductOfferResult = await repos.productOffer.deleteManyBySellerId({
|
|
258
|
+
// project: { id: params.project.id },
|
|
259
|
+
// seller: { id: sellerId }
|
|
260
|
+
// });
|
|
260
261
|
// イベント削除
|
|
261
262
|
const deleteEventResult = yield repos.event.deleteManyEventByOrganizerId({
|
|
262
263
|
project: { id: params.project.id },
|
|
@@ -278,7 +279,8 @@ function deleteResourcesBySeller(params) {
|
|
|
278
279
|
parentOrganization: { id: sellerId }
|
|
279
280
|
});
|
|
280
281
|
deleteResult = {
|
|
281
|
-
deleteMemberResult, deletePaymentServiceProviderResult,
|
|
282
|
+
deleteMemberResult, deletePaymentServiceProviderResult,
|
|
283
|
+
// deleteProductOfferResult,
|
|
282
284
|
deleteEventResult, deleteEventSeriesResult, deleteScreeningRoomResult, deleteMovieTheaterResult
|
|
283
285
|
};
|
|
284
286
|
}
|
|
@@ -29,7 +29,6 @@ const movieTheater_1 = require("../../repo/place/movieTheater");
|
|
|
29
29
|
const screeningRoom_1 = require("../../repo/place/screeningRoom");
|
|
30
30
|
const product_1 = require("../../repo/product");
|
|
31
31
|
const productModel_1 = require("../../repo/productModel");
|
|
32
|
-
const productOffer_1 = require("../../repo/productOffer");
|
|
33
32
|
const setting_1 = require("../../repo/setting");
|
|
34
33
|
const task_1 = require("../../repo/task");
|
|
35
34
|
const onAggregateOfferUpdated_1 = require("./onResourceUpdated/onAggregateOfferUpdated");
|
|
@@ -61,7 +60,7 @@ function call(data) {
|
|
|
61
60
|
screeningRoom: new screeningRoom_1.ScreeningRoomRepo(connection),
|
|
62
61
|
product: new product_1.ProductRepo(connection),
|
|
63
62
|
productModel: new productModel_1.ProductModelRepo(connection),
|
|
64
|
-
productOffer: new
|
|
63
|
+
// productOffer: new ProductOfferRepo(connection),
|
|
65
64
|
setting: new setting_1.SettingRepo(connection),
|
|
66
65
|
task: new task_1.TaskRepo(connection)
|
|
67
66
|
});
|
package/package.json
CHANGED