@7365admin1/core 3.32.2-staging.28 → 3.32.2-staging.29
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/dist/index.js +323 -272
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +323 -272
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -67325,7 +67325,61 @@ function MPost(value) {
|
|
|
67325
67325
|
|
|
67326
67326
|
// src/repositories/post-preloved.repo.ts
|
|
67327
67327
|
var import_node_server_utils237 = require("@7365admin1/node-server-utils");
|
|
67328
|
+
var import_mongodb139 = require("mongodb");
|
|
67329
|
+
|
|
67330
|
+
// src/models/bid-preloved.model.ts
|
|
67331
|
+
var import_joi134 = __toESM(require("joi"));
|
|
67328
67332
|
var import_mongodb138 = require("mongodb");
|
|
67333
|
+
var BidType = /* @__PURE__ */ ((BidType2) => {
|
|
67334
|
+
BidType2["BID"] = "bid";
|
|
67335
|
+
BidType2["RESERVE"] = "reserve";
|
|
67336
|
+
return BidType2;
|
|
67337
|
+
})(BidType || {});
|
|
67338
|
+
var BidStatus = /* @__PURE__ */ ((BidStatus3) => {
|
|
67339
|
+
BidStatus3["PENDING"] = "pending";
|
|
67340
|
+
BidStatus3["SOLD"] = "sold";
|
|
67341
|
+
BidStatus3["RESERVED"] = "reserved";
|
|
67342
|
+
BidStatus3["CANCELLED"] = "cancelled";
|
|
67343
|
+
return BidStatus3;
|
|
67344
|
+
})(BidStatus || {});
|
|
67345
|
+
var schemaBidPreloved = import_joi134.default.object({
|
|
67346
|
+
type: import_joi134.default.string().valid(...Object.values(BidType)).required(),
|
|
67347
|
+
postId: import_joi134.default.string().hex().length(24).required(),
|
|
67348
|
+
receiverId: import_joi134.default.string().hex().length(24).required(),
|
|
67349
|
+
buyerId: import_joi134.default.string().hex().length(24).required(),
|
|
67350
|
+
price: import_joi134.default.when("type", {
|
|
67351
|
+
is: "bid" /* BID */,
|
|
67352
|
+
then: import_joi134.default.number().required(),
|
|
67353
|
+
otherwise: import_joi134.default.number().optional().allow(null)
|
|
67354
|
+
}),
|
|
67355
|
+
message: import_joi134.default.string().optional().allow("", null),
|
|
67356
|
+
status: import_joi134.default.string().valid(...Object.values(BidStatus)).optional().default("pending" /* PENDING */)
|
|
67357
|
+
});
|
|
67358
|
+
var schemaUpdateBidPreloved = import_joi134.default.object({
|
|
67359
|
+
status: import_joi134.default.string().valid(...Object.values(BidStatus)).required()
|
|
67360
|
+
});
|
|
67361
|
+
function MBidPreloved(value) {
|
|
67362
|
+
const { error } = schemaBidPreloved.validate(value);
|
|
67363
|
+
if (error)
|
|
67364
|
+
throw new Error(error.details[0].message);
|
|
67365
|
+
if (value.postId && typeof value.postId === "string")
|
|
67366
|
+
value.postId = new import_mongodb138.ObjectId(value.postId);
|
|
67367
|
+
if (value.buyerId && typeof value.buyerId === "string")
|
|
67368
|
+
value.buyerId = new import_mongodb138.ObjectId(value.buyerId);
|
|
67369
|
+
return {
|
|
67370
|
+
_id: new import_mongodb138.ObjectId(),
|
|
67371
|
+
price: value.price ?? null,
|
|
67372
|
+
message: value.message ?? "",
|
|
67373
|
+
status: value.status ?? "pending" /* PENDING */,
|
|
67374
|
+
type: value.type,
|
|
67375
|
+
postId: value.postId,
|
|
67376
|
+
buyerId: value.buyerId ?? null,
|
|
67377
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
67378
|
+
updatedAt: null
|
|
67379
|
+
};
|
|
67380
|
+
}
|
|
67381
|
+
|
|
67382
|
+
// src/repositories/post-preloved.repo.ts
|
|
67329
67383
|
function usePostPrelovedRepo() {
|
|
67330
67384
|
const db = import_node_server_utils237.useAtlas.getDb();
|
|
67331
67385
|
if (!db) {
|
|
@@ -67409,14 +67463,14 @@ function usePostPrelovedRepo() {
|
|
|
67409
67463
|
}
|
|
67410
67464
|
async function getById(_id, userId) {
|
|
67411
67465
|
try {
|
|
67412
|
-
_id = new
|
|
67466
|
+
_id = new import_mongodb139.ObjectId(_id);
|
|
67413
67467
|
} catch {
|
|
67414
67468
|
throw new import_node_server_utils237.BadRequestError("Invalid post ID format.");
|
|
67415
67469
|
}
|
|
67416
67470
|
let userObjectId = null;
|
|
67417
67471
|
if (userId) {
|
|
67418
67472
|
try {
|
|
67419
|
-
userObjectId = new
|
|
67473
|
+
userObjectId = new import_mongodb139.ObjectId(userId);
|
|
67420
67474
|
} catch {
|
|
67421
67475
|
throw new import_node_server_utils237.BadRequestError("Invalid user ID format.");
|
|
67422
67476
|
}
|
|
@@ -67424,6 +67478,20 @@ function usePostPrelovedRepo() {
|
|
|
67424
67478
|
const favoriteUserIds = {
|
|
67425
67479
|
$ifNull: [{ $arrayElemAt: ["$favoriteData.userIds", 0] }, []]
|
|
67426
67480
|
};
|
|
67481
|
+
const RESERVE_BID_LOOKUP = {
|
|
67482
|
+
$lookup: {
|
|
67483
|
+
from: "bid-preloved",
|
|
67484
|
+
localField: "_id",
|
|
67485
|
+
foreignField: "postId",
|
|
67486
|
+
pipeline: [
|
|
67487
|
+
{ $match: { type: "reserve" /* RESERVE */ } },
|
|
67488
|
+
{ $sort: { createdAt: -1 } },
|
|
67489
|
+
{ $limit: 1 },
|
|
67490
|
+
{ $project: { price: 1, buyerId: 1, status: 1, createdAt: 1 } }
|
|
67491
|
+
],
|
|
67492
|
+
as: "reserveBid"
|
|
67493
|
+
}
|
|
67494
|
+
};
|
|
67427
67495
|
try {
|
|
67428
67496
|
const result = await collection.aggregate([
|
|
67429
67497
|
{ $match: { _id, status: { $ne: "deleted" /* DELETED */ } } },
|
|
@@ -67456,10 +67524,20 @@ function usePostPrelovedRepo() {
|
|
|
67456
67524
|
as: "favoriteData"
|
|
67457
67525
|
}
|
|
67458
67526
|
},
|
|
67527
|
+
RESERVE_BID_LOOKUP,
|
|
67459
67528
|
{
|
|
67460
67529
|
$addFields: {
|
|
67461
67530
|
favoriteCount: { $size: favoriteUserIds },
|
|
67462
|
-
isFavorited: userObjectId ? { $in: [userObjectId, favoriteUserIds] } : false
|
|
67531
|
+
isFavorited: userObjectId ? { $in: [userObjectId, favoriteUserIds] } : false,
|
|
67532
|
+
isReserved: { $gt: [{ $size: "$reserveBid" }, 0] },
|
|
67533
|
+
reserveBid: {
|
|
67534
|
+
$ifNull: [{ $arrayElemAt: ["$reserveBid", 0] }, null]
|
|
67535
|
+
}
|
|
67536
|
+
}
|
|
67537
|
+
},
|
|
67538
|
+
{
|
|
67539
|
+
$addFields: {
|
|
67540
|
+
reserverId: { $ifNull: ["$reserveBid._id", null] }
|
|
67463
67541
|
}
|
|
67464
67542
|
},
|
|
67465
67543
|
{ $unset: "favoriteData" }
|
|
@@ -67486,7 +67564,7 @@ function usePostPrelovedRepo() {
|
|
|
67486
67564
|
page = page > 0 ? page - 1 : 0;
|
|
67487
67565
|
if (site) {
|
|
67488
67566
|
try {
|
|
67489
|
-
site = new
|
|
67567
|
+
site = new import_mongodb139.ObjectId(site);
|
|
67490
67568
|
} catch {
|
|
67491
67569
|
throw new import_node_server_utils237.BadRequestError("Invalid site ID format.");
|
|
67492
67570
|
}
|
|
@@ -67495,14 +67573,14 @@ function usePostPrelovedRepo() {
|
|
|
67495
67573
|
let subcategoryIds = null;
|
|
67496
67574
|
if (category && subcategory) {
|
|
67497
67575
|
try {
|
|
67498
|
-
categoryId = new
|
|
67576
|
+
categoryId = new import_mongodb139.ObjectId(category);
|
|
67499
67577
|
} catch {
|
|
67500
67578
|
throw new import_node_server_utils237.BadRequestError("Invalid category ID format.");
|
|
67501
67579
|
}
|
|
67502
67580
|
if (subcategory.length > 0) {
|
|
67503
67581
|
subcategoryIds = subcategory.map((id) => {
|
|
67504
67582
|
try {
|
|
67505
|
-
return new
|
|
67583
|
+
return new import_mongodb139.ObjectId(id);
|
|
67506
67584
|
} catch {
|
|
67507
67585
|
throw new import_node_server_utils237.BadRequestError("Invalid subcategory ID format.");
|
|
67508
67586
|
}
|
|
@@ -67527,11 +67605,25 @@ function usePostPrelovedRepo() {
|
|
|
67527
67605
|
let userObjectId = null;
|
|
67528
67606
|
if (userId) {
|
|
67529
67607
|
try {
|
|
67530
|
-
userObjectId = new
|
|
67608
|
+
userObjectId = new import_mongodb139.ObjectId(userId);
|
|
67531
67609
|
} catch {
|
|
67532
67610
|
throw new import_node_server_utils237.BadRequestError("Invalid user ID format.");
|
|
67533
67611
|
}
|
|
67534
67612
|
}
|
|
67613
|
+
const RESERVE_BID_LOOKUP = {
|
|
67614
|
+
$lookup: {
|
|
67615
|
+
from: "bid-preloved",
|
|
67616
|
+
localField: "_id",
|
|
67617
|
+
foreignField: "postId",
|
|
67618
|
+
pipeline: [
|
|
67619
|
+
{ $match: { type: "reserve" /* RESERVE */ } },
|
|
67620
|
+
{ $sort: { createdAt: -1 } },
|
|
67621
|
+
{ $limit: 1 },
|
|
67622
|
+
{ $project: { price: 1, buyerId: 1, status: 1, createdAt: 1 } }
|
|
67623
|
+
],
|
|
67624
|
+
as: "reserveBid"
|
|
67625
|
+
}
|
|
67626
|
+
};
|
|
67535
67627
|
const sortObj = buildSortObj(filter);
|
|
67536
67628
|
const FAVORITE_COUNT_LOOKUP = {
|
|
67537
67629
|
$lookup: {
|
|
@@ -67548,7 +67640,16 @@ function usePostPrelovedRepo() {
|
|
|
67548
67640
|
const FAVORITE_COUNT_ADD_FIELD = {
|
|
67549
67641
|
$addFields: {
|
|
67550
67642
|
favoriteCount: { $size: favoriteUserIds },
|
|
67551
|
-
isFavorited: userObjectId ? { $in: [userObjectId, favoriteUserIds] } : false
|
|
67643
|
+
isFavorited: userObjectId ? { $in: [userObjectId, favoriteUserIds] } : false,
|
|
67644
|
+
isReserved: { $gt: [{ $size: "$reserveBid" }, 0] },
|
|
67645
|
+
reserveBid: {
|
|
67646
|
+
$ifNull: [{ $arrayElemAt: ["$reserveBid", 0] }, null]
|
|
67647
|
+
}
|
|
67648
|
+
}
|
|
67649
|
+
};
|
|
67650
|
+
const RESERVER_ID_ADD_FIELD = {
|
|
67651
|
+
$addFields: {
|
|
67652
|
+
reserverId: { $ifNull: ["$reserveBid._id", null] }
|
|
67552
67653
|
}
|
|
67553
67654
|
};
|
|
67554
67655
|
const FAVORITE_COUNT_UNSET = { $unset: "favoriteData" };
|
|
@@ -67560,7 +67661,9 @@ function usePostPrelovedRepo() {
|
|
|
67560
67661
|
USER_UNWIND,
|
|
67561
67662
|
CATEGORY_LOOKUP,
|
|
67562
67663
|
FAVORITE_COUNT_LOOKUP,
|
|
67664
|
+
RESERVE_BID_LOOKUP,
|
|
67563
67665
|
FAVORITE_COUNT_ADD_FIELD,
|
|
67666
|
+
RESERVER_ID_ADD_FIELD,
|
|
67564
67667
|
FAVORITE_COUNT_UNSET,
|
|
67565
67668
|
{ $sort: sortObj },
|
|
67566
67669
|
{ $skip: page * limit },
|
|
@@ -67586,13 +67689,13 @@ function usePostPrelovedRepo() {
|
|
|
67586
67689
|
page = page > 0 ? page - 1 : 0;
|
|
67587
67690
|
let ownerObjectId;
|
|
67588
67691
|
try {
|
|
67589
|
-
ownerObjectId = new
|
|
67692
|
+
ownerObjectId = new import_mongodb139.ObjectId(ownerId);
|
|
67590
67693
|
} catch {
|
|
67591
67694
|
throw new import_node_server_utils237.BadRequestError("Invalid user ID format.");
|
|
67592
67695
|
}
|
|
67593
67696
|
if (site) {
|
|
67594
67697
|
try {
|
|
67595
|
-
site = new
|
|
67698
|
+
site = new import_mongodb139.ObjectId(site);
|
|
67596
67699
|
} catch {
|
|
67597
67700
|
throw new import_node_server_utils237.BadRequestError("Invalid site ID format.");
|
|
67598
67701
|
}
|
|
@@ -67601,7 +67704,7 @@ function usePostPrelovedRepo() {
|
|
|
67601
67704
|
if (Array.isArray(category) && category.length > 0) {
|
|
67602
67705
|
categoryIds = category.map((cat) => {
|
|
67603
67706
|
try {
|
|
67604
|
-
return new
|
|
67707
|
+
return new import_mongodb139.ObjectId(cat);
|
|
67605
67708
|
} catch {
|
|
67606
67709
|
throw new import_node_server_utils237.BadRequestError("Invalid category ID format.");
|
|
67607
67710
|
}
|
|
@@ -67644,7 +67747,7 @@ function usePostPrelovedRepo() {
|
|
|
67644
67747
|
}
|
|
67645
67748
|
async function updateById(_id, value, session) {
|
|
67646
67749
|
try {
|
|
67647
|
-
_id = new
|
|
67750
|
+
_id = new import_mongodb139.ObjectId(_id);
|
|
67648
67751
|
} catch {
|
|
67649
67752
|
throw new import_node_server_utils237.BadRequestError("Invalid post ID format.");
|
|
67650
67753
|
}
|
|
@@ -67665,7 +67768,7 @@ function usePostPrelovedRepo() {
|
|
|
67665
67768
|
}
|
|
67666
67769
|
async function deleteById(_id, session) {
|
|
67667
67770
|
try {
|
|
67668
|
-
_id = new
|
|
67771
|
+
_id = new import_mongodb139.ObjectId(_id);
|
|
67669
67772
|
} catch {
|
|
67670
67773
|
throw new import_node_server_utils237.BadRequestError("Invalid post ID format.");
|
|
67671
67774
|
}
|
|
@@ -67691,7 +67794,7 @@ function usePostPrelovedRepo() {
|
|
|
67691
67794
|
}
|
|
67692
67795
|
async function updateStatus(_id, status, session) {
|
|
67693
67796
|
try {
|
|
67694
|
-
_id = new
|
|
67797
|
+
_id = new import_mongodb139.ObjectId(_id);
|
|
67695
67798
|
} catch {
|
|
67696
67799
|
throw new import_node_server_utils237.BadRequestError("Invalid post ID format.");
|
|
67697
67800
|
}
|
|
@@ -67722,27 +67825,27 @@ function usePostPrelovedRepo() {
|
|
|
67722
67825
|
|
|
67723
67826
|
// src/controllers/post-preloved.controller.ts
|
|
67724
67827
|
var import_node_server_utils240 = require("@7365admin1/node-server-utils");
|
|
67725
|
-
var
|
|
67828
|
+
var import_joi136 = __toESM(require("joi"));
|
|
67726
67829
|
|
|
67727
67830
|
// src/services/post-preloved.service.ts
|
|
67728
67831
|
var import_node_server_utils239 = require("@7365admin1/node-server-utils");
|
|
67729
67832
|
|
|
67730
67833
|
// src/repositories/post-favorite.repo.ts
|
|
67731
67834
|
var import_node_server_utils238 = require("@7365admin1/node-server-utils");
|
|
67732
|
-
var
|
|
67835
|
+
var import_mongodb141 = require("mongodb");
|
|
67733
67836
|
|
|
67734
67837
|
// src/models/post-favorite.model.ts
|
|
67735
|
-
var
|
|
67736
|
-
var
|
|
67737
|
-
var schemaUpdatePostFavorite =
|
|
67738
|
-
userId:
|
|
67838
|
+
var import_joi135 = __toESM(require("joi"));
|
|
67839
|
+
var import_mongodb140 = require("mongodb");
|
|
67840
|
+
var schemaUpdatePostFavorite = import_joi135.default.object({
|
|
67841
|
+
userId: import_joi135.default.string().hex().length(24).required()
|
|
67739
67842
|
});
|
|
67740
|
-
var schemaPostFavorite =
|
|
67741
|
-
_id:
|
|
67742
|
-
postId:
|
|
67743
|
-
userIds:
|
|
67744
|
-
createdAt:
|
|
67745
|
-
updatedAt:
|
|
67843
|
+
var schemaPostFavorite = import_joi135.default.object({
|
|
67844
|
+
_id: import_joi135.default.string().hex().optional().allow("", null),
|
|
67845
|
+
postId: import_joi135.default.string().hex().required(),
|
|
67846
|
+
userIds: import_joi135.default.array().items(import_joi135.default.string().hex().optional()).optional().allow(null),
|
|
67847
|
+
createdAt: import_joi135.default.date().optional().allow(null),
|
|
67848
|
+
updatedAt: import_joi135.default.date().optional().allow(null)
|
|
67746
67849
|
});
|
|
67747
67850
|
function MPostFavorite(value) {
|
|
67748
67851
|
const { error } = schemaPostFavorite.validate(value);
|
|
@@ -67751,14 +67854,14 @@ function MPostFavorite(value) {
|
|
|
67751
67854
|
}
|
|
67752
67855
|
if (value._id && typeof value._id === "string") {
|
|
67753
67856
|
try {
|
|
67754
|
-
value._id = new
|
|
67857
|
+
value._id = new import_mongodb140.ObjectId(value._id);
|
|
67755
67858
|
} catch {
|
|
67756
67859
|
throw new Error("Invalid ID.");
|
|
67757
67860
|
}
|
|
67758
67861
|
}
|
|
67759
67862
|
if (value.postId && typeof value.postId === "string") {
|
|
67760
67863
|
try {
|
|
67761
|
-
value.postId = new
|
|
67864
|
+
value.postId = new import_mongodb140.ObjectId(value.postId);
|
|
67762
67865
|
} catch {
|
|
67763
67866
|
throw new Error("Invalid post ID.");
|
|
67764
67867
|
}
|
|
@@ -67767,7 +67870,7 @@ function MPostFavorite(value) {
|
|
|
67767
67870
|
value.userIds = value.userIds.map((id) => {
|
|
67768
67871
|
if (typeof id === "string") {
|
|
67769
67872
|
try {
|
|
67770
|
-
return new
|
|
67873
|
+
return new import_mongodb140.ObjectId(id);
|
|
67771
67874
|
} catch {
|
|
67772
67875
|
throw new Error("Invalid user ID.");
|
|
67773
67876
|
}
|
|
@@ -67776,7 +67879,7 @@ function MPostFavorite(value) {
|
|
|
67776
67879
|
});
|
|
67777
67880
|
}
|
|
67778
67881
|
return {
|
|
67779
|
-
_id: value._id ?? new
|
|
67882
|
+
_id: value._id ?? new import_mongodb140.ObjectId(),
|
|
67780
67883
|
postId: value.postId ?? "",
|
|
67781
67884
|
userIds: value.userIds ?? [],
|
|
67782
67885
|
createdAt: value.createdAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -67816,7 +67919,7 @@ function usePostFavoriteRepo() {
|
|
|
67816
67919
|
}
|
|
67817
67920
|
async function getById(_id) {
|
|
67818
67921
|
try {
|
|
67819
|
-
_id = new
|
|
67922
|
+
_id = new import_mongodb141.ObjectId(_id);
|
|
67820
67923
|
} catch {
|
|
67821
67924
|
throw new import_node_server_utils238.BadRequestError("Invalid favorite ID format.");
|
|
67822
67925
|
}
|
|
@@ -67827,7 +67930,7 @@ function usePostFavoriteRepo() {
|
|
|
67827
67930
|
}
|
|
67828
67931
|
async function getByPostId(postId) {
|
|
67829
67932
|
try {
|
|
67830
|
-
postId = new
|
|
67933
|
+
postId = new import_mongodb141.ObjectId(postId);
|
|
67831
67934
|
} catch {
|
|
67832
67935
|
throw new import_node_server_utils238.BadRequestError("Invalid post ID format.");
|
|
67833
67936
|
}
|
|
@@ -67838,13 +67941,13 @@ function usePostFavoriteRepo() {
|
|
|
67838
67941
|
}
|
|
67839
67942
|
async function updateById(_id, userId, session) {
|
|
67840
67943
|
try {
|
|
67841
|
-
_id = new
|
|
67944
|
+
_id = new import_mongodb141.ObjectId(_id);
|
|
67842
67945
|
} catch {
|
|
67843
67946
|
throw new import_node_server_utils238.BadRequestError("Invalid favorite ID format.");
|
|
67844
67947
|
}
|
|
67845
67948
|
let userObjectId;
|
|
67846
67949
|
try {
|
|
67847
|
-
userObjectId = new
|
|
67950
|
+
userObjectId = new import_mongodb141.ObjectId(userId);
|
|
67848
67951
|
} catch {
|
|
67849
67952
|
throw new import_node_server_utils238.BadRequestError("Invalid user ID format.");
|
|
67850
67953
|
}
|
|
@@ -67876,7 +67979,7 @@ function usePostFavoriteRepo() {
|
|
|
67876
67979
|
}
|
|
67877
67980
|
|
|
67878
67981
|
// src/services/post-preloved.service.ts
|
|
67879
|
-
var
|
|
67982
|
+
var import_mongodb142 = require("mongodb");
|
|
67880
67983
|
function usePostFavoriteService() {
|
|
67881
67984
|
const { add: _addPost } = usePostPrelovedRepo();
|
|
67882
67985
|
const { addFavorite: _addFavorite } = usePostFavoriteRepo();
|
|
@@ -67894,7 +67997,7 @@ function usePostFavoriteService() {
|
|
|
67894
67997
|
let siteId = value.site;
|
|
67895
67998
|
let postId = post.toString();
|
|
67896
67999
|
if (value.site) {
|
|
67897
|
-
siteId = new
|
|
68000
|
+
siteId = new import_mongodb142.ObjectId(value.site);
|
|
67898
68001
|
}
|
|
67899
68002
|
if (post) {
|
|
67900
68003
|
postId = post.toString();
|
|
@@ -67960,9 +68063,9 @@ function usePostPrelovedController() {
|
|
|
67960
68063
|
}
|
|
67961
68064
|
}
|
|
67962
68065
|
async function getById(req, res, next) {
|
|
67963
|
-
const schema2 =
|
|
67964
|
-
_id:
|
|
67965
|
-
userId:
|
|
68066
|
+
const schema2 = import_joi136.default.object({
|
|
68067
|
+
_id: import_joi136.default.string().hex().length(24).required(),
|
|
68068
|
+
userId: import_joi136.default.string().hex().length(24).optional().allow("", null)
|
|
67966
68069
|
});
|
|
67967
68070
|
const { error, value } = schema2.validate({
|
|
67968
68071
|
_id: req.params.id,
|
|
@@ -67984,19 +68087,19 @@ function usePostPrelovedController() {
|
|
|
67984
68087
|
}
|
|
67985
68088
|
}
|
|
67986
68089
|
async function getAll(req, res, next) {
|
|
67987
|
-
const validation =
|
|
67988
|
-
page:
|
|
67989
|
-
limit:
|
|
67990
|
-
search:
|
|
67991
|
-
filter:
|
|
67992
|
-
site:
|
|
67993
|
-
status:
|
|
67994
|
-
|
|
67995
|
-
|
|
68090
|
+
const validation = import_joi136.default.object({
|
|
68091
|
+
page: import_joi136.default.number().integer().min(1).allow("", null).default(1),
|
|
68092
|
+
limit: import_joi136.default.number().integer().min(1).max(100).allow("", null).default(10),
|
|
68093
|
+
search: import_joi136.default.string().optional().allow("", null),
|
|
68094
|
+
filter: import_joi136.default.string().valid("recent", "price-low-high", "price-high-low").optional().allow("", null),
|
|
68095
|
+
site: import_joi136.default.string().hex().length(24).optional().allow("", null),
|
|
68096
|
+
status: import_joi136.default.alternatives().try(
|
|
68097
|
+
import_joi136.default.array().items(import_joi136.default.string().valid(...Object.values(PostStatus))),
|
|
68098
|
+
import_joi136.default.string().valid(...Object.values(PostStatus))
|
|
67996
68099
|
).optional().allow(null),
|
|
67997
|
-
category:
|
|
67998
|
-
subcategory:
|
|
67999
|
-
userId:
|
|
68100
|
+
category: import_joi136.default.string().hex().length(24).optional().allow("", null),
|
|
68101
|
+
subcategory: import_joi136.default.array().items(import_joi136.default.string()).single().optional().allow(null),
|
|
68102
|
+
userId: import_joi136.default.string().optional().allow("", null)
|
|
68000
68103
|
});
|
|
68001
68104
|
const { error, value } = validation.validate(req.query, {
|
|
68002
68105
|
abortEarly: false
|
|
@@ -68039,18 +68142,18 @@ function usePostPrelovedController() {
|
|
|
68039
68142
|
}
|
|
68040
68143
|
}
|
|
68041
68144
|
async function getByOwnerId(req, res, next) {
|
|
68042
|
-
const validation =
|
|
68043
|
-
ownerId:
|
|
68044
|
-
page:
|
|
68045
|
-
limit:
|
|
68046
|
-
search:
|
|
68047
|
-
filter:
|
|
68048
|
-
site:
|
|
68049
|
-
status:
|
|
68050
|
-
|
|
68051
|
-
|
|
68145
|
+
const validation = import_joi136.default.object({
|
|
68146
|
+
ownerId: import_joi136.default.string().hex().length(24).required(),
|
|
68147
|
+
page: import_joi136.default.number().integer().min(1).allow("", null).default(1),
|
|
68148
|
+
limit: import_joi136.default.number().integer().min(1).max(100).allow("", null).default(10),
|
|
68149
|
+
search: import_joi136.default.string().optional().allow("", null),
|
|
68150
|
+
filter: import_joi136.default.string().valid("recent", "price-low-high", "price-high-low").optional().allow("", null),
|
|
68151
|
+
site: import_joi136.default.string().hex().length(24).optional().allow("", null),
|
|
68152
|
+
status: import_joi136.default.alternatives().try(
|
|
68153
|
+
import_joi136.default.array().items(import_joi136.default.string().valid(...Object.values(PostStatus))),
|
|
68154
|
+
import_joi136.default.string().valid(...Object.values(PostStatus))
|
|
68052
68155
|
).optional().allow(null),
|
|
68053
|
-
category:
|
|
68156
|
+
category: import_joi136.default.array().items(import_joi136.default.string().hex().length(24)).single().optional().allow(null)
|
|
68054
68157
|
});
|
|
68055
68158
|
const { error, value } = validation.validate(
|
|
68056
68159
|
{ ...req.query, ownerId: req.params.ownerId },
|
|
@@ -68104,8 +68207,8 @@ function usePostPrelovedController() {
|
|
|
68104
68207
|
}
|
|
68105
68208
|
}
|
|
68106
68209
|
async function deleteById(req, res, next) {
|
|
68107
|
-
const schema2 =
|
|
68108
|
-
_id:
|
|
68210
|
+
const schema2 = import_joi136.default.object({
|
|
68211
|
+
_id: import_joi136.default.string().hex().length(24).required()
|
|
68109
68212
|
});
|
|
68110
68213
|
const { error, value } = schema2.validate({ _id: req.params.id });
|
|
68111
68214
|
if (error) {
|
|
@@ -68124,9 +68227,9 @@ function usePostPrelovedController() {
|
|
|
68124
68227
|
}
|
|
68125
68228
|
}
|
|
68126
68229
|
async function updateStatus(req, res, next) {
|
|
68127
|
-
const schema2 =
|
|
68128
|
-
_id:
|
|
68129
|
-
status:
|
|
68230
|
+
const schema2 = import_joi136.default.object({
|
|
68231
|
+
_id: import_joi136.default.string().hex().length(24).required(),
|
|
68232
|
+
status: import_joi136.default.string().valid(...Object.values(PostStatus)).required()
|
|
68130
68233
|
});
|
|
68131
68234
|
const { error, value } = schema2.validate({
|
|
68132
68235
|
_id: req.params.id,
|
|
@@ -68198,7 +68301,7 @@ function usePostFavoriteService2() {
|
|
|
68198
68301
|
|
|
68199
68302
|
// src/controllers/post-favorite.controller.ts
|
|
68200
68303
|
var import_node_server_utils242 = require("@7365admin1/node-server-utils");
|
|
68201
|
-
var
|
|
68304
|
+
var import_joi137 = __toESM(require("joi"));
|
|
68202
68305
|
function usePostFavoriteController() {
|
|
68203
68306
|
const { addFavorite: _addFavorite, toggleFavorite: _toggleFavorite } = usePostFavoriteService2();
|
|
68204
68307
|
const { getById: _getById, getByPostId: _getByPostId } = usePostFavoriteRepo();
|
|
@@ -68223,8 +68326,8 @@ function usePostFavoriteController() {
|
|
|
68223
68326
|
}
|
|
68224
68327
|
}
|
|
68225
68328
|
async function getById(req, res, next) {
|
|
68226
|
-
const schema2 =
|
|
68227
|
-
_id:
|
|
68329
|
+
const schema2 = import_joi137.default.object({
|
|
68330
|
+
_id: import_joi137.default.string().hex().length(24).required()
|
|
68228
68331
|
});
|
|
68229
68332
|
const { error, value } = schema2.validate({ _id: req.params.id });
|
|
68230
68333
|
if (error) {
|
|
@@ -68243,8 +68346,8 @@ function usePostFavoriteController() {
|
|
|
68243
68346
|
}
|
|
68244
68347
|
}
|
|
68245
68348
|
async function getByPostId(req, res, next) {
|
|
68246
|
-
const schema2 =
|
|
68247
|
-
postId:
|
|
68349
|
+
const schema2 = import_joi137.default.object({
|
|
68350
|
+
postId: import_joi137.default.string().hex().length(24).required()
|
|
68248
68351
|
});
|
|
68249
68352
|
const { error, value } = schema2.validate({ postId: req.params.postId });
|
|
68250
68353
|
if (error) {
|
|
@@ -68263,8 +68366,8 @@ function usePostFavoriteController() {
|
|
|
68263
68366
|
}
|
|
68264
68367
|
}
|
|
68265
68368
|
async function updateById(req, res, next) {
|
|
68266
|
-
const paramsSchema =
|
|
68267
|
-
_id:
|
|
68369
|
+
const paramsSchema = import_joi137.default.object({
|
|
68370
|
+
_id: import_joi137.default.string().hex().length(24).required()
|
|
68268
68371
|
});
|
|
68269
68372
|
const { error: paramsError, value: paramsValue } = paramsSchema.validate({
|
|
68270
68373
|
_id: req.params.id
|
|
@@ -68297,16 +68400,16 @@ function usePostFavoriteController() {
|
|
|
68297
68400
|
}
|
|
68298
68401
|
|
|
68299
68402
|
// src/models/category-preloved.model.ts
|
|
68300
|
-
var
|
|
68301
|
-
var
|
|
68302
|
-
var schemaCategoryPreloved =
|
|
68303
|
-
name:
|
|
68304
|
-
createdBy:
|
|
68305
|
-
site:
|
|
68403
|
+
var import_joi138 = __toESM(require("joi"));
|
|
68404
|
+
var import_mongodb143 = require("mongodb");
|
|
68405
|
+
var schemaCategoryPreloved = import_joi138.default.object({
|
|
68406
|
+
name: import_joi138.default.string().required(),
|
|
68407
|
+
createdBy: import_joi138.default.string().hex().optional().allow("", null),
|
|
68408
|
+
site: import_joi138.default.string().hex().optional().allow("", null)
|
|
68306
68409
|
});
|
|
68307
|
-
var schemaUpdateCategoryPreloved =
|
|
68308
|
-
name:
|
|
68309
|
-
site:
|
|
68410
|
+
var schemaUpdateCategoryPreloved = import_joi138.default.object({
|
|
68411
|
+
name: import_joi138.default.string().optional().allow("", null),
|
|
68412
|
+
site: import_joi138.default.string().hex().optional().allow("", null)
|
|
68310
68413
|
});
|
|
68311
68414
|
function MCategoryPreloved(value) {
|
|
68312
68415
|
const { error } = schemaCategoryPreloved.validate(value);
|
|
@@ -68315,14 +68418,14 @@ function MCategoryPreloved(value) {
|
|
|
68315
68418
|
}
|
|
68316
68419
|
if (value.createdBy && typeof value.createdBy === "string") {
|
|
68317
68420
|
try {
|
|
68318
|
-
value.createdBy = new
|
|
68421
|
+
value.createdBy = new import_mongodb143.ObjectId(value.createdBy);
|
|
68319
68422
|
} catch {
|
|
68320
68423
|
throw new Error("Invalid createdBy ID.");
|
|
68321
68424
|
}
|
|
68322
68425
|
}
|
|
68323
68426
|
if (value.site && typeof value.site === "string") {
|
|
68324
68427
|
try {
|
|
68325
|
-
value.site = new
|
|
68428
|
+
value.site = new import_mongodb143.ObjectId(value.site);
|
|
68326
68429
|
} catch {
|
|
68327
68430
|
throw new Error("Invalid site ID.");
|
|
68328
68431
|
}
|
|
@@ -68338,7 +68441,7 @@ function MCategoryPreloved(value) {
|
|
|
68338
68441
|
|
|
68339
68442
|
// src/repositories/category-preloved.repo.ts
|
|
68340
68443
|
var import_node_server_utils243 = require("@7365admin1/node-server-utils");
|
|
68341
|
-
var
|
|
68444
|
+
var import_mongodb144 = require("mongodb");
|
|
68342
68445
|
function useCategoryPrelovedRepo() {
|
|
68343
68446
|
const db = import_node_server_utils243.useAtlas.getDb();
|
|
68344
68447
|
if (!db) {
|
|
@@ -68352,7 +68455,7 @@ function useCategoryPrelovedRepo() {
|
|
|
68352
68455
|
} = {}) {
|
|
68353
68456
|
if (site) {
|
|
68354
68457
|
try {
|
|
68355
|
-
site = new
|
|
68458
|
+
site = new import_mongodb144.ObjectId(site);
|
|
68356
68459
|
} catch {
|
|
68357
68460
|
throw new import_node_server_utils243.BadRequestError("Invalid site ID format.");
|
|
68358
68461
|
}
|
|
@@ -68371,7 +68474,7 @@ function useCategoryPrelovedRepo() {
|
|
|
68371
68474
|
async function getById(_id) {
|
|
68372
68475
|
let objectId2;
|
|
68373
68476
|
try {
|
|
68374
|
-
objectId2 = new
|
|
68477
|
+
objectId2 = new import_mongodb144.ObjectId(_id);
|
|
68375
68478
|
} catch {
|
|
68376
68479
|
throw new import_node_server_utils243.BadRequestError("Invalid category-preloved ID format.");
|
|
68377
68480
|
}
|
|
@@ -68401,7 +68504,7 @@ function useCategoryPrelovedRepo() {
|
|
|
68401
68504
|
async function updateById(_id, value) {
|
|
68402
68505
|
let objectId2;
|
|
68403
68506
|
try {
|
|
68404
|
-
objectId2 = new
|
|
68507
|
+
objectId2 = new import_mongodb144.ObjectId(_id);
|
|
68405
68508
|
} catch {
|
|
68406
68509
|
throw new import_node_server_utils243.BadRequestError("Invalid category ID format.");
|
|
68407
68510
|
}
|
|
@@ -68419,7 +68522,7 @@ function useCategoryPrelovedRepo() {
|
|
|
68419
68522
|
async function deleteById(_id) {
|
|
68420
68523
|
let objectId2;
|
|
68421
68524
|
try {
|
|
68422
|
-
objectId2 = new
|
|
68525
|
+
objectId2 = new import_mongodb144.ObjectId(_id);
|
|
68423
68526
|
} catch {
|
|
68424
68527
|
throw new import_node_server_utils243.BadRequestError("Invalid category ID format.");
|
|
68425
68528
|
}
|
|
@@ -68436,13 +68539,13 @@ function useCategoryPrelovedRepo() {
|
|
|
68436
68539
|
|
|
68437
68540
|
// src/controllers/category-preloved.controller.ts
|
|
68438
68541
|
var import_node_server_utils244 = require("@7365admin1/node-server-utils");
|
|
68439
|
-
var
|
|
68542
|
+
var import_joi139 = __toESM(require("joi"));
|
|
68440
68543
|
function useCategoryPrelovedController() {
|
|
68441
68544
|
const { getAll: _getAll, getById: _getById, addCategory: _addCategory, updateById: _updateById, deleteById: _deleteById } = useCategoryPrelovedRepo();
|
|
68442
68545
|
async function getAll(req, res, next) {
|
|
68443
|
-
const schema2 =
|
|
68444
|
-
search:
|
|
68445
|
-
site:
|
|
68546
|
+
const schema2 = import_joi139.default.object({
|
|
68547
|
+
search: import_joi139.default.string().optional().allow("", null),
|
|
68548
|
+
site: import_joi139.default.string().hex().length(24).optional().allow("", null)
|
|
68446
68549
|
});
|
|
68447
68550
|
const { error, value } = schema2.validate(req.query, { abortEarly: false });
|
|
68448
68551
|
if (error) {
|
|
@@ -68462,8 +68565,8 @@ function useCategoryPrelovedController() {
|
|
|
68462
68565
|
}
|
|
68463
68566
|
}
|
|
68464
68567
|
async function getById(req, res, next) {
|
|
68465
|
-
const schema2 =
|
|
68466
|
-
_id:
|
|
68568
|
+
const schema2 = import_joi139.default.object({
|
|
68569
|
+
_id: import_joi139.default.string().hex().length(24).required()
|
|
68467
68570
|
});
|
|
68468
68571
|
const { error, value } = schema2.validate({ _id: req.params.id });
|
|
68469
68572
|
if (error) {
|
|
@@ -68518,8 +68621,8 @@ function useCategoryPrelovedController() {
|
|
|
68518
68621
|
}
|
|
68519
68622
|
}
|
|
68520
68623
|
async function deleteById(req, res, next) {
|
|
68521
|
-
const schema2 =
|
|
68522
|
-
_id:
|
|
68624
|
+
const schema2 = import_joi139.default.object({
|
|
68625
|
+
_id: import_joi139.default.string().hex().length(24).required()
|
|
68523
68626
|
});
|
|
68524
68627
|
const { error, value } = schema2.validate({ _id: req.params.id });
|
|
68525
68628
|
if (error) {
|
|
@@ -68539,18 +68642,18 @@ function useCategoryPrelovedController() {
|
|
|
68539
68642
|
}
|
|
68540
68643
|
|
|
68541
68644
|
// src/models/subcategory-preloved.model.ts
|
|
68542
|
-
var
|
|
68543
|
-
var
|
|
68544
|
-
var schemaSubcategoryPreloved =
|
|
68545
|
-
name:
|
|
68546
|
-
createdBy:
|
|
68547
|
-
site:
|
|
68548
|
-
category_id:
|
|
68645
|
+
var import_joi140 = __toESM(require("joi"));
|
|
68646
|
+
var import_mongodb145 = require("mongodb");
|
|
68647
|
+
var schemaSubcategoryPreloved = import_joi140.default.object({
|
|
68648
|
+
name: import_joi140.default.string().required(),
|
|
68649
|
+
createdBy: import_joi140.default.string().hex().optional().allow("", null),
|
|
68650
|
+
site: import_joi140.default.string().hex().optional().allow("", null),
|
|
68651
|
+
category_id: import_joi140.default.string().hex().required()
|
|
68549
68652
|
});
|
|
68550
|
-
var schemaUpdateSubcategoryPreloved =
|
|
68551
|
-
name:
|
|
68552
|
-
site:
|
|
68553
|
-
category_id:
|
|
68653
|
+
var schemaUpdateSubcategoryPreloved = import_joi140.default.object({
|
|
68654
|
+
name: import_joi140.default.string().optional().allow("", null),
|
|
68655
|
+
site: import_joi140.default.string().hex().optional().allow("", null),
|
|
68656
|
+
category_id: import_joi140.default.string().hex().optional().allow("", null)
|
|
68554
68657
|
});
|
|
68555
68658
|
function MSubcategoryPreloved(value) {
|
|
68556
68659
|
const { error } = schemaSubcategoryPreloved.validate(value);
|
|
@@ -68559,21 +68662,21 @@ function MSubcategoryPreloved(value) {
|
|
|
68559
68662
|
}
|
|
68560
68663
|
if (value.createdBy && typeof value.createdBy === "string") {
|
|
68561
68664
|
try {
|
|
68562
|
-
value.createdBy = new
|
|
68665
|
+
value.createdBy = new import_mongodb145.ObjectId(value.createdBy);
|
|
68563
68666
|
} catch {
|
|
68564
68667
|
throw new Error("Invalid createdBy ID.");
|
|
68565
68668
|
}
|
|
68566
68669
|
}
|
|
68567
68670
|
if (value.site && typeof value.site === "string") {
|
|
68568
68671
|
try {
|
|
68569
|
-
value.site = new
|
|
68672
|
+
value.site = new import_mongodb145.ObjectId(value.site);
|
|
68570
68673
|
} catch {
|
|
68571
68674
|
throw new Error("Invalid site ID.");
|
|
68572
68675
|
}
|
|
68573
68676
|
}
|
|
68574
68677
|
if (value.category_id && typeof value.category_id === "string") {
|
|
68575
68678
|
try {
|
|
68576
|
-
value.category_id = new
|
|
68679
|
+
value.category_id = new import_mongodb145.ObjectId(value.category_id);
|
|
68577
68680
|
} catch {
|
|
68578
68681
|
throw new Error("Invalid category ID.");
|
|
68579
68682
|
}
|
|
@@ -68590,7 +68693,7 @@ function MSubcategoryPreloved(value) {
|
|
|
68590
68693
|
|
|
68591
68694
|
// src/repositories/subcategory-preloved.repo.ts
|
|
68592
68695
|
var import_node_server_utils245 = require("@7365admin1/node-server-utils");
|
|
68593
|
-
var
|
|
68696
|
+
var import_mongodb146 = require("mongodb");
|
|
68594
68697
|
function useSubcategoryPrelovedRepo() {
|
|
68595
68698
|
const db = import_node_server_utils245.useAtlas.getDb();
|
|
68596
68699
|
if (!db) {
|
|
@@ -68605,14 +68708,14 @@ function useSubcategoryPrelovedRepo() {
|
|
|
68605
68708
|
} = {}) {
|
|
68606
68709
|
if (site) {
|
|
68607
68710
|
try {
|
|
68608
|
-
site = new
|
|
68711
|
+
site = new import_mongodb146.ObjectId(site);
|
|
68609
68712
|
} catch {
|
|
68610
68713
|
throw new import_node_server_utils245.BadRequestError("Invalid site ID format.");
|
|
68611
68714
|
}
|
|
68612
68715
|
}
|
|
68613
68716
|
if (category_id) {
|
|
68614
68717
|
try {
|
|
68615
|
-
category_id = new
|
|
68718
|
+
category_id = new import_mongodb146.ObjectId(category_id);
|
|
68616
68719
|
} catch {
|
|
68617
68720
|
throw new import_node_server_utils245.BadRequestError("Invalid category ID format.");
|
|
68618
68721
|
}
|
|
@@ -68631,7 +68734,7 @@ function useSubcategoryPrelovedRepo() {
|
|
|
68631
68734
|
async function getById(_id) {
|
|
68632
68735
|
let objectId2;
|
|
68633
68736
|
try {
|
|
68634
|
-
objectId2 = new
|
|
68737
|
+
objectId2 = new import_mongodb146.ObjectId(_id);
|
|
68635
68738
|
} catch {
|
|
68636
68739
|
throw new import_node_server_utils245.BadRequestError("Invalid subcategory-preloved ID format.");
|
|
68637
68740
|
}
|
|
@@ -68660,20 +68763,20 @@ function useSubcategoryPrelovedRepo() {
|
|
|
68660
68763
|
async function updateById(_id, value, session) {
|
|
68661
68764
|
let objectId2;
|
|
68662
68765
|
try {
|
|
68663
|
-
objectId2 = new
|
|
68766
|
+
objectId2 = new import_mongodb146.ObjectId(_id);
|
|
68664
68767
|
} catch {
|
|
68665
68768
|
throw new import_node_server_utils245.BadRequestError("Invalid subcategory ID format.");
|
|
68666
68769
|
}
|
|
68667
68770
|
if (value.category_id && typeof value.category_id === "string") {
|
|
68668
68771
|
try {
|
|
68669
|
-
value.category_id = new
|
|
68772
|
+
value.category_id = new import_mongodb146.ObjectId(value.category_id);
|
|
68670
68773
|
} catch {
|
|
68671
68774
|
throw new import_node_server_utils245.BadRequestError("Invalid category ID format.");
|
|
68672
68775
|
}
|
|
68673
68776
|
}
|
|
68674
68777
|
if (value.site && typeof value.site === "string") {
|
|
68675
68778
|
try {
|
|
68676
|
-
value.site = new
|
|
68779
|
+
value.site = new import_mongodb146.ObjectId(value.site);
|
|
68677
68780
|
} catch {
|
|
68678
68781
|
throw new import_node_server_utils245.BadRequestError("Invalid site ID format.");
|
|
68679
68782
|
}
|
|
@@ -68691,7 +68794,7 @@ function useSubcategoryPrelovedRepo() {
|
|
|
68691
68794
|
async function deleteById(_id, session) {
|
|
68692
68795
|
let objectId2;
|
|
68693
68796
|
try {
|
|
68694
|
-
objectId2 = new
|
|
68797
|
+
objectId2 = new import_mongodb146.ObjectId(_id);
|
|
68695
68798
|
} catch {
|
|
68696
68799
|
throw new import_node_server_utils245.BadRequestError("Invalid subcategory ID format.");
|
|
68697
68800
|
}
|
|
@@ -68705,7 +68808,7 @@ function useSubcategoryPrelovedRepo() {
|
|
|
68705
68808
|
|
|
68706
68809
|
// src/controllers/subcategory-preloved.controller.ts
|
|
68707
68810
|
var import_node_server_utils246 = require("@7365admin1/node-server-utils");
|
|
68708
|
-
var
|
|
68811
|
+
var import_joi141 = __toESM(require("joi"));
|
|
68709
68812
|
function useSubcategoryPrelovedController() {
|
|
68710
68813
|
const {
|
|
68711
68814
|
getAll: _getAll,
|
|
@@ -68715,10 +68818,10 @@ function useSubcategoryPrelovedController() {
|
|
|
68715
68818
|
deleteById: _deleteById
|
|
68716
68819
|
} = useSubcategoryPrelovedRepo();
|
|
68717
68820
|
async function getAll(req, res, next) {
|
|
68718
|
-
const schema2 =
|
|
68719
|
-
search:
|
|
68720
|
-
site:
|
|
68721
|
-
category_id:
|
|
68821
|
+
const schema2 = import_joi141.default.object({
|
|
68822
|
+
search: import_joi141.default.string().optional().allow("", null),
|
|
68823
|
+
site: import_joi141.default.string().hex().length(24).optional().allow("", null),
|
|
68824
|
+
category_id: import_joi141.default.string().hex().length(24).optional().allow("", null)
|
|
68722
68825
|
});
|
|
68723
68826
|
const { error, value } = schema2.validate(req.query, { abortEarly: false });
|
|
68724
68827
|
if (error) {
|
|
@@ -68738,8 +68841,8 @@ function useSubcategoryPrelovedController() {
|
|
|
68738
68841
|
}
|
|
68739
68842
|
}
|
|
68740
68843
|
async function getById(req, res, next) {
|
|
68741
|
-
const schema2 =
|
|
68742
|
-
_id:
|
|
68844
|
+
const schema2 = import_joi141.default.object({
|
|
68845
|
+
_id: import_joi141.default.string().hex().length(24).required()
|
|
68743
68846
|
});
|
|
68744
68847
|
const { error, value } = schema2.validate({ _id: req.params.id });
|
|
68745
68848
|
if (error) {
|
|
@@ -68776,8 +68879,8 @@ function useSubcategoryPrelovedController() {
|
|
|
68776
68879
|
}
|
|
68777
68880
|
}
|
|
68778
68881
|
async function updateById(req, res, next) {
|
|
68779
|
-
const paramsSchema =
|
|
68780
|
-
_id:
|
|
68882
|
+
const paramsSchema = import_joi141.default.object({
|
|
68883
|
+
_id: import_joi141.default.string().hex().length(24).required()
|
|
68781
68884
|
});
|
|
68782
68885
|
const { error: paramsError, value: paramsValue } = paramsSchema.validate({
|
|
68783
68886
|
_id: req.params.id
|
|
@@ -68802,8 +68905,8 @@ function useSubcategoryPrelovedController() {
|
|
|
68802
68905
|
}
|
|
68803
68906
|
}
|
|
68804
68907
|
async function deleteById(req, res, next) {
|
|
68805
|
-
const schema2 =
|
|
68806
|
-
_id:
|
|
68908
|
+
const schema2 = import_joi141.default.object({
|
|
68909
|
+
_id: import_joi141.default.string().hex().length(24).required()
|
|
68807
68910
|
});
|
|
68808
68911
|
const { error, value } = schema2.validate({ _id: req.params.id });
|
|
68809
68912
|
if (error) {
|
|
@@ -68822,40 +68925,40 @@ function useSubcategoryPrelovedController() {
|
|
|
68822
68925
|
}
|
|
68823
68926
|
|
|
68824
68927
|
// src/models/chat-preloved.model.ts
|
|
68825
|
-
var
|
|
68826
|
-
var
|
|
68827
|
-
var schemaMessage =
|
|
68828
|
-
text:
|
|
68829
|
-
date:
|
|
68830
|
-
time:
|
|
68831
|
-
senderId:
|
|
68928
|
+
var import_joi142 = __toESM(require("joi"));
|
|
68929
|
+
var import_mongodb147 = require("mongodb");
|
|
68930
|
+
var schemaMessage = import_joi142.default.object({
|
|
68931
|
+
text: import_joi142.default.string().required(),
|
|
68932
|
+
date: import_joi142.default.date().optional().allow(null),
|
|
68933
|
+
time: import_joi142.default.string().optional().allow("", null),
|
|
68934
|
+
senderId: import_joi142.default.string().hex().length(24).required()
|
|
68832
68935
|
});
|
|
68833
|
-
var schemaUpdateChatPreloved =
|
|
68834
|
-
message:
|
|
68835
|
-
text:
|
|
68836
|
-
date:
|
|
68837
|
-
time:
|
|
68838
|
-
senderId:
|
|
68936
|
+
var schemaUpdateChatPreloved = import_joi142.default.object({
|
|
68937
|
+
message: import_joi142.default.object({
|
|
68938
|
+
text: import_joi142.default.string().required(),
|
|
68939
|
+
date: import_joi142.default.date().optional().allow(null),
|
|
68940
|
+
time: import_joi142.default.string().optional().allow("", null),
|
|
68941
|
+
senderId: import_joi142.default.string().hex().length(24).optional().allow("", null)
|
|
68839
68942
|
}).required(),
|
|
68840
|
-
reactions:
|
|
68943
|
+
reactions: import_joi142.default.string().optional().allow("", null)
|
|
68841
68944
|
});
|
|
68842
|
-
var schemaChatPreloved =
|
|
68843
|
-
channelId:
|
|
68844
|
-
receiverId:
|
|
68845
|
-
senderId:
|
|
68846
|
-
postId:
|
|
68945
|
+
var schemaChatPreloved = import_joi142.default.object({
|
|
68946
|
+
channelId: import_joi142.default.string().hex().length(24).optional().allow("", null),
|
|
68947
|
+
receiverId: import_joi142.default.string().hex().length(24).optional().allow("", null),
|
|
68948
|
+
senderId: import_joi142.default.string().hex().length(24).required(),
|
|
68949
|
+
postId: import_joi142.default.string().hex().length(24).optional().allow("", null),
|
|
68847
68950
|
message: schemaMessage.required(),
|
|
68848
|
-
readMessage:
|
|
68849
|
-
viewMessage:
|
|
68850
|
-
attachments:
|
|
68851
|
-
reactions:
|
|
68852
|
-
bidId:
|
|
68853
|
-
edited:
|
|
68951
|
+
readMessage: import_joi142.default.array().items(import_joi142.default.string().hex()).optional().default([]),
|
|
68952
|
+
viewMessage: import_joi142.default.array().items(import_joi142.default.string().hex()).optional().default([]),
|
|
68953
|
+
attachments: import_joi142.default.array().items(import_joi142.default.string().hex()).optional().default([]),
|
|
68954
|
+
reactions: import_joi142.default.string().optional().allow("", null).default(""),
|
|
68955
|
+
bidId: import_joi142.default.string().hex().length(24).optional().allow("", null),
|
|
68956
|
+
edited: import_joi142.default.boolean().optional().default(false)
|
|
68854
68957
|
});
|
|
68855
68958
|
function toObjectId21(value, label) {
|
|
68856
68959
|
if (typeof value === "string") {
|
|
68857
68960
|
try {
|
|
68858
|
-
return new
|
|
68961
|
+
return new import_mongodb147.ObjectId(value);
|
|
68859
68962
|
} catch {
|
|
68860
68963
|
throw new Error(`Invalid ${label}.`);
|
|
68861
68964
|
}
|
|
@@ -68887,7 +68990,7 @@ function MChatPreloved(value) {
|
|
|
68887
68990
|
value.attachments = value.attachments.map((id) => toObjectId21(id, "attachment ID"));
|
|
68888
68991
|
}
|
|
68889
68992
|
return {
|
|
68890
|
-
_id: new
|
|
68993
|
+
_id: new import_mongodb147.ObjectId(),
|
|
68891
68994
|
channelId: value.channelId ?? null,
|
|
68892
68995
|
senderId: value.senderId ?? "",
|
|
68893
68996
|
postId: value.postId ?? null,
|
|
@@ -68911,7 +69014,7 @@ function MChatPreloved(value) {
|
|
|
68911
69014
|
|
|
68912
69015
|
// src/repositories/chat-preloved.repo.ts
|
|
68913
69016
|
var import_node_server_utils247 = require("@7365admin1/node-server-utils");
|
|
68914
|
-
var
|
|
69017
|
+
var import_mongodb148 = require("mongodb");
|
|
68915
69018
|
function useChatPrelovedRepo() {
|
|
68916
69019
|
const db = import_node_server_utils247.useAtlas.getDb();
|
|
68917
69020
|
if (!db)
|
|
@@ -68942,7 +69045,7 @@ function useChatPrelovedRepo() {
|
|
|
68942
69045
|
async function updateById(_id, value) {
|
|
68943
69046
|
let objectId2;
|
|
68944
69047
|
try {
|
|
68945
|
-
objectId2 = new
|
|
69048
|
+
objectId2 = new import_mongodb148.ObjectId(_id);
|
|
68946
69049
|
} catch {
|
|
68947
69050
|
throw new import_node_server_utils247.BadRequestError("Invalid chat ID format.");
|
|
68948
69051
|
}
|
|
@@ -68959,7 +69062,7 @@ function useChatPrelovedRepo() {
|
|
|
68959
69062
|
async function deleteById(_id) {
|
|
68960
69063
|
let objectId2;
|
|
68961
69064
|
try {
|
|
68962
|
-
objectId2 = new
|
|
69065
|
+
objectId2 = new import_mongodb148.ObjectId(_id);
|
|
68963
69066
|
} catch {
|
|
68964
69067
|
throw new import_node_server_utils247.BadRequestError("Invalid chat ID format.");
|
|
68965
69068
|
}
|
|
@@ -68982,20 +69085,20 @@ var import_node_server_utils249 = require("@7365admin1/node-server-utils");
|
|
|
68982
69085
|
|
|
68983
69086
|
// src/repositories/channel-preloved.repo.ts
|
|
68984
69087
|
var import_node_server_utils248 = require("@7365admin1/node-server-utils");
|
|
68985
|
-
var
|
|
69088
|
+
var import_mongodb150 = require("mongodb");
|
|
68986
69089
|
|
|
68987
69090
|
// src/models/channel-preloved.model.ts
|
|
68988
|
-
var
|
|
68989
|
-
var
|
|
68990
|
-
var schemaChannelPreloved =
|
|
68991
|
-
receiverId:
|
|
68992
|
-
senderId:
|
|
68993
|
-
postId:
|
|
69091
|
+
var import_joi143 = __toESM(require("joi"));
|
|
69092
|
+
var import_mongodb149 = require("mongodb");
|
|
69093
|
+
var schemaChannelPreloved = import_joi143.default.object({
|
|
69094
|
+
receiverId: import_joi143.default.string().hex().length(24).required(),
|
|
69095
|
+
senderId: import_joi143.default.string().hex().length(24).required(),
|
|
69096
|
+
postId: import_joi143.default.string().hex().length(24).required()
|
|
68994
69097
|
});
|
|
68995
69098
|
function toObjectId22(value, label) {
|
|
68996
69099
|
if (typeof value === "string") {
|
|
68997
69100
|
try {
|
|
68998
|
-
return new
|
|
69101
|
+
return new import_mongodb149.ObjectId(value);
|
|
68999
69102
|
} catch {
|
|
69000
69103
|
throw new Error(`Invalid ${label}.`);
|
|
69001
69104
|
}
|
|
@@ -69013,7 +69116,7 @@ function MChannelPreloved(value) {
|
|
|
69013
69116
|
if (value.postId)
|
|
69014
69117
|
value.postId = toObjectId22(value.postId, "post ID");
|
|
69015
69118
|
return {
|
|
69016
|
-
_id: new
|
|
69119
|
+
_id: new import_mongodb149.ObjectId(),
|
|
69017
69120
|
name: `seven365-${(/* @__PURE__ */ new Date()).getTime()}`,
|
|
69018
69121
|
receiverId: value.receiverId,
|
|
69019
69122
|
senderId: value.senderId,
|
|
@@ -69059,9 +69162,9 @@ function useChannelPrelovedRepo() {
|
|
|
69059
69162
|
}
|
|
69060
69163
|
async function getByParticipants(senderId, receiverId, postId, session) {
|
|
69061
69164
|
const query = {
|
|
69062
|
-
senderId: new
|
|
69063
|
-
receiverId: new
|
|
69064
|
-
postId: new
|
|
69165
|
+
senderId: new import_mongodb150.ObjectId(senderId),
|
|
69166
|
+
receiverId: new import_mongodb150.ObjectId(receiverId),
|
|
69167
|
+
postId: new import_mongodb150.ObjectId(postId)
|
|
69065
69168
|
};
|
|
69066
69169
|
return collection.findOne(query, { session });
|
|
69067
69170
|
}
|
|
@@ -69070,11 +69173,11 @@ function useChannelPrelovedRepo() {
|
|
|
69070
69173
|
const normalizedPage = page > 0 ? page - 1 : 0;
|
|
69071
69174
|
const normalizedLimit = limit || 10;
|
|
69072
69175
|
const matchCriteria = {
|
|
69073
|
-
channelId: new
|
|
69176
|
+
channelId: new import_mongodb150.ObjectId(channelId),
|
|
69074
69177
|
deletedAt: null
|
|
69075
69178
|
};
|
|
69076
69179
|
if (isLoadMore && lastMessageId) {
|
|
69077
|
-
matchCriteria._id = { $lt: new
|
|
69180
|
+
matchCriteria._id = { $lt: new import_mongodb150.ObjectId(lastMessageId) };
|
|
69078
69181
|
}
|
|
69079
69182
|
try {
|
|
69080
69183
|
const result = await chatCollection.aggregate([
|
|
@@ -69146,7 +69249,7 @@ function useChannelPrelovedRepo() {
|
|
|
69146
69249
|
async function getChatLists(currentUserId, page = 1, limit = 10, search) {
|
|
69147
69250
|
const normalizedPage = page > 0 ? page - 1 : 0;
|
|
69148
69251
|
const normalizedLimit = limit || 10;
|
|
69149
|
-
const _currentUserId = new
|
|
69252
|
+
const _currentUserId = new import_mongodb150.ObjectId(currentUserId);
|
|
69150
69253
|
const escapedSearch = search ? search.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") : null;
|
|
69151
69254
|
const pipeline = [
|
|
69152
69255
|
{
|
|
@@ -69327,7 +69430,7 @@ function useChatPrelovedService() {
|
|
|
69327
69430
|
|
|
69328
69431
|
// src/controllers/chat-preloved.controller.ts
|
|
69329
69432
|
var import_node_server_utils250 = require("@7365admin1/node-server-utils");
|
|
69330
|
-
var
|
|
69433
|
+
var import_joi144 = __toESM(require("joi"));
|
|
69331
69434
|
function useChatPrelovedController() {
|
|
69332
69435
|
const { add: _add } = useChatPrelovedService();
|
|
69333
69436
|
const { updateById: _updateById, deleteById: _deleteById } = useChatPrelovedRepo();
|
|
@@ -69368,8 +69471,8 @@ function useChatPrelovedController() {
|
|
|
69368
69471
|
}
|
|
69369
69472
|
}
|
|
69370
69473
|
async function deleteById(req, res, next) {
|
|
69371
|
-
const schema2 =
|
|
69372
|
-
_id:
|
|
69474
|
+
const schema2 = import_joi144.default.object({
|
|
69475
|
+
_id: import_joi144.default.string().hex().length(24).required()
|
|
69373
69476
|
});
|
|
69374
69477
|
const { error, value } = schema2.validate({ _id: req.params.id });
|
|
69375
69478
|
if (error) {
|
|
@@ -69389,38 +69492,38 @@ function useChatPrelovedController() {
|
|
|
69389
69492
|
}
|
|
69390
69493
|
|
|
69391
69494
|
// src/events/chat-preloved.event.ts
|
|
69392
|
-
var
|
|
69495
|
+
var import_joi145 = __toESM(require("joi"));
|
|
69393
69496
|
var import_node_server_utils251 = require("@7365admin1/node-server-utils");
|
|
69394
69497
|
function parseSid(cookieHeader) {
|
|
69395
69498
|
const match = cookieHeader.match(/(?:^|;\s*)sid=([^;]*)/);
|
|
69396
69499
|
return match ? decodeURIComponent(match[1]) : null;
|
|
69397
69500
|
}
|
|
69398
|
-
var schemaSendMessage =
|
|
69399
|
-
receiverId:
|
|
69400
|
-
channelId:
|
|
69401
|
-
senderId:
|
|
69402
|
-
postId:
|
|
69403
|
-
message:
|
|
69404
|
-
text:
|
|
69405
|
-
date:
|
|
69406
|
-
time:
|
|
69407
|
-
senderId:
|
|
69501
|
+
var schemaSendMessage = import_joi145.default.object({
|
|
69502
|
+
receiverId: import_joi145.default.string().hex().length(24).required(),
|
|
69503
|
+
channelId: import_joi145.default.string().hex().length(24).optional().allow("", null),
|
|
69504
|
+
senderId: import_joi145.default.string().hex().length(24).required(),
|
|
69505
|
+
postId: import_joi145.default.string().hex().length(24).optional().allow("", null),
|
|
69506
|
+
message: import_joi145.default.object({
|
|
69507
|
+
text: import_joi145.default.string().required(),
|
|
69508
|
+
date: import_joi145.default.date().optional().allow(null),
|
|
69509
|
+
time: import_joi145.default.string().optional().allow("", null),
|
|
69510
|
+
senderId: import_joi145.default.string().hex().length(24).required()
|
|
69408
69511
|
}).required(),
|
|
69409
|
-
readMessage:
|
|
69410
|
-
viewMessage:
|
|
69411
|
-
attachments:
|
|
69412
|
-
reactions:
|
|
69413
|
-
bidId:
|
|
69414
|
-
edited:
|
|
69512
|
+
readMessage: import_joi145.default.array().items(import_joi145.default.string().hex()).optional().default([]),
|
|
69513
|
+
viewMessage: import_joi145.default.array().items(import_joi145.default.string().hex()).optional().default([]),
|
|
69514
|
+
attachments: import_joi145.default.array().items(import_joi145.default.string().hex()).optional().default([]),
|
|
69515
|
+
reactions: import_joi145.default.string().optional().allow("", null).default(""),
|
|
69516
|
+
bidId: import_joi145.default.string().hex().length(24).optional().allow("", null),
|
|
69517
|
+
edited: import_joi145.default.boolean().optional().default(false)
|
|
69415
69518
|
});
|
|
69416
|
-
var schemaTyping =
|
|
69417
|
-
receiverId:
|
|
69418
|
-
fromUserId:
|
|
69419
|
-
senderName:
|
|
69519
|
+
var schemaTyping = import_joi145.default.object({
|
|
69520
|
+
receiverId: import_joi145.default.string().hex().length(24).required(),
|
|
69521
|
+
fromUserId: import_joi145.default.string().hex().length(24).required(),
|
|
69522
|
+
senderName: import_joi145.default.string().required()
|
|
69420
69523
|
});
|
|
69421
|
-
var schemaChatMessageDeleted =
|
|
69422
|
-
messageId:
|
|
69423
|
-
receiverId:
|
|
69524
|
+
var schemaChatMessageDeleted = import_joi145.default.object({
|
|
69525
|
+
messageId: import_joi145.default.string().hex().length(24).required(),
|
|
69526
|
+
receiverId: import_joi145.default.string().hex().length(24).required()
|
|
69424
69527
|
});
|
|
69425
69528
|
function chatPrelovedEvents(io) {
|
|
69426
69529
|
const namespace2 = io.of(/^\/chat-channel-[0-9a-fA-F]{24}$/);
|
|
@@ -69493,7 +69596,7 @@ function chatPrelovedEvents(io) {
|
|
|
69493
69596
|
|
|
69494
69597
|
// src/controllers/channel-preloved.controller.ts
|
|
69495
69598
|
var import_node_server_utils252 = require("@7365admin1/node-server-utils");
|
|
69496
|
-
var
|
|
69599
|
+
var import_joi146 = __toESM(require("joi"));
|
|
69497
69600
|
function useChannelPrelovedController() {
|
|
69498
69601
|
const {
|
|
69499
69602
|
add: _add,
|
|
@@ -69520,14 +69623,14 @@ function useChannelPrelovedController() {
|
|
|
69520
69623
|
}
|
|
69521
69624
|
}
|
|
69522
69625
|
async function getChannelMessages(req, res, next) {
|
|
69523
|
-
const paramsSchema =
|
|
69524
|
-
id:
|
|
69626
|
+
const paramsSchema = import_joi146.default.object({
|
|
69627
|
+
id: import_joi146.default.string().hex().length(24).required()
|
|
69525
69628
|
});
|
|
69526
|
-
const querySchema =
|
|
69527
|
-
page:
|
|
69528
|
-
limit:
|
|
69529
|
-
isLoadMore:
|
|
69530
|
-
lastMessageId:
|
|
69629
|
+
const querySchema = import_joi146.default.object({
|
|
69630
|
+
page: import_joi146.default.number().integer().min(1).default(1),
|
|
69631
|
+
limit: import_joi146.default.number().integer().min(1).max(100).default(10),
|
|
69632
|
+
isLoadMore: import_joi146.default.boolean().default(false),
|
|
69633
|
+
lastMessageId: import_joi146.default.string().hex().length(24).optional().allow("", null)
|
|
69531
69634
|
});
|
|
69532
69635
|
const { error: paramError, value: params } = paramsSchema.validate(
|
|
69533
69636
|
req.params
|
|
@@ -69558,10 +69661,10 @@ function useChannelPrelovedController() {
|
|
|
69558
69661
|
}
|
|
69559
69662
|
}
|
|
69560
69663
|
async function getChannel(req, res, next) {
|
|
69561
|
-
const querySchema =
|
|
69562
|
-
postId:
|
|
69563
|
-
receiverId:
|
|
69564
|
-
senderId:
|
|
69664
|
+
const querySchema = import_joi146.default.object({
|
|
69665
|
+
postId: import_joi146.default.string().hex().length(24).required(),
|
|
69666
|
+
receiverId: import_joi146.default.string().hex().length(24).required(),
|
|
69667
|
+
senderId: import_joi146.default.string().hex().length(24).required()
|
|
69565
69668
|
});
|
|
69566
69669
|
const { error, value } = querySchema.validate(req.query);
|
|
69567
69670
|
if (error) {
|
|
@@ -69582,11 +69685,11 @@ function useChannelPrelovedController() {
|
|
|
69582
69685
|
}
|
|
69583
69686
|
}
|
|
69584
69687
|
async function getChatLists(req, res, next) {
|
|
69585
|
-
const querySchema =
|
|
69586
|
-
currentUserId:
|
|
69587
|
-
page:
|
|
69588
|
-
limit:
|
|
69589
|
-
search:
|
|
69688
|
+
const querySchema = import_joi146.default.object({
|
|
69689
|
+
currentUserId: import_joi146.default.string().hex().length(24).required(),
|
|
69690
|
+
page: import_joi146.default.number().integer().min(1).default(1),
|
|
69691
|
+
limit: import_joi146.default.number().integer().min(1).max(100).default(10),
|
|
69692
|
+
search: import_joi146.default.string().optional().allow("", null)
|
|
69590
69693
|
});
|
|
69591
69694
|
const { error, value } = querySchema.validate(req.query);
|
|
69592
69695
|
if (error) {
|
|
@@ -69610,58 +69713,6 @@ function useChannelPrelovedController() {
|
|
|
69610
69713
|
return { add, getChannel, getChatLists, getChannelMessages };
|
|
69611
69714
|
}
|
|
69612
69715
|
|
|
69613
|
-
// src/models/bid-preloved.model.ts
|
|
69614
|
-
var import_joi146 = __toESM(require("joi"));
|
|
69615
|
-
var import_mongodb150 = require("mongodb");
|
|
69616
|
-
var BidType = /* @__PURE__ */ ((BidType2) => {
|
|
69617
|
-
BidType2["BID"] = "bid";
|
|
69618
|
-
BidType2["RESERVE"] = "reserve";
|
|
69619
|
-
return BidType2;
|
|
69620
|
-
})(BidType || {});
|
|
69621
|
-
var BidStatus = /* @__PURE__ */ ((BidStatus3) => {
|
|
69622
|
-
BidStatus3["PENDING"] = "pending";
|
|
69623
|
-
BidStatus3["SOLD"] = "sold";
|
|
69624
|
-
BidStatus3["RESERVED"] = "reserved";
|
|
69625
|
-
BidStatus3["CANCELLED"] = "cancelled";
|
|
69626
|
-
return BidStatus3;
|
|
69627
|
-
})(BidStatus || {});
|
|
69628
|
-
var schemaBidPreloved = import_joi146.default.object({
|
|
69629
|
-
type: import_joi146.default.string().valid(...Object.values(BidType)).required(),
|
|
69630
|
-
postId: import_joi146.default.string().hex().length(24).required(),
|
|
69631
|
-
receiverId: import_joi146.default.string().hex().length(24).required(),
|
|
69632
|
-
buyerId: import_joi146.default.string().hex().length(24).required(),
|
|
69633
|
-
price: import_joi146.default.when("type", {
|
|
69634
|
-
is: "bid" /* BID */,
|
|
69635
|
-
then: import_joi146.default.number().required(),
|
|
69636
|
-
otherwise: import_joi146.default.number().optional().allow(null)
|
|
69637
|
-
}),
|
|
69638
|
-
message: import_joi146.default.string().optional().allow("", null),
|
|
69639
|
-
status: import_joi146.default.string().valid(...Object.values(BidStatus)).optional().default("pending" /* PENDING */)
|
|
69640
|
-
});
|
|
69641
|
-
var schemaUpdateBidPreloved = import_joi146.default.object({
|
|
69642
|
-
status: import_joi146.default.string().valid(...Object.values(BidStatus)).required()
|
|
69643
|
-
});
|
|
69644
|
-
function MBidPreloved(value) {
|
|
69645
|
-
const { error } = schemaBidPreloved.validate(value);
|
|
69646
|
-
if (error)
|
|
69647
|
-
throw new Error(error.details[0].message);
|
|
69648
|
-
if (value.postId && typeof value.postId === "string")
|
|
69649
|
-
value.postId = new import_mongodb150.ObjectId(value.postId);
|
|
69650
|
-
if (value.buyerId && typeof value.buyerId === "string")
|
|
69651
|
-
value.buyerId = new import_mongodb150.ObjectId(value.buyerId);
|
|
69652
|
-
return {
|
|
69653
|
-
_id: new import_mongodb150.ObjectId(),
|
|
69654
|
-
price: value.price ?? null,
|
|
69655
|
-
message: value.message ?? "",
|
|
69656
|
-
status: value.status ?? "pending" /* PENDING */,
|
|
69657
|
-
type: value.type,
|
|
69658
|
-
postId: value.postId,
|
|
69659
|
-
buyerId: value.buyerId ?? null,
|
|
69660
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
69661
|
-
updatedAt: null
|
|
69662
|
-
};
|
|
69663
|
-
}
|
|
69664
|
-
|
|
69665
69716
|
// src/repositories/bid-preloved.repo.ts
|
|
69666
69717
|
var import_node_server_utils253 = require("@7365admin1/node-server-utils");
|
|
69667
69718
|
var import_mongodb151 = require("mongodb");
|