@chevre/domain 24.0.0-alpha.82 → 24.0.0-alpha.83
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/repository.d.ts +0 -5
- package/lib/chevre/repository.js +2 -13
- package/package.json +2 -2
- package/lib/chevre/repo/comment.d.ts +0 -42
- package/lib/chevre/repo/comment.js +0 -121
- package/lib/chevre/repo/mongoose/schemas/comments.d.ts +0 -11
- package/lib/chevre/repo/mongoose/schemas/comments.js +0 -103
|
@@ -28,7 +28,6 @@ import type { AssetTransactionRepo } from './repo/assetTransaction';
|
|
|
28
28
|
import type { ReserveTransactionRepo } from './repo/assetTransaction/reserve';
|
|
29
29
|
import type { AuthorizationRepo } from './repo/authorization';
|
|
30
30
|
import type { CategoryCodeRepo } from './repo/categoryCode';
|
|
31
|
-
import type { CommentRepo } from './repo/comment';
|
|
32
31
|
import type { CreativeWorkRepo } from './repo/creativeWork';
|
|
33
32
|
import type { CredentialsRepo } from './repo/credentials';
|
|
34
33
|
import type { CustomerRepo } from './repo/customer';
|
|
@@ -212,10 +211,6 @@ export type Authorization = AuthorizationRepo;
|
|
|
212
211
|
export declare namespace Authorization {
|
|
213
212
|
function createInstance(...params: ConstructorParameters<typeof AuthorizationRepo>): Promise<AuthorizationRepo>;
|
|
214
213
|
}
|
|
215
|
-
export type Comment = CommentRepo;
|
|
216
|
-
export declare namespace Comment {
|
|
217
|
-
function createInstance(...params: ConstructorParameters<typeof CommentRepo>): Promise<CommentRepo>;
|
|
218
|
-
}
|
|
219
214
|
export type ConfirmationNumber = ConfirmationNumberRepo;
|
|
220
215
|
export declare namespace ConfirmationNumber {
|
|
221
216
|
function createInstance(...params: ConstructorParameters<typeof ConfirmationNumberRepo>): Promise<ConfirmationNumberRepo>;
|
package/lib/chevre/repository.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
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.EventOffer = exports.Event = exports.EmailMessage = exports.CustomerType = exports.Customer = exports.Credentials = exports.CreativeWork = exports.ConfirmationNumber = exports.
|
|
4
|
-
exports.WebSite = exports.rateLimit = exports.TransactionProcess = exports.TransactionNumber = exports.transaction = exports.Transaction = exports.Ticket = 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.ProductModel = exports.ProductHasOfferCatalog = exports.Product = exports.PriceSpecification = exports.PotentialAction = exports.place = exports.Permit = exports.Person = exports.PendingReservation =
|
|
3
|
+
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.EventOffer = exports.Event = exports.EmailMessage = exports.CustomerType = exports.Customer = exports.Credentials = exports.CreativeWork = exports.ConfirmationNumber = exports.Authorization = exports.CategoryCode = exports.assetTransaction = exports.AssetTransaction = exports.Aggregation = exports.AggregateReservation = exports.AggregateOrder = exports.AggregateOffer = exports.AggregateAction = exports.AdvanceBookingRequirement = exports.AdditionalProperty = exports.action = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = exports.AcceptedOffer = void 0;
|
|
4
|
+
exports.WebSite = exports.rateLimit = exports.TransactionProcess = exports.TransactionNumber = exports.transaction = exports.Transaction = exports.Ticket = 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.ProductModel = exports.ProductHasOfferCatalog = exports.Product = exports.PriceSpecification = exports.PotentialAction = exports.place = exports.Permit = exports.Person = exports.PendingReservation = void 0;
|
|
5
5
|
var AcceptedOffer;
|
|
6
6
|
(function (AcceptedOffer) {
|
|
7
7
|
let repo;
|
|
@@ -305,17 +305,6 @@ var Authorization;
|
|
|
305
305
|
}
|
|
306
306
|
Authorization.createInstance = createInstance;
|
|
307
307
|
})(Authorization || (exports.Authorization = Authorization = {}));
|
|
308
|
-
var Comment;
|
|
309
|
-
(function (Comment) {
|
|
310
|
-
let repo;
|
|
311
|
-
async function createInstance(...params) {
|
|
312
|
-
if (repo === undefined) {
|
|
313
|
-
repo = (await import('./repo/comment.js')).CommentRepo;
|
|
314
|
-
}
|
|
315
|
-
return new repo(...params);
|
|
316
|
-
}
|
|
317
|
-
Comment.createInstance = createInstance;
|
|
318
|
-
})(Comment || (exports.Comment = Comment = {}));
|
|
319
308
|
var ConfirmationNumber;
|
|
320
309
|
(function (ConfirmationNumber) {
|
|
321
310
|
let repo;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.600.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.600.0",
|
|
14
|
-
"@chevre/factory": "8.0.0-alpha.
|
|
14
|
+
"@chevre/factory": "8.0.0-alpha.5",
|
|
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",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"postversion": "git push origin --tags",
|
|
92
92
|
"prepublishOnly": "npm run clean && npm run build"
|
|
93
93
|
},
|
|
94
|
-
"version": "24.0.0-alpha.
|
|
94
|
+
"version": "24.0.0-alpha.83"
|
|
95
95
|
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { Connection } from 'mongoose';
|
|
2
|
-
import { factory } from '../factory';
|
|
3
|
-
/**
|
|
4
|
-
* コメントリポジトリ
|
|
5
|
-
*/
|
|
6
|
-
export declare class CommentRepo {
|
|
7
|
-
private readonly commentModel;
|
|
8
|
-
constructor(connection: Connection);
|
|
9
|
-
static CREATE_MONGO_CONDITIONS(params: factory.creativeWork.comment.ISearchConditions): any[];
|
|
10
|
-
/**
|
|
11
|
-
* 検索
|
|
12
|
-
*/
|
|
13
|
-
search(params: factory.creativeWork.comment.ISearchConditions & {
|
|
14
|
-
inclusion: string[];
|
|
15
|
-
exclusion: string[];
|
|
16
|
-
}): Promise<factory.creativeWork.comment.IComment[]>;
|
|
17
|
-
findById(params: {
|
|
18
|
-
id: string;
|
|
19
|
-
}): Promise<factory.creativeWork.comment.IComment>;
|
|
20
|
-
create(params: factory.creativeWork.comment.IComment): Promise<factory.creativeWork.comment.IComment>;
|
|
21
|
-
updateById(params: {
|
|
22
|
-
id?: string;
|
|
23
|
-
attributes: {
|
|
24
|
-
text: string;
|
|
25
|
-
};
|
|
26
|
-
}): Promise<void>;
|
|
27
|
-
/**
|
|
28
|
-
* 削除する
|
|
29
|
-
*/
|
|
30
|
-
deleteById(params: {
|
|
31
|
-
id: string;
|
|
32
|
-
}): Promise<void>;
|
|
33
|
-
getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, import("@chevre/factory/lib/chevre/creativeWork/comment").IComment, import("./mongoose/virtuals").IVirtuals, {}> & import("@chevre/factory/lib/chevre/creativeWork/comment").IComment & {
|
|
34
|
-
_id: import("mongoose").Types.ObjectId;
|
|
35
|
-
} & {
|
|
36
|
-
__v: number;
|
|
37
|
-
}, import("mongoose").QueryOptions<import("@chevre/factory/lib/chevre/creativeWork/comment").IComment>, (import("mongoose").Document<unknown, Record<string, never>, import("@chevre/factory/lib/chevre/creativeWork/comment").IComment, import("./mongoose/virtuals").IVirtuals, {}> & import("@chevre/factory/lib/chevre/creativeWork/comment").IComment & {
|
|
38
|
-
_id: import("mongoose").Types.ObjectId;
|
|
39
|
-
} & {
|
|
40
|
-
__v: number;
|
|
41
|
-
}) | null>;
|
|
42
|
-
}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CommentRepo = void 0;
|
|
4
|
-
const comments_1 = require("./mongoose/schemas/comments");
|
|
5
|
-
const factory_1 = require("../factory");
|
|
6
|
-
const settings_1 = require("../settings");
|
|
7
|
-
/**
|
|
8
|
-
* コメントリポジトリ
|
|
9
|
-
*/
|
|
10
|
-
class CommentRepo {
|
|
11
|
-
commentModel;
|
|
12
|
-
constructor(connection) {
|
|
13
|
-
this.commentModel = connection.model(comments_1.modelName, (0, comments_1.createSchema)());
|
|
14
|
-
}
|
|
15
|
-
static CREATE_MONGO_CONDITIONS(params) {
|
|
16
|
-
const andConditions = [];
|
|
17
|
-
const projectIdEq = params.project?.id?.$eq;
|
|
18
|
-
if (typeof projectIdEq === 'string') {
|
|
19
|
-
andConditions.push({ 'project.id': { $eq: projectIdEq } });
|
|
20
|
-
}
|
|
21
|
-
const aboutIdEq = params.about?.id?.$eq;
|
|
22
|
-
if (typeof aboutIdEq === 'string') {
|
|
23
|
-
andConditions.push({ 'about.id': { $exists: true, $eq: aboutIdEq } });
|
|
24
|
-
}
|
|
25
|
-
const aboutIdIn = params.about?.id?.$in;
|
|
26
|
-
if (Array.isArray(aboutIdIn)) {
|
|
27
|
-
andConditions.push({ 'about.id': { $exists: true, $in: aboutIdIn } });
|
|
28
|
-
}
|
|
29
|
-
return andConditions;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* 検索
|
|
33
|
-
*/
|
|
34
|
-
async search(params) {
|
|
35
|
-
let projection = {};
|
|
36
|
-
if (Array.isArray(params.inclusion) && params.inclusion.length > 0) {
|
|
37
|
-
params.inclusion.forEach((field) => {
|
|
38
|
-
projection[field] = 1;
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
projection = {
|
|
43
|
-
__v: 0,
|
|
44
|
-
createdAt: 0,
|
|
45
|
-
updatedAt: 0
|
|
46
|
-
};
|
|
47
|
-
if (Array.isArray(params.exclusion) && params.exclusion.length > 0) {
|
|
48
|
-
params.exclusion.forEach((field) => {
|
|
49
|
-
projection[field] = 0;
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
const conditions = CommentRepo.CREATE_MONGO_CONDITIONS(params);
|
|
54
|
-
const query = this.commentModel.find((conditions.length > 0) ? { $and: conditions } : {})
|
|
55
|
-
.select(projection);
|
|
56
|
-
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
57
|
-
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
58
|
-
query.limit(params.limit)
|
|
59
|
-
.skip(params.limit * (page - 1));
|
|
60
|
-
}
|
|
61
|
-
/* istanbul ignore else */
|
|
62
|
-
if (params.sort?.dateCreated !== undefined) {
|
|
63
|
-
query.sort({ dateCreated: params.sort.dateCreated });
|
|
64
|
-
}
|
|
65
|
-
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
66
|
-
.exec()
|
|
67
|
-
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
68
|
-
}
|
|
69
|
-
async findById(params) {
|
|
70
|
-
const doc = await this.commentModel.findOne({ _id: params.id }, {
|
|
71
|
-
__v: 0,
|
|
72
|
-
createdAt: 0,
|
|
73
|
-
updatedAt: 0
|
|
74
|
-
})
|
|
75
|
-
.exec();
|
|
76
|
-
if (doc === null) {
|
|
77
|
-
throw new factory_1.factory.errors.NotFound(this.commentModel.modelName);
|
|
78
|
-
}
|
|
79
|
-
return doc.toObject();
|
|
80
|
-
}
|
|
81
|
-
async create(params) {
|
|
82
|
-
const creatingDoc = {
|
|
83
|
-
about: params.about,
|
|
84
|
-
author: params.author,
|
|
85
|
-
dateCreated: new Date(),
|
|
86
|
-
project: params.project,
|
|
87
|
-
text: params.text,
|
|
88
|
-
typeOf: factory_1.factory.creativeWorkType.Comment,
|
|
89
|
-
...(Array.isArray(params.additionalProperty)) ? { additionalProperty: params.additionalProperty } : undefined,
|
|
90
|
-
...(Array.isArray(params.mentions)) ? { mentions: params.mentions } : undefined
|
|
91
|
-
};
|
|
92
|
-
const doc = await this.commentModel.create(creatingDoc);
|
|
93
|
-
return doc.toObject();
|
|
94
|
-
}
|
|
95
|
-
async updateById(params) {
|
|
96
|
-
const updateFields = {
|
|
97
|
-
$set: {
|
|
98
|
-
dateModified: new Date(),
|
|
99
|
-
...(typeof params.attributes.text === 'string') ? { text: params.attributes.text } : undefined
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
const doc = await this.commentModel.findOneAndUpdate({ _id: params.id }, updateFields, { upsert: false, new: true })
|
|
103
|
-
.exec();
|
|
104
|
-
if (doc === null) {
|
|
105
|
-
throw new factory_1.factory.errors.NotFound(this.commentModel.modelName);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* 削除する
|
|
110
|
-
*/
|
|
111
|
-
async deleteById(params) {
|
|
112
|
-
await this.commentModel.findOneAndDelete({ _id: { $eq: params.id } }, { projection: { _id: 1 } })
|
|
113
|
-
.exec();
|
|
114
|
-
}
|
|
115
|
-
getCursor(conditions, projection) {
|
|
116
|
-
return this.commentModel.find(conditions, projection)
|
|
117
|
-
.sort({ codeValue: factory_1.factory.sortType.Ascending })
|
|
118
|
-
.cursor();
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
exports.CommentRepo = CommentRepo;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
|
-
import { IVirtuals } from '../virtuals';
|
|
3
|
-
import { factory } from '../../../factory';
|
|
4
|
-
type IDocType = factory.creativeWork.comment.IComment;
|
|
5
|
-
type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
|
|
6
|
-
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
7
|
-
type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition, IDocType>;
|
|
8
|
-
declare const modelName = "Comment";
|
|
9
|
-
declare function createSchema(): ISchema;
|
|
10
|
-
declare const indexes: [d: IndexDefinition, o: IndexOptions][];
|
|
11
|
-
export { createSchema, IDocType, IModel, indexes, modelName };
|
|
@@ -1,103 +0,0 @@
|
|
|
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 = 'Comment';
|
|
9
|
-
exports.modelName = modelName;
|
|
10
|
-
const schemaDefinition = {
|
|
11
|
-
project: mongoose_1.SchemaTypes.Mixed,
|
|
12
|
-
typeOf: {
|
|
13
|
-
type: String,
|
|
14
|
-
required: true
|
|
15
|
-
},
|
|
16
|
-
about: mongoose_1.SchemaTypes.Mixed,
|
|
17
|
-
additionalProperty: [mongoose_1.SchemaTypes.Mixed],
|
|
18
|
-
author: mongoose_1.SchemaTypes.Mixed,
|
|
19
|
-
// commnet: Comment[]
|
|
20
|
-
commentCount: { type: Number, default: 0 },
|
|
21
|
-
dateCreated: Date,
|
|
22
|
-
dateModified: Date,
|
|
23
|
-
mentions: [mongoose_1.SchemaTypes.Mixed],
|
|
24
|
-
text: {
|
|
25
|
-
type: String,
|
|
26
|
-
required: true
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
const schemaOptions = {
|
|
30
|
-
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
31
|
-
autoCreate: false,
|
|
32
|
-
collection: 'comments',
|
|
33
|
-
id: true,
|
|
34
|
-
read: 'primary',
|
|
35
|
-
writeConcern: writeConcern_1.writeConcern,
|
|
36
|
-
strict: true,
|
|
37
|
-
strictQuery: false,
|
|
38
|
-
timestamps: false, // 2024-08-07~
|
|
39
|
-
versionKey: false, // 2024-08-07~
|
|
40
|
-
toJSON: {
|
|
41
|
-
getters: false,
|
|
42
|
-
virtuals: false,
|
|
43
|
-
minimize: false,
|
|
44
|
-
versionKey: false
|
|
45
|
-
},
|
|
46
|
-
toObject: {
|
|
47
|
-
getters: false,
|
|
48
|
-
virtuals: true,
|
|
49
|
-
minimize: false,
|
|
50
|
-
versionKey: false
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* コメントスキーマ
|
|
55
|
-
*/
|
|
56
|
-
let schema;
|
|
57
|
-
function createSchema() {
|
|
58
|
-
if (schema === undefined) {
|
|
59
|
-
schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
|
|
60
|
-
}
|
|
61
|
-
return schema;
|
|
62
|
-
}
|
|
63
|
-
const indexes = [
|
|
64
|
-
// [ // discontinue(2024-08-07~)
|
|
65
|
-
// { createdAt: 1 },
|
|
66
|
-
// { name: 'searchByCreatedAt' }
|
|
67
|
-
// ],
|
|
68
|
-
// [
|
|
69
|
-
// { updatedAt: 1 },
|
|
70
|
-
// { name: 'searchByUpdatedAt' }
|
|
71
|
-
// ],
|
|
72
|
-
[
|
|
73
|
-
{ dateCreated: 1 },
|
|
74
|
-
{
|
|
75
|
-
name: 'searchByDateCreated'
|
|
76
|
-
}
|
|
77
|
-
],
|
|
78
|
-
[
|
|
79
|
-
{ 'project.id': 1, dateCreated: 1 },
|
|
80
|
-
{
|
|
81
|
-
name: 'searchByProjectId'
|
|
82
|
-
}
|
|
83
|
-
],
|
|
84
|
-
[
|
|
85
|
-
{ 'about.id': 1, dateCreated: 1 },
|
|
86
|
-
{
|
|
87
|
-
name: 'searchByAboutId',
|
|
88
|
-
partialFilterExpression: {
|
|
89
|
-
'about.id': { $exists: true }
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
],
|
|
93
|
-
[
|
|
94
|
-
{ additionalProperty: 1, dateCreated: 1 },
|
|
95
|
-
{
|
|
96
|
-
name: 'searchByAdditionalProperty',
|
|
97
|
-
partialFilterExpression: {
|
|
98
|
-
additionalProperty: { $exists: true }
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
]
|
|
102
|
-
];
|
|
103
|
-
exports.indexes = indexes;
|