@chevre/domain 23.0.0-alpha.9 → 23.0.0
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/example/src/chevre/assetTransaction/processReserve.ts +102 -40
- package/example/src/chevre/categoryCode/checkUniqueness.ts +69 -0
- package/example/src/chevre/event/checkEventAdditionalPropertyUniqueness.ts +108 -0
- package/example/src/chevre/event/migrateEventAdditionalProperty2identifier.ts +121 -0
- package/example/src/chevre/event/updateSellerMakesOffersByIdentifier.ts +106 -0
- package/example/src/chevre/offerCatalog/updateManyOfferCatalogsByIds.ts +49 -0
- package/example/src/chevre/paymentServices/findPaymentServices.ts +37 -0
- package/example/src/chevre/product/findHasOfferCatalog.ts +14 -10
- package/example/src/chevre/reIndex.ts +2 -3
- package/example/src/chevre/roles/{addAdminProductReadPermissionIfNotExists.ts → addAdminPaymentServiceReadPermissionIfNotExists.ts} +1 -1
- package/example/src/chevre/roles/addAdminProductHasOfferCatalogReadPermissionIfNotExists.ts +33 -0
- package/example/src/chevre/roles/addAdminSellerEventIfNotExists.ts +48 -0
- package/example/src/chevre/roles/removeConsolePermissionIfExists.ts +1 -1
- package/example/src/chevre/roles/removePermissionIfExists.ts +1 -6
- package/example/src/objectId.ts +12 -0
- package/example/src/signPayload.ts +12 -7
- package/lib/chevre/errorHandler.d.ts +6 -2
- package/lib/chevre/errorHandler.js +18 -2
- package/lib/chevre/repo/categoryCode.d.ts +26 -14
- package/lib/chevre/repo/categoryCode.js +53 -42
- package/lib/chevre/repo/event.d.ts +25 -11
- package/lib/chevre/repo/event.js +60 -35
- package/lib/chevre/repo/eventSellerMakesOffer.d.ts +24 -39
- package/lib/chevre/repo/eventSellerMakesOffer.js +88 -43
- package/lib/chevre/repo/issuer.js +9 -5
- package/lib/chevre/repo/mongoose/schemas/categoryCode.js +48 -42
- package/lib/chevre/repo/mongoose/schemas/movieTicketTypes.d.ts +10 -0
- package/lib/chevre/repo/mongoose/schemas/movieTicketTypes.js +107 -0
- package/lib/chevre/repo/mongoose/schemas/product.d.ts +4 -4
- package/lib/chevre/repo/mongoose/schemas/product.js +2 -2
- package/lib/chevre/repo/movieTicketType.d.ts +57 -0
- package/lib/chevre/repo/movieTicketType.js +253 -0
- package/lib/chevre/repo/offerCatalog.d.ts +17 -2
- package/lib/chevre/repo/offerCatalog.js +5 -2
- package/lib/chevre/repo/productHasOfferCatalog.d.ts +1 -0
- package/lib/chevre/repo/productHasOfferCatalog.js +5 -1
- package/lib/chevre/repository.d.ts +5 -0
- package/lib/chevre/repository.js +15 -2
- package/lib/chevre/service/assetTransaction/reserve/start.js +2 -2
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.d.ts +15 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.js +159 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateMemberTierIfExists.d.ts +16 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateMemberTierIfExists.js +184 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.d.ts +4 -1
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +25 -139
- package/lib/chevre/service/event.js +1 -1
- package/lib/chevre/service/offer/event/importFromCOA.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +3 -3
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +3 -3
- package/lib/chevre/service/offer/onEventChanged.js +26 -30
- package/lib/chevre/service/project.d.ts +3 -0
- package/lib/chevre/service/project.js +2 -1
- package/lib/chevre/service/task/onResourceUpdated/syncCategoryCode.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated.js +1 -1
- package/package.json +4 -4
- package/example/src/chevre/aggregateEventSellerMakesOffer.ts +0 -32
- package/example/src/chevre/event/migrateEventIdentifier4ttts.ts +0 -96
- package/example/src/chevre/searchCategoryCodesByAggregate.ts +0 -31
- package/example/src/chevre/searchOfferCatalogItems.ts +0 -59
- package/example/src/chevre/searchPaymentServices.ts +0 -32
|
@@ -0,0 +1,107 @@
|
|
|
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 writeConcern_1 = require("../writeConcern");
|
|
7
|
+
const settings_1 = require("../../../settings");
|
|
8
|
+
const modelName = 'MovieTicketType';
|
|
9
|
+
exports.modelName = modelName;
|
|
10
|
+
const schemaDefinition = {
|
|
11
|
+
project: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
12
|
+
typeOf: { type: String, required: true },
|
|
13
|
+
// additionalProperty: [SchemaTypes.Mixed],
|
|
14
|
+
color: String,
|
|
15
|
+
image: String,
|
|
16
|
+
codeValue: { type: String, required: true },
|
|
17
|
+
inCodeSet: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
18
|
+
name: mongoose_1.SchemaTypes.Mixed,
|
|
19
|
+
paymentMethod: { type: mongoose_1.SchemaTypes.Mixed, required: true }
|
|
20
|
+
};
|
|
21
|
+
const schemaOptions = {
|
|
22
|
+
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
23
|
+
autoCreate: false,
|
|
24
|
+
collection: 'movieTicketTypes',
|
|
25
|
+
id: true,
|
|
26
|
+
read: settings_1.MONGO_READ_PREFERENCE,
|
|
27
|
+
writeConcern: writeConcern_1.writeConcern,
|
|
28
|
+
strict: true,
|
|
29
|
+
strictQuery: false,
|
|
30
|
+
timestamps: false, // 2024-08-22~
|
|
31
|
+
versionKey: false, // 2024-08-22~
|
|
32
|
+
toJSON: {
|
|
33
|
+
getters: false,
|
|
34
|
+
virtuals: false,
|
|
35
|
+
minimize: false,
|
|
36
|
+
versionKey: false
|
|
37
|
+
},
|
|
38
|
+
toObject: {
|
|
39
|
+
getters: false,
|
|
40
|
+
virtuals: true,
|
|
41
|
+
minimize: false,
|
|
42
|
+
versionKey: false
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const indexes = [
|
|
46
|
+
[
|
|
47
|
+
{ codeValue: 1 },
|
|
48
|
+
{ name: 'codeValue' }
|
|
49
|
+
],
|
|
50
|
+
[
|
|
51
|
+
{ 'project.id': 1, codeValue: 1 },
|
|
52
|
+
{ name: 'projectId' }
|
|
53
|
+
],
|
|
54
|
+
[
|
|
55
|
+
{ 'paymentMethod.typeOf': 1, codeValue: 1 },
|
|
56
|
+
{ name: 'paymentMethodTypeOf' }
|
|
57
|
+
],
|
|
58
|
+
[
|
|
59
|
+
{ 'inCodeSet.identifier': 1, codeValue: 1 },
|
|
60
|
+
{ name: 'inCodeSetIdentifier' }
|
|
61
|
+
],
|
|
62
|
+
[
|
|
63
|
+
{
|
|
64
|
+
'project.id': 1,
|
|
65
|
+
'paymentMethod.typeOf': 1,
|
|
66
|
+
codeValue: 1
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
unique: true,
|
|
70
|
+
name: 'uniqueByCodeValueAndPaymentMethod'
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
[
|
|
74
|
+
{ 'name.ja': 1, codeValue: 1 },
|
|
75
|
+
{
|
|
76
|
+
name: 'nameJa',
|
|
77
|
+
partialFilterExpression: {
|
|
78
|
+
'name.ja': { $exists: true }
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
[
|
|
83
|
+
{ 'name.en': 1, codeValue: 1 },
|
|
84
|
+
{
|
|
85
|
+
name: 'nameEn',
|
|
86
|
+
partialFilterExpression: {
|
|
87
|
+
'name.en': { $exists: true }
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
];
|
|
92
|
+
exports.indexes = indexes;
|
|
93
|
+
/**
|
|
94
|
+
* 決済カード区分スキーマ
|
|
95
|
+
*/
|
|
96
|
+
let schema;
|
|
97
|
+
function createSchema() {
|
|
98
|
+
if (schema === undefined) {
|
|
99
|
+
schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
|
|
100
|
+
if (settings_1.MONGO_AUTO_INDEX) {
|
|
101
|
+
indexes.forEach((indexParams) => {
|
|
102
|
+
schema === null || schema === void 0 ? void 0 : schema.index(...indexParams);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return schema;
|
|
107
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
2
|
import * as factory from '../../../factory';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
offers?:
|
|
3
|
+
type IDocTypeAsProduct = Omit<factory.product.IProduct, 'id'>;
|
|
4
|
+
interface IDocTypeAsProductOffer {
|
|
5
|
+
offers?: never;
|
|
6
6
|
}
|
|
7
7
|
type IDocType = IDocTypeAsProduct & IDocTypeAsProductOffer;
|
|
8
8
|
type IModel = Model<IDocType>;
|
|
@@ -11,4 +11,4 @@ type ISchema = Schema<IDocType, IModel, {}, {}, {}, {}, ISchemaDefinition, IDocT
|
|
|
11
11
|
declare const modelName = "Product";
|
|
12
12
|
declare const indexes: [d: IndexDefinition, o: IndexOptions][];
|
|
13
13
|
declare function createSchema(): ISchema;
|
|
14
|
-
export { createSchema, IModel, indexes, modelName };
|
|
14
|
+
export { createSchema, IDocTypeAsProduct, IDocTypeAsProductOffer, IModel, indexes, modelName };
|
|
@@ -8,14 +8,14 @@ const settings_1 = require("../../../settings");
|
|
|
8
8
|
const modelName = 'Product';
|
|
9
9
|
exports.modelName = modelName;
|
|
10
10
|
const schemaDefinition = {
|
|
11
|
-
project: mongoose_1.SchemaTypes.Mixed,
|
|
11
|
+
project: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
12
12
|
typeOf: { type: String, required: true },
|
|
13
13
|
additionalProperty: [mongoose_1.SchemaTypes.Mixed],
|
|
14
14
|
availableChannel: mongoose_1.SchemaTypes.Mixed,
|
|
15
15
|
description: mongoose_1.SchemaTypes.Mixed,
|
|
16
16
|
hasOfferCatalog: mongoose_1.SchemaTypes.Mixed,
|
|
17
17
|
name: mongoose_1.SchemaTypes.Mixed,
|
|
18
|
-
offers: [
|
|
18
|
+
// offers: [SchemaTypes.Mixed], // discontinue(2025-10-15~)
|
|
19
19
|
productID: { type: String, required: true },
|
|
20
20
|
// provider: [SchemaTypes.Mixed], // 廃止(2024-04-12~)
|
|
21
21
|
serviceOutput: mongoose_1.SchemaTypes.Mixed,
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { AnyExpression, Connection, FilterQuery } from 'mongoose';
|
|
2
|
+
import { IDocType } from './mongoose/schemas/movieTicketTypes';
|
|
3
|
+
import * as factory from '../factory';
|
|
4
|
+
type IUnset = {
|
|
5
|
+
[key in keyof Pick<IDocType, 'color' | 'image'>]?: 1;
|
|
6
|
+
};
|
|
7
|
+
type IKeyOfProjection = keyof IDocType;
|
|
8
|
+
/**
|
|
9
|
+
* 決済カード区分リポジトリ
|
|
10
|
+
*/
|
|
11
|
+
export declare class MovieTicketTypeRepo {
|
|
12
|
+
private readonly categoryCodeModel;
|
|
13
|
+
constructor(connection: Connection);
|
|
14
|
+
static CREATE_MONGO_CONDITIONS(params: factory.movieTicketType.ISearchConditions): FilterQuery<IDocType>[];
|
|
15
|
+
static CREATE_AGGREGATE_PROJECTION(inclusion: IKeyOfProjection[]): {
|
|
16
|
+
[field: string]: AnyExpression;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* 決済カード区分検索
|
|
20
|
+
*/
|
|
21
|
+
projectMovieTicketTypeFields(params: Omit<factory.movieTicketType.ISearchConditions, 'inCodeSet'> & {
|
|
22
|
+
inCodeSet?: {
|
|
23
|
+
identifier?: {
|
|
24
|
+
$eq?: factory.movieTicketType.CategorySetIdentifier.MovieTicketType;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
/**
|
|
29
|
+
* 空の場合無効
|
|
30
|
+
*/
|
|
31
|
+
inclusion: IKeyOfProjection[]): Promise<(IDocType & {
|
|
32
|
+
id: string;
|
|
33
|
+
})[]>;
|
|
34
|
+
saveMovieTicketType(params: {
|
|
35
|
+
id?: string;
|
|
36
|
+
attributes: IDocType & {
|
|
37
|
+
$unset?: IUnset;
|
|
38
|
+
};
|
|
39
|
+
}): Promise<{
|
|
40
|
+
id: string;
|
|
41
|
+
}>;
|
|
42
|
+
/**
|
|
43
|
+
* 削除する
|
|
44
|
+
*/
|
|
45
|
+
deleteMovieTicketTypeById(params: {
|
|
46
|
+
id: string;
|
|
47
|
+
}): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* プロジェクト指定で削除する
|
|
50
|
+
*/
|
|
51
|
+
deleteMovieTicketTypesByProject(params: {
|
|
52
|
+
project: {
|
|
53
|
+
id: string;
|
|
54
|
+
};
|
|
55
|
+
}): Promise<void>;
|
|
56
|
+
}
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,253 @@
|
|
|
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
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.MovieTicketTypeRepo = void 0;
|
|
24
|
+
// tslint:disable-next-line:no-implicit-dependencies
|
|
25
|
+
const mongoose_1 = require("mongoose");
|
|
26
|
+
// import { createSchema, modelName } from './mongoose/schemas/categoryCode';
|
|
27
|
+
const movieTicketTypes_1 = require("./mongoose/schemas/movieTicketTypes");
|
|
28
|
+
const factory = require("../factory");
|
|
29
|
+
const settings_1 = require("../settings");
|
|
30
|
+
const AVAILABLE_PROJECT_FIELDS = [
|
|
31
|
+
'codeValue', 'color', 'image', 'inCodeSet', 'name', 'paymentMethod', 'project', 'typeOf'
|
|
32
|
+
];
|
|
33
|
+
/**
|
|
34
|
+
* 決済カード区分リポジトリ
|
|
35
|
+
*/
|
|
36
|
+
class MovieTicketTypeRepo {
|
|
37
|
+
constructor(connection) {
|
|
38
|
+
this.categoryCodeModel = connection.model(movieTicketTypes_1.modelName, (0, movieTicketTypes_1.createSchema)());
|
|
39
|
+
}
|
|
40
|
+
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
41
|
+
static CREATE_MONGO_CONDITIONS(params) {
|
|
42
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
43
|
+
const andConditions = [
|
|
44
|
+
{
|
|
45
|
+
'inCodeSet.identifier': {
|
|
46
|
+
$eq: factory.movieTicketType.CategorySetIdentifier.MovieTicketType
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
];
|
|
50
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
51
|
+
/* istanbul ignore else */
|
|
52
|
+
if (params.project !== undefined && params.project !== null) {
|
|
53
|
+
if (params.project.id !== undefined && params.project.id !== null) {
|
|
54
|
+
if (typeof params.project.id.$eq === 'string') {
|
|
55
|
+
andConditions.push({
|
|
56
|
+
'project.id': {
|
|
57
|
+
$eq: params.project.id.$eq
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const idEq = (_a = params.id) === null || _a === void 0 ? void 0 : _a.$eq;
|
|
64
|
+
if (typeof idEq === 'string') {
|
|
65
|
+
// andConditions.push({ _id: { $eq: idEq } });
|
|
66
|
+
andConditions.push({ _id: { $eq: new mongoose_1.Types.ObjectId(idEq) } });
|
|
67
|
+
}
|
|
68
|
+
const idIn = (_b = params.id) === null || _b === void 0 ? void 0 : _b.$in;
|
|
69
|
+
if (Array.isArray(idIn)) {
|
|
70
|
+
// andConditions.push({ _id: { $in: idIn } });
|
|
71
|
+
andConditions.push({ _id: { $in: idIn.map((id) => new mongoose_1.Types.ObjectId(id)) } });
|
|
72
|
+
}
|
|
73
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
74
|
+
/* istanbul ignore else */
|
|
75
|
+
if (params.name !== undefined && params.name !== null) {
|
|
76
|
+
if (typeof params.name.$regex === 'string' && params.name.$regex.length > 0) {
|
|
77
|
+
andConditions.push({
|
|
78
|
+
$or: [
|
|
79
|
+
{
|
|
80
|
+
'name.ja': {
|
|
81
|
+
$exists: true,
|
|
82
|
+
$regex: new RegExp(params.name.$regex)
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
'name.en': {
|
|
87
|
+
$exists: true,
|
|
88
|
+
$regex: new RegExp(params.name.$regex)
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const codeValueEq = (_c = params.codeValue) === null || _c === void 0 ? void 0 : _c.$eq;
|
|
96
|
+
if (typeof codeValueEq === 'string') {
|
|
97
|
+
andConditions.push({ codeValue: { $eq: codeValueEq } });
|
|
98
|
+
}
|
|
99
|
+
const codeValueIn = (_d = params.codeValue) === null || _d === void 0 ? void 0 : _d.$in;
|
|
100
|
+
if (Array.isArray(codeValueIn)) {
|
|
101
|
+
andConditions.push({ codeValue: { $in: codeValueIn } });
|
|
102
|
+
}
|
|
103
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
104
|
+
/* istanbul ignore else */
|
|
105
|
+
if (params.inCodeSet !== undefined && params.inCodeSet !== null) {
|
|
106
|
+
if (params.inCodeSet.identifier !== undefined && params.inCodeSet.identifier !== null) {
|
|
107
|
+
if (typeof params.inCodeSet.identifier.$eq === 'string') {
|
|
108
|
+
andConditions.push({
|
|
109
|
+
'inCodeSet.identifier': {
|
|
110
|
+
$eq: params.inCodeSet.identifier.$eq
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const inCodeSetIdentifierIn = (_f = (_e = params.inCodeSet) === null || _e === void 0 ? void 0 : _e.identifier) === null || _f === void 0 ? void 0 : _f.$in;
|
|
117
|
+
if (Array.isArray(inCodeSetIdentifierIn)) {
|
|
118
|
+
andConditions.push({
|
|
119
|
+
'inCodeSet.identifier': {
|
|
120
|
+
$in: inCodeSetIdentifierIn
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
const paymentMethodTypeOfEq = (_h = (_g = params.paymentMethod) === null || _g === void 0 ? void 0 : _g.typeOf) === null || _h === void 0 ? void 0 : _h.$eq;
|
|
125
|
+
if (typeof paymentMethodTypeOfEq === 'string') {
|
|
126
|
+
andConditions.push({
|
|
127
|
+
'paymentMethod.typeOf': {
|
|
128
|
+
$exists: true,
|
|
129
|
+
$eq: paymentMethodTypeOfEq
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
const paymentMethodTypeOfIn = (_k = (_j = params.paymentMethod) === null || _j === void 0 ? void 0 : _j.typeOf) === null || _k === void 0 ? void 0 : _k.$in;
|
|
134
|
+
if (Array.isArray(paymentMethodTypeOfIn)) {
|
|
135
|
+
andConditions.push({
|
|
136
|
+
'paymentMethod.typeOf': {
|
|
137
|
+
$exists: true,
|
|
138
|
+
$in: paymentMethodTypeOfIn
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
return andConditions;
|
|
143
|
+
}
|
|
144
|
+
static CREATE_AGGREGATE_PROJECTION(inclusion) {
|
|
145
|
+
let projectStage = {
|
|
146
|
+
_id: 0,
|
|
147
|
+
id: { $toString: '$_id' },
|
|
148
|
+
project: '$project',
|
|
149
|
+
typeOf: '$typeOf',
|
|
150
|
+
color: '$color',
|
|
151
|
+
image: '$image',
|
|
152
|
+
codeValue: '$codeValue',
|
|
153
|
+
inCodeSet: '$inCodeSet',
|
|
154
|
+
name: '$name',
|
|
155
|
+
paymentMethod: '$paymentMethod'
|
|
156
|
+
};
|
|
157
|
+
if (inclusion.length > 0) {
|
|
158
|
+
projectStage = { _id: 0 };
|
|
159
|
+
inclusion.forEach((field) => {
|
|
160
|
+
switch (field) {
|
|
161
|
+
// case '_id':
|
|
162
|
+
case 'id':
|
|
163
|
+
projectStage.id = { $toString: '$_id' };
|
|
164
|
+
break;
|
|
165
|
+
default:
|
|
166
|
+
projectStage[field] = `$${field}`;
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
return projectStage;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* 決済カード区分検索
|
|
174
|
+
*/
|
|
175
|
+
projectMovieTicketTypeFields(params,
|
|
176
|
+
/**
|
|
177
|
+
* 空の場合無効
|
|
178
|
+
*/
|
|
179
|
+
inclusion) {
|
|
180
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
181
|
+
const conditions = MovieTicketTypeRepo.CREATE_MONGO_CONDITIONS(params);
|
|
182
|
+
let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
|
|
183
|
+
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
184
|
+
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
185
|
+
}
|
|
186
|
+
const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
|
|
187
|
+
const query = this.categoryCodeModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
|
|
188
|
+
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
189
|
+
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
190
|
+
query.limit(params.limit)
|
|
191
|
+
.skip(params.limit * (page - 1));
|
|
192
|
+
}
|
|
193
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
194
|
+
/* istanbul ignore else */
|
|
195
|
+
if (params.sort !== undefined) {
|
|
196
|
+
query.sort(params.sort);
|
|
197
|
+
}
|
|
198
|
+
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
199
|
+
.lean() // 2024-08-19~
|
|
200
|
+
.exec();
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
saveMovieTicketType(params) {
|
|
204
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
205
|
+
let savedId;
|
|
206
|
+
// let doc: HydratedDocument<{ _id: Types.ObjectId }> | null;
|
|
207
|
+
if (typeof params.id !== 'string') {
|
|
208
|
+
const _a = params.attributes, { id, $unset } = _a, creatingDoc = __rest(_a, ["id", "$unset"]);
|
|
209
|
+
const createResult = yield this.categoryCodeModel.create(creatingDoc);
|
|
210
|
+
// doc = createResult;
|
|
211
|
+
if (typeof createResult.id !== 'string') {
|
|
212
|
+
throw new factory.errors.Internal(`failed in creating ${creatingDoc.typeOf} unexpectedly`);
|
|
213
|
+
}
|
|
214
|
+
savedId = createResult.id;
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
// 上書き禁止属性を除外(2022-08-24~)
|
|
218
|
+
const _b = params.attributes, { id, codeValue, inCodeSet, project, typeOf, $unset } = _b, updateFields = __rest(_b, ["id", "codeValue", "inCodeSet", "project", "typeOf", "$unset"]);
|
|
219
|
+
const doc = yield this.categoryCodeModel.findOneAndUpdate({ _id: { $eq: params.id } }, Object.assign({ $set: updateFields }, ($unset !== undefined) ? { $unset } : undefined), { upsert: false, new: true, projection: { _id: 1 } })
|
|
220
|
+
.exec();
|
|
221
|
+
if (doc === null) {
|
|
222
|
+
throw new factory.errors.NotFound(this.categoryCodeModel.modelName);
|
|
223
|
+
}
|
|
224
|
+
savedId = params.id;
|
|
225
|
+
}
|
|
226
|
+
// if (doc === null) {
|
|
227
|
+
// throw new factory.errors.NotFound(this.categoryCodeModel.modelName);
|
|
228
|
+
// }
|
|
229
|
+
return { id: savedId };
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* 削除する
|
|
234
|
+
*/
|
|
235
|
+
deleteMovieTicketTypeById(params) {
|
|
236
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
237
|
+
yield this.categoryCodeModel.findOneAndDelete({ _id: { $eq: params.id } }, { projection: { _id: 1 } })
|
|
238
|
+
.exec();
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* プロジェクト指定で削除する
|
|
243
|
+
*/
|
|
244
|
+
deleteMovieTicketTypesByProject(params) {
|
|
245
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
246
|
+
yield this.categoryCodeModel.deleteMany({
|
|
247
|
+
'project.id': { $eq: params.project.id }
|
|
248
|
+
})
|
|
249
|
+
.exec();
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
exports.MovieTicketTypeRepo = MovieTicketTypeRepo;
|
|
@@ -48,13 +48,28 @@ export declare class OfferCatalogRepo {
|
|
|
48
48
|
id: string;
|
|
49
49
|
dateSynced: Date;
|
|
50
50
|
}): Promise<void>;
|
|
51
|
-
|
|
51
|
+
/**
|
|
52
|
+
* オファーカタログIDリストからitemListElementをまとめて編集する
|
|
53
|
+
*/
|
|
54
|
+
updateManyOfferCatalogsByIds(params: {
|
|
52
55
|
id: {
|
|
53
56
|
$in: string[];
|
|
54
57
|
};
|
|
58
|
+
itemOffered: {
|
|
59
|
+
typeOf: {
|
|
60
|
+
$eq: factory.product.ProductType;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
55
63
|
$push: {
|
|
56
64
|
itemListElement: {
|
|
57
|
-
|
|
65
|
+
/**
|
|
66
|
+
* ひとまず要素がOfferのみに対応
|
|
67
|
+
*/
|
|
68
|
+
$each: factory.offerCatalog.IItemListElementAsAggregateOffer[];
|
|
69
|
+
/**
|
|
70
|
+
* カタログ内最大要素数
|
|
71
|
+
* 指定した数でsliceされる
|
|
72
|
+
*/
|
|
58
73
|
$slice: number;
|
|
59
74
|
};
|
|
60
75
|
};
|
|
@@ -252,13 +252,16 @@ class OfferCatalogRepo {
|
|
|
252
252
|
.exec();
|
|
253
253
|
});
|
|
254
254
|
}
|
|
255
|
-
|
|
255
|
+
/**
|
|
256
|
+
* オファーカタログIDリストからitemListElementをまとめて編集する
|
|
257
|
+
*/
|
|
258
|
+
updateManyOfferCatalogsByIds(params) {
|
|
256
259
|
return __awaiter(this, void 0, void 0, function* () {
|
|
257
260
|
if (!Array.isArray(params.id.$in) || params.id.$in.length === 0) {
|
|
258
261
|
return;
|
|
259
262
|
}
|
|
260
263
|
const pushItemListElementIds = params.$push.itemListElement.$each.map((element) => element.id);
|
|
261
|
-
yield this.offerCatalogModel.updateMany(Object.assign({ _id: { $in: params.id.$in } }, (pushItemListElementIds.length > 0)
|
|
264
|
+
yield this.offerCatalogModel.updateMany(Object.assign({ _id: { $in: params.id.$in }, 'itemOffered.typeOf': { $exists: true, $eq: params.itemOffered.typeOf.$eq } }, (pushItemListElementIds.length > 0)
|
|
262
265
|
// itemListElementのユニークネスを保証する
|
|
263
266
|
? {
|
|
264
267
|
'itemListElement.id': {
|
|
@@ -23,7 +23,7 @@ class ProductHasOfferCatalogRepo {
|
|
|
23
23
|
}
|
|
24
24
|
findOfferCatalogs(params) {
|
|
25
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
var _a, _b, _c, _d;
|
|
26
|
+
var _a, _b, _c, _d, _e, _f;
|
|
27
27
|
const matchStages = [];
|
|
28
28
|
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
29
29
|
if (typeof projectIdEq === 'string') {
|
|
@@ -33,6 +33,10 @@ class ProductHasOfferCatalogRepo {
|
|
|
33
33
|
if (typeof productIdEq === 'string') {
|
|
34
34
|
matchStages.push({ $match: { _id: { $eq: new mongoose_1.Types.ObjectId(productIdEq) } } });
|
|
35
35
|
}
|
|
36
|
+
const productIdIn = (_f = (_e = params.product) === null || _e === void 0 ? void 0 : _e.id) === null || _f === void 0 ? void 0 : _f.$in;
|
|
37
|
+
if (Array.isArray(productIdIn)) {
|
|
38
|
+
matchStages.push({ $match: { _id: { $in: productIdIn.map((productId) => new mongoose_1.Types.ObjectId(productId)) } } });
|
|
39
|
+
}
|
|
36
40
|
const aggregate = this.productModel.aggregate([
|
|
37
41
|
{
|
|
38
42
|
$unwind: {
|
|
@@ -32,6 +32,7 @@ import type { MemberRepo } from './repo/member';
|
|
|
32
32
|
import type { MemberProgramRepo } from './repo/memberProgram';
|
|
33
33
|
import type { MerchantReturnPolicyRepo } from './repo/merchantReturnPolicy';
|
|
34
34
|
import type { MessageRepo } from './repo/message';
|
|
35
|
+
import type { MovieTicketTypeRepo } from './repo/movieTicketType';
|
|
35
36
|
import type { NoteRepo } from './repo/note';
|
|
36
37
|
import type { NoteAboutOrderRepo } from './repo/noteAboutOrder';
|
|
37
38
|
import type { OfferRepo } from './repo/offer/unitPriceInCatalog';
|
|
@@ -216,6 +217,10 @@ export type Message = MessageRepo;
|
|
|
216
217
|
export declare namespace Message {
|
|
217
218
|
function createInstance(...params: ConstructorParameters<typeof MessageRepo>): Promise<MessageRepo>;
|
|
218
219
|
}
|
|
220
|
+
export type MovieTicketType = MovieTicketTypeRepo;
|
|
221
|
+
export declare namespace MovieTicketType {
|
|
222
|
+
function createInstance(...params: ConstructorParameters<typeof MovieTicketTypeRepo>): Promise<MovieTicketTypeRepo>;
|
|
223
|
+
}
|
|
219
224
|
export type Note = NoteRepo;
|
|
220
225
|
export declare namespace Note {
|
|
221
226
|
function createInstance(...params: ConstructorParameters<typeof NoteRepo>): Promise<NoteRepo>;
|
package/lib/chevre/repository.js
CHANGED
|
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
13
|
-
exports.WebSite = exports.rateLimit = exports.Trip = exports.TransactionProcess = exports.TransactionNumber = exports.Transaction = exports.Ticket = exports.Telemetry = exports.Task = exports.StockHolder = exports.setting = exports.Setting = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.ServiceAvailableHour = exports.SellerReturnPolicy = exports.SellerPaymentAccepted = exports.SellerMakesOffer = exports.Seller = exports.Schedule = exports.Role = exports.ReserveInterface = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductOffer = exports.ProductModel = exports.ProductHasOfferCatalog = exports.Product = exports.PriceSpecification = exports.PotentialAction = exports.place = void 0;
|
|
12
|
+
exports.Person = exports.paymentMethod = exports.PendingReservation = exports.PaymentServiceProvider = exports.PaymentServiceChannel = exports.PaymentService = exports.Passport = exports.OwnershipInfo = exports.OrderNumber = exports.OrderInTransaction = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.NoteAboutOrder = exports.Note = exports.MovieTicketType = exports.Message = exports.MerchantReturnPolicy = exports.MemberProgram = exports.Member = exports.Issuer = exports.IdentityProvider = exports.Identity = exports.EventSeries = exports.EventSellerMakesOffer = exports.Event = exports.EmailMessage = exports.CustomerType = exports.Customer = exports.Credentials = exports.CreativeWork = exports.ConfirmationNumber = exports.Comment = exports.Authorization = exports.CategoryCode = exports.AssetTransaction = exports.Aggregation = exports.AggregateReservation = exports.AggregateOrder = exports.AggregateOffer = exports.AdvanceBookingRequirement = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = exports.AcceptedOffer = void 0;
|
|
13
|
+
exports.WebSite = exports.rateLimit = exports.Trip = exports.TransactionProcess = exports.TransactionNumber = exports.Transaction = exports.Ticket = exports.Telemetry = exports.Task = exports.StockHolder = exports.setting = exports.Setting = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.ServiceAvailableHour = exports.SellerReturnPolicy = exports.SellerPaymentAccepted = exports.SellerMakesOffer = exports.Seller = exports.Schedule = exports.Role = exports.ReserveInterface = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductOffer = exports.ProductModel = exports.ProductHasOfferCatalog = exports.Product = exports.PriceSpecification = exports.PotentialAction = exports.place = exports.Permit = void 0;
|
|
14
14
|
var AcceptedOffer;
|
|
15
15
|
(function (AcceptedOffer) {
|
|
16
16
|
let repo;
|
|
@@ -427,6 +427,19 @@ var Message;
|
|
|
427
427
|
}
|
|
428
428
|
Message.createInstance = createInstance;
|
|
429
429
|
})(Message || (exports.Message = Message = {}));
|
|
430
|
+
var MovieTicketType;
|
|
431
|
+
(function (MovieTicketType) {
|
|
432
|
+
let repo;
|
|
433
|
+
function createInstance(...params) {
|
|
434
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
435
|
+
if (repo === undefined) {
|
|
436
|
+
repo = (yield Promise.resolve().then(() => require('./repo/movieTicketType'))).MovieTicketTypeRepo;
|
|
437
|
+
}
|
|
438
|
+
return new repo(...params);
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
MovieTicketType.createInstance = createInstance;
|
|
442
|
+
})(MovieTicketType || (exports.MovieTicketType = MovieTicketType = {}));
|
|
430
443
|
var Note;
|
|
431
444
|
(function (Note) {
|
|
432
445
|
let repo;
|
|
@@ -100,9 +100,9 @@ function fixEvent(params) {
|
|
|
100
100
|
// additionalProperty, // discontinue(2024-07-20~)
|
|
101
101
|
'name', 'doorTime', 'endDate', 'eventStatus',
|
|
102
102
|
'location', 'startDate', 'superEvent',
|
|
103
|
-
'offers', 'maximumPhysicalAttendeeCapacity'
|
|
103
|
+
'offers', 'maximumPhysicalAttendeeCapacity',
|
|
104
|
+
'identifier' // support identifier(2025-10-24~)
|
|
104
105
|
// 'coaInfo', // discontinue(2024-07-24~)
|
|
105
|
-
// 'identifier' // discontinue(2024-07-24~)
|
|
106
106
|
]);
|
|
107
107
|
const offeredThroughIdentifier = (_b = event.offers.offeredThrough) === null || _b === void 0 ? void 0 : _b.identifier;
|
|
108
108
|
if (offeredThroughIdentifier === factory.service.webAPI.Identifier.COA) {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as factory from '../../../../factory';
|
|
2
|
+
import { IMinimizedIndividualEvent } from '../../../../factory/event';
|
|
3
|
+
import type { IssuerRepo } from '../../../../repo/issuer';
|
|
4
|
+
/**
|
|
5
|
+
* オファートークン検証(2025-10-21~)
|
|
6
|
+
*/
|
|
7
|
+
declare function validateIssuedOfferIfExists(params: {
|
|
8
|
+
event: Pick<IMinimizedIndividualEvent, 'offers' | 'id' | 'project' | 'identifier'>;
|
|
9
|
+
now: Date;
|
|
10
|
+
object: factory.assetTransaction.reserve.IObjectWithoutDetail;
|
|
11
|
+
makesOfferOnApplication: factory.event.screeningEvent.ISellerMakesOffer;
|
|
12
|
+
}): (repos: {
|
|
13
|
+
issuer: IssuerRepo;
|
|
14
|
+
}) => Promise<void>;
|
|
15
|
+
export { validateIssuedOfferIfExists };
|