docs: add JSDoc to service public methods
One-line JSDoc on 82 methods across 11 service files for quick scanning without reading full implementations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import { UserError } from "@shared/lib/errors";
|
||||
import { TimerKey, TimerType, TransactionType } from "@shared/lib/constants";
|
||||
|
||||
export const economyService = {
|
||||
/** Transfer currency between two users; validates sufficient balance and creates transaction records for both sides. */
|
||||
transfer: async (fromUserId: string, toUserId: string, amount: bigint, tx?: Transaction) => {
|
||||
if (amount <= 0n) {
|
||||
throw new UserError("Amount must be positive");
|
||||
@@ -69,6 +70,7 @@ export const economyService = {
|
||||
}, tx);
|
||||
},
|
||||
|
||||
/** Claim the daily reward, applying streak bonuses and weekly bonuses; enforces a UTC-midnight cooldown. */
|
||||
claimDaily: async (userId: string, tx?: Transaction) => {
|
||||
return await withTransaction(async (txFn) => {
|
||||
const now = new Date();
|
||||
@@ -164,6 +166,7 @@ export const economyService = {
|
||||
}, tx);
|
||||
},
|
||||
|
||||
/** Adjust a user's balance by the given amount and log a transaction; throws if deduction exceeds current balance. */
|
||||
modifyUserBalance: async (id: string, amount: bigint, type: string, description: string, relatedUserId?: string | null, tx?: Transaction) => {
|
||||
return await withTransaction(async (txFn) => {
|
||||
if (amount < 0n) {
|
||||
|
||||
Reference in New Issue
Block a user