Compare commits
No commits in common. "6c2233790ec8a7b55675aa203e63e4d94a2cd58c" and "bcbd0855b8e80dcb07851f531d01a812dc8503fb" have entirely different histories.
6c2233790e
...
bcbd0855b8
3 changed files with 0 additions and 54 deletions
|
@ -1,8 +0,0 @@
|
||||||
CREATE TABLE `user` (
|
|
||||||
`Id` varchar(255) NOT NULL,
|
|
||||||
`WhenCreated` datetime NOT NULL,
|
|
||||||
`WhenUpdated` datetime NOT NULL,
|
|
||||||
`UserId` varchar(255) NOT NULL,
|
|
||||||
`Currency` int NOT NULL,
|
|
||||||
PRIMARY KEY (`Id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
|
|
@ -1,31 +0,0 @@
|
||||||
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<User | null> {
|
|
||||||
const repository = AppDataSource.getRepository(User);
|
|
||||||
|
|
||||||
const single = await repository.findOne({ where: { UserId: userId }});
|
|
||||||
|
|
||||||
return single;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
||||||
import MigrationHelper from "../../../../helpers/MigrationHelper";
|
|
||||||
|
|
||||||
export class User1713289062969 implements MigrationInterface {
|
|
||||||
|
|
||||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
||||||
MigrationHelper.Up("1713289062969-user", "0.6", [
|
|
||||||
"01-table/User",
|
|
||||||
], queryRunner);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async down(): Promise<void> {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in a new issue