MC/website/node/bounty-quest-evidence.mjs
2026-11-27 23:43:05 +00:00

7 lines
798 B
JavaScript

import {meatTurninEvent as nativeNameEvent} from './fremen-meat-turnin.mjs';
export const bountyEvent=(kind,source)=>nativeNameEvent(kind,source);
export const bountyReference=(kind,source)=>'bounty:'+kind+':'+source.toLowerCase();
export async function hasAcceptedBountyReceipt(db,accountId,minecraftUuid,seasonId,source){
const id=bountyEvent('bounty_accept',source),reference=bountyReference('bounty_accept',source);
const rows=await db.query("SELECT e.key_id FROM jarvis_pol_activity_events e JOIN organisation_keys k ON k.id=e.key_id WHERE e.event_id=? AND e.account_id=? AND e.minecraft_uuid=? AND e.season_id=? AND e.metric='pol-bounty-accepted' AND e.source_reference=? AND e.quantity=1 AND k.revoked_at IS NULL",[id,accountId,minecraftUuid,seasonId,reference]);return rows.length===1;
}