mirror of
https://github.com/tiennm99/store-scraper-bot.git
synced 2026-10-12 20:15:58 +00:00
Node.js 20+ ESM port mirroring Java/Go implementations. - 13 Telegram commands matching Java identifiers - MongoDB schema parity (common, group, apple_app, google_app collections) - Apple/Google scrapers calling store-scraper.vercel.app with 10-min cache - Daily 7am Vietnam-time cron with weekend-silent mode - HTML table renderer matching Java/Go output - Docker + Compose (prod and dev) Untested end-to-end against live Telegram or upstream API.
24 lines
603 B
JavaScript
24 lines
603 B
JavaScript
// Admin singleton document — Java parity (_id="admin", class="Admin").
|
|
export const ADMIN_ID = 'admin';
|
|
|
|
export function newAdmin() {
|
|
return { _id: ADMIN_ID, class: 'Admin', groups: [] };
|
|
}
|
|
|
|
export function adminAddGroup(admin, groupId) {
|
|
if (admin.groups.includes(groupId)) return false;
|
|
admin.groups.push(groupId);
|
|
return true;
|
|
}
|
|
|
|
export function adminRemoveGroup(admin, groupId) {
|
|
const i = admin.groups.indexOf(groupId);
|
|
if (i < 0) return false;
|
|
admin.groups.splice(i, 1);
|
|
return true;
|
|
}
|
|
|
|
export function adminHasGroup(admin, groupId) {
|
|
return admin.groups.includes(groupId);
|
|
}
|