diff --git a/src/database/entities/app/User.ts b/src/database/entities/app/User.ts index a909552..cf13160 100644 --- a/src/database/entities/app/User.ts +++ b/src/database/entities/app/User.ts @@ -17,6 +17,10 @@ export default class User extends AppBaseEntity { this.Currency += amount; } + public AddCurrency(amount: number) { + this.Currency += amount; + } + public RemoveCurrency(amount: number): boolean { if (this.Currency < amount) return false; diff --git a/src/helpers/TimerHelper.ts b/src/helpers/TimerHelper.ts index 535a6a7..c5b1071 100644 --- a/src/helpers/TimerHelper.ts +++ b/src/helpers/TimerHelper.ts @@ -1,12 +1,11 @@ import { CronJob } from "cron"; import { v4 } from "uuid"; -import { Primitive } from "../type/primitive"; interface Timer { id: string; job: CronJob; - context: Map; - onTick: ((context: Map) => void) | ((context: Map) => Promise); + context: Map; + onTick: ((context: Map) => void) | ((context: Map) => Promise); runOnStart: boolean; } @@ -20,9 +19,9 @@ export default class TimerHelper { public AddTimer( cronTime: string, timeZone: string, - onTick: ((context: Map) => void) | ((context: Map) => Promise), + onTick: ((context: Map) => void) | ((context: Map) => Promise), runOnStart: boolean = false): string { - const context = new Map(); + const context = new Map(); const job = new CronJob( cronTime, diff --git a/src/timers/GiveCurrency.ts b/src/timers/GiveCurrency.ts index ad1a21a..9a0d28a 100644 --- a/src/timers/GiveCurrency.ts +++ b/src/timers/GiveCurrency.ts @@ -1,7 +1,7 @@ import AppLogger from "../client/appLogger"; import User from "../database/entities/app/User"; -export default async function GiveCurrency() { +export default async function GiveCurrency(context: Map) { AppLogger.LogInfo("Timers/GiveCurrency", "Giving currency to every known user"); const users = await User.FetchAll(User); diff --git a/src/type/primitive.ts b/src/type/primitive.ts deleted file mode 100644 index b1e143b..0000000 --- a/src/type/primitive.ts +++ /dev/null @@ -1 +0,0 @@ -export type Primitive = string | number | boolean; \ No newline at end of file