card-drop/src/database/entities/app/User.ts
Ethan Lane c1ca37283c
All checks were successful
Test / build (push) Successful in 2m29s
Add give currency timer
2024-05-06 17:09:59 +01:00

27 lines
No EOL
590 B
TypeScript

import { Column, Entity } from "typeorm";
import AppBaseEntity from "../../../contracts/AppBaseEntity";
@Entity()
export default class User extends AppBaseEntity {
constructor(userId: string, currency: number) {
super();
this.Id = userId;
this.Currency = currency;
}
@Column()
Currency: number;
public AddCurrency(amount: number) {
this.Currency += amount;
}
public RemoveCurrency(amount: number): boolean {
if (this.Currency < amount) return false;
this.Currency -= amount;
return true;
}
}