@astralibx/email-account-manager 10.2.0 → 10.4.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/README.md +20 -0
- package/dist/index.cjs +10 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +10 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2253,8 +2253,16 @@ function createAccountController(EmailAccount, capacityManager, healthTracker, w
|
|
|
2253
2253
|
return {
|
|
2254
2254
|
async list(req, res) {
|
|
2255
2255
|
try {
|
|
2256
|
-
const
|
|
2257
|
-
|
|
2256
|
+
const { status, provider, page, limit } = req.query;
|
|
2257
|
+
const filter = {};
|
|
2258
|
+
if (status) filter.status = status;
|
|
2259
|
+
if (provider) filter.provider = provider;
|
|
2260
|
+
const pageNum = Number(page) || 1;
|
|
2261
|
+
const limitNum = Number(limit) || 20;
|
|
2262
|
+
const skip = (pageNum - 1) * limitNum;
|
|
2263
|
+
const total = await EmailAccount.countDocuments(filter);
|
|
2264
|
+
const accounts = await EmailAccount.find(filter).select("-smtp.pass -imap.pass").sort({ createdAt: -1 }).skip(skip).limit(limitNum);
|
|
2265
|
+
res.json({ success: true, data: { accounts, total } });
|
|
2258
2266
|
} catch (error) {
|
|
2259
2267
|
const message = error instanceof Error ? error.message : "Unknown error";
|
|
2260
2268
|
res.status(500).json({ success: false, error: message });
|