@chevre/domain 21.35.0-alpha.34 → 21.35.0-alpha.35
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.
|
@@ -49,7 +49,7 @@ export declare class MongoRepository {
|
|
|
49
49
|
id: string;
|
|
50
50
|
alternateName?: string;
|
|
51
51
|
logo?: string;
|
|
52
|
-
hasMerchantReturnPolicy?: Pick<factory.project.IHasMerchantReturnPolicy, 'sameAs'>;
|
|
52
|
+
hasMerchantReturnPolicy?: Pick<factory.project.IHasMerchantReturnPolicy, 'sameAs' | 'identifier'>;
|
|
53
53
|
name?: string;
|
|
54
54
|
settings?: {
|
|
55
55
|
sendEmailMessage?: factory.project.ISendEmailMessageSettings;
|
|
@@ -114,23 +114,26 @@ class MongoRepository {
|
|
|
114
114
|
findByIdAndIUpdate(params) {
|
|
115
115
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
116
116
|
return __awaiter(this, void 0, void 0, function* () {
|
|
117
|
+
let hasMerchantReturnPolicy;
|
|
118
|
+
if (typeof ((_a = params.hasMerchantReturnPolicy) === null || _a === void 0 ? void 0 : _a.sameAs) === 'string') {
|
|
119
|
+
hasMerchantReturnPolicy = Object.assign({ sameAs: params.hasMerchantReturnPolicy.sameAs, typeOf: 'MerchantReturnPolicy' }, (params.hasMerchantReturnPolicy.identifier === 'string')
|
|
120
|
+
? { identifier: params.hasMerchantReturnPolicy.identifier } : undefined);
|
|
121
|
+
}
|
|
117
122
|
yield this.projectModel.findOneAndUpdate({ _id: params.id }, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ updatedAt: new Date() }, (typeof params.alternateName === 'string' && params.alternateName.length > 0)
|
|
118
123
|
? { alternateName: params.alternateName }
|
|
119
|
-
: undefined), (typeof params.name === 'string' && params.name.length > 0) ? { name: params.name } : undefined), (typeof params.logo === 'string' && params.logo.length > 0) ? { logo: params.logo } : undefined), (typeof ((
|
|
124
|
+
: undefined), (typeof params.name === 'string' && params.name.length > 0) ? { name: params.name } : undefined), (typeof params.logo === 'string' && params.logo.length > 0) ? { logo: params.logo } : undefined), (typeof ((_d = (_c = (_b = params.settings) === null || _b === void 0 ? void 0 : _b.sendEmailMessage) === null || _c === void 0 ? void 0 : _c.sender) === null || _d === void 0 ? void 0 : _d.email) === 'string')
|
|
120
125
|
? {
|
|
121
126
|
'settings.sendEmailMessage': {
|
|
122
127
|
sender: { email: params.settings.sendEmailMessage.sender.email }
|
|
123
128
|
}
|
|
124
129
|
}
|
|
125
|
-
: undefined), (typeof ((
|
|
130
|
+
: undefined), (typeof ((_e = params.settings) === null || _e === void 0 ? void 0 : _e.sendgridApiKey) === 'string')
|
|
126
131
|
? { 'settings.sendgridApiKey': params.settings.sendgridApiKey }
|
|
127
|
-
: undefined), (Array.isArray((
|
|
128
|
-
? { 'settings.tokenIssuers': (
|
|
129
|
-
: undefined), (typeof ((
|
|
132
|
+
: undefined), (Array.isArray((_f = params.settings) === null || _f === void 0 ? void 0 : _f.tokenIssuers))
|
|
133
|
+
? { 'settings.tokenIssuers': (_g = params.settings) === null || _g === void 0 ? void 0 : _g.tokenIssuers }
|
|
134
|
+
: undefined), (typeof ((_h = params.subscription) === null || _h === void 0 ? void 0 : _h.useEventServiceAsProduct) === 'boolean')
|
|
130
135
|
? { 'subscription.useEventServiceAsProduct': params.subscription.useEventServiceAsProduct }
|
|
131
|
-
: undefined), (
|
|
132
|
-
? { 'hasMerchantReturnPolicy.sameAs': params.hasMerchantReturnPolicy.sameAs }
|
|
133
|
-
: undefined), { $unset: {
|
|
136
|
+
: undefined), (hasMerchantReturnPolicy !== undefined) ? { hasMerchantReturnPolicy } : undefined), { $unset: {
|
|
134
137
|
'settings.cognito': 1 // 廃止(2023-11-10~)
|
|
135
138
|
} }))
|
|
136
139
|
.exec();
|
|
@@ -26,6 +26,11 @@ import { AnyExpression, Connection, FilterQuery } from 'mongoose';
|
|
|
26
26
|
import * as factory from '../factory';
|
|
27
27
|
export type ISeller = Omit<factory.seller.ISeller, 'paymentAccepted'>;
|
|
28
28
|
export type ISavingSeller = Omit<factory.seller.ISeller, 'paymentAccepted'>;
|
|
29
|
+
export interface IUnset {
|
|
30
|
+
$unset?: {
|
|
31
|
+
[key: string]: 1;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
29
34
|
export type ISellerByAggregate = Pick<ISeller, 'additionalProperty' | 'branchCode' | 'hasMerchantReturnPolicy' | 'id' | 'name' | 'project' | 'telephone' | 'typeOf' | 'url'> & {
|
|
30
35
|
id: string;
|
|
31
36
|
};
|
|
@@ -57,7 +62,7 @@ export declare class MongoRepository {
|
|
|
57
62
|
*/
|
|
58
63
|
save(params: {
|
|
59
64
|
id?: string;
|
|
60
|
-
attributes: ISavingSeller;
|
|
65
|
+
attributes: ISavingSeller & IUnset;
|
|
61
66
|
}): Promise<ISavingSeller & {
|
|
62
67
|
id: string;
|
|
63
68
|
}>;
|
|
@@ -199,9 +199,15 @@ class MongoRepository {
|
|
|
199
199
|
// 上書き禁止属性を除外(2022-08-24~)
|
|
200
200
|
const _a = params.attributes, { id, branchCode, project, typeOf } = _a, updateFields = __rest(_a, ["id", "branchCode", "project", "typeOf"]);
|
|
201
201
|
const doc = yield this.organizationModel.findOneAndUpdate({
|
|
202
|
-
_id: params.id,
|
|
202
|
+
_id: { $eq: params.id },
|
|
203
203
|
'project.id': { $eq: project.id }
|
|
204
|
-
}, updateFields, {
|
|
204
|
+
}, updateFields, {
|
|
205
|
+
upsert: false,
|
|
206
|
+
new: true,
|
|
207
|
+
projection: {
|
|
208
|
+
paymentAccepted: 0 // 除外(2023-12-01~)
|
|
209
|
+
}
|
|
210
|
+
})
|
|
205
211
|
.exec();
|
|
206
212
|
if (doc === null) {
|
|
207
213
|
throw new factory.errors.NotFound(this.organizationModel.modelName);
|
package/package.json
CHANGED