diff --git a/src/database/entities/app/User.ts b/src/database/entities/app/User.ts new file mode 100644 index 0000000..31d5ea1 --- /dev/null +++ b/src/database/entities/app/User.ts @@ -0,0 +1,31 @@ +import { Column, Entity } from "typeorm"; +import AppBaseEntity from "../../../contracts/AppBaseEntity"; +import AppDataSource from "../../dataSources/appDataSource"; + +@Entity() +export default class User extends AppBaseEntity { + constructor(userId: string, currency: number) { + super(); + + this.UserId = userId; + this.Currency = currency; + } + + @Column() + UserId: string; + + @Column() + Currency: number; + + public UpdateCurrency(currency: number) { + this.Currency = currency; + } + + public static async FetchOneByUserId(userId: string): Promise { + const repository = AppDataSource.getRepository(User); + + const single = await repository.findOne({ where: { UserId: userId }}); + + return single; + } +} \ No newline at end of file