mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-07-06 18:47:20 +00:00
feat: upgrade to TypeORM 0.3
This commit is contained in:
parent
8cee4ec1e4
commit
761ff27771
57 changed files with 412 additions and 325 deletions
|
@ -1,8 +1,9 @@
|
|||
import { getRepository, In, Repository } from "typeorm";
|
||||
import { In, Repository } from "typeorm";
|
||||
import { isAPI } from "../globals";
|
||||
import { MINUTES, SECONDS } from "../utils";
|
||||
import { BaseRepository } from "./BaseRepository";
|
||||
import { cleanupUsernames } from "./cleanup/usernames";
|
||||
import { dataSource } from "./dataSource";
|
||||
import { UsernameHistoryEntry } from "./entities/UsernameHistoryEntry";
|
||||
|
||||
const CLEANUP_INTERVAL = 5 * MINUTES;
|
||||
|
@ -25,7 +26,7 @@ export class UsernameHistory extends BaseRepository {
|
|||
|
||||
constructor() {
|
||||
super();
|
||||
this.usernameHistory = getRepository(UsernameHistoryEntry);
|
||||
this.usernameHistory = dataSource.getRepository(UsernameHistoryEntry);
|
||||
}
|
||||
|
||||
async getByUserId(userId): Promise<UsernameHistoryEntry[]> {
|
||||
|
@ -40,7 +41,7 @@ export class UsernameHistory extends BaseRepository {
|
|||
});
|
||||
}
|
||||
|
||||
getLastEntry(userId): Promise<UsernameHistoryEntry | undefined> {
|
||||
getLastEntry(userId): Promise<UsernameHistoryEntry | null> {
|
||||
return this.usernameHistory.findOne({
|
||||
where: {
|
||||
user_id: userId,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue