@infuro/cms-core 1.0.42 → 1.0.43
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/admin.cjs +57 -17
- package/dist/admin.d.cts +3 -1
- package/dist/admin.d.ts +3 -1
- package/dist/admin.js +57 -17
- package/dist/api.cjs +32 -32
- package/dist/api.js +1 -1
- package/dist/{chunk-W2NL365N.js → chunk-IX7X4ILO.js} +66 -33
- package/dist/{chunk-GINYYPXK.cjs → chunk-SCPKMZG5.cjs} +66 -33
- package/dist/index.cjs +201 -201
- package/dist/index.js +2 -2
- package/package.json +1 -1
|
@@ -8635,6 +8635,12 @@ function createUploadHandler(config) {
|
|
|
8635
8635
|
parentId
|
|
8636
8636
|
});
|
|
8637
8637
|
} catch (err) {
|
|
8638
|
+
console.error("[upload] File upload failed", {
|
|
8639
|
+
error: err instanceof Error ? err.message : String(err),
|
|
8640
|
+
stack: err instanceof Error ? err.stack : void 0,
|
|
8641
|
+
name: err instanceof Error ? err.name : void 0,
|
|
8642
|
+
metadata: err && typeof err === "object" && "$metadata" in err ? err.$metadata : void 0
|
|
8643
|
+
});
|
|
8638
8644
|
return json({
|
|
8639
8645
|
error: "File upload failed"
|
|
8640
8646
|
}, {
|
|
@@ -9340,41 +9346,68 @@ function createUsersApiHandlers(config) {
|
|
|
9340
9346
|
const page = Math.max(1, parseInt(url.searchParams.get("page") || "1", 10));
|
|
9341
9347
|
const limit = Math.min(100, parseInt(url.searchParams.get("limit") || "10", 10));
|
|
9342
9348
|
const skip = (page - 1) * limit;
|
|
9343
|
-
const
|
|
9349
|
+
const sortFieldRaw = url.searchParams.get("sortField") || "createdAt";
|
|
9350
|
+
const allowedSort = /* @__PURE__ */ new Set([
|
|
9351
|
+
"createdAt",
|
|
9352
|
+
"updatedAt",
|
|
9353
|
+
"name",
|
|
9354
|
+
"email",
|
|
9355
|
+
"id",
|
|
9356
|
+
"blocked"
|
|
9357
|
+
]);
|
|
9358
|
+
const sortField = allowedSort.has(sortFieldRaw) ? sortFieldRaw : "createdAt";
|
|
9344
9359
|
const sortOrder = url.searchParams.get("sortOrder") === "desc" ? "DESC" : "ASC";
|
|
9345
|
-
const search = url.searchParams.get("search");
|
|
9346
|
-
const
|
|
9347
|
-
|
|
9348
|
-
name: typeorm.ILike(`%${search}%`),
|
|
9349
|
-
deleted: false
|
|
9350
|
-
},
|
|
9351
|
-
{
|
|
9352
|
-
email: typeorm.ILike(`%${search}%`),
|
|
9353
|
-
deleted: false
|
|
9354
|
-
}
|
|
9355
|
-
] : {
|
|
9360
|
+
const search = url.searchParams.get("search")?.trim() || "";
|
|
9361
|
+
const groupName = url.searchParams.get("groupName")?.trim() || "";
|
|
9362
|
+
const qb = userRepo().createQueryBuilder("u").leftJoinAndSelect("u.group", "g").where("u.deleted = :deleted", {
|
|
9356
9363
|
deleted: false
|
|
9357
|
-
}
|
|
9358
|
-
|
|
9359
|
-
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
|
|
9365
|
-
|
|
9366
|
-
|
|
9367
|
-
|
|
9368
|
-
|
|
9369
|
-
|
|
9370
|
-
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
|
-
|
|
9364
|
+
}).orderBy(`u.${sortField}`, sortOrder).skip(skip).take(limit).select([
|
|
9365
|
+
"u.id",
|
|
9366
|
+
"u.name",
|
|
9367
|
+
"u.email",
|
|
9368
|
+
"u.blocked",
|
|
9369
|
+
"u.createdAt",
|
|
9370
|
+
"u.updatedAt",
|
|
9371
|
+
"u.groupId",
|
|
9372
|
+
"g.id",
|
|
9373
|
+
"g.name"
|
|
9374
|
+
]);
|
|
9375
|
+
if (search) {
|
|
9376
|
+
qb.andWhere("(u.name ILIKE :search OR u.email ILIKE :search)", {
|
|
9377
|
+
search: `%${search}%`
|
|
9378
|
+
});
|
|
9379
|
+
}
|
|
9380
|
+
if (groupName) {
|
|
9381
|
+
if (!entityMap.user_groups) {
|
|
9382
|
+
return json({
|
|
9383
|
+
total: 0,
|
|
9384
|
+
page,
|
|
9385
|
+
limit,
|
|
9386
|
+
totalPages: 0,
|
|
9387
|
+
data: []
|
|
9388
|
+
});
|
|
9389
|
+
}
|
|
9390
|
+
const groupRepo = dataSource.getRepository(entityMap.user_groups);
|
|
9391
|
+
const group = await groupRepo.findOne({
|
|
9392
|
+
where: {
|
|
9393
|
+
name: groupName,
|
|
9394
|
+
deleted: false
|
|
9395
|
+
}
|
|
9396
|
+
});
|
|
9397
|
+
if (!group) {
|
|
9398
|
+
return json({
|
|
9399
|
+
total: 0,
|
|
9400
|
+
page,
|
|
9401
|
+
limit,
|
|
9402
|
+
totalPages: 0,
|
|
9403
|
+
data: []
|
|
9404
|
+
});
|
|
9405
|
+
}
|
|
9406
|
+
qb.andWhere("u.groupId = :groupId", {
|
|
9407
|
+
groupId: Number(group.id)
|
|
9408
|
+
});
|
|
9409
|
+
}
|
|
9410
|
+
const [data, total] = await qb.getManyAndCount();
|
|
9378
9411
|
return json({
|
|
9379
9412
|
total,
|
|
9380
9413
|
page,
|