Files
chat/config/list-balances.js
Hanzo Dev ba0eb6f2d2 fork: rename internal workspace packages to @hanzochat scope
librechat-data-provider  → @hanzochat/data-provider
@librechat/data-schemas  → @hanzochat/data-schemas
@librechat/client        → @hanzochat/client
(@hanzochat/api already forked; external @librechat/agents fork follows)

All imports, package.json names/deps, tsconfig path aliases, jest
moduleNameMapper, and rollup/vite build aliases updated. The data-provider
react-query subpath resolves via the exports map. Lockfiles regenerated in a
follow-on once the canonical package manager is confirmed.
2026-07-14 05:55:49 -07:00

41 lines
1.1 KiB
JavaScript

const path = require('path');
const mongoose = require('mongoose');
const { User, Balance } = require('@hanzochat/data-schemas').createModels(mongoose);
require('module-alias')({ base: path.resolve(__dirname, '..', 'api') });
const { silentExit } = require('./helpers');
const connect = require('./connect');
(async () => {
await connect();
/**
* Show the welcome / help menu
*/
console.purple('-----------------------------');
console.purple('Show the balance of all users');
console.purple('-----------------------------');
let users = await User.find({});
for (const user of users) {
let balance = await Balance.findOne({ user: user._id });
if (balance !== null) {
console.green(`User ${user.name} (${user.email}) has a balance of ${balance.tokenCredits}`);
} else {
console.yellow(`User ${user.name} (${user.email}) has no balance`);
}
}
silentExit(0);
})();
process.on('uncaughtException', (err) => {
if (!err.message.includes('fetch failed')) {
console.error('There was an uncaught error:');
console.error(err);
}
if (!err.message.includes('fetch failed')) {
process.exit(1);
}
});