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 moment from "moment-timezone";
|
||||
import { getRepository, Repository } from "typeorm";
|
||||
import { Repository } from "typeorm";
|
||||
import { DBDateFormat } from "../utils";
|
||||
import { ApiPermissionTypes } from "./ApiPermissionAssignments";
|
||||
import { BaseRepository } from "./BaseRepository";
|
||||
import { dataSource } from "./dataSource";
|
||||
import { AllowedGuild } from "./entities/AllowedGuild";
|
||||
|
||||
export class AllowedGuilds extends BaseRepository {
|
||||
|
@ -10,10 +11,10 @@ export class AllowedGuilds extends BaseRepository {
|
|||
|
||||
constructor() {
|
||||
super();
|
||||
this.allowedGuilds = getRepository(AllowedGuild);
|
||||
this.allowedGuilds = dataSource.getRepository(AllowedGuild);
|
||||
}
|
||||
|
||||
async isAllowed(guildId) {
|
||||
async isAllowed(guildId: string) {
|
||||
const count = await this.allowedGuilds.count({
|
||||
where: {
|
||||
id: guildId,
|
||||
|
@ -22,11 +23,15 @@ export class AllowedGuilds extends BaseRepository {
|
|||
return count !== 0;
|
||||
}
|
||||
|
||||
find(guildId) {
|
||||
return this.allowedGuilds.findOne(guildId);
|
||||
find(guildId: string) {
|
||||
return this.allowedGuilds.findOne({
|
||||
where: {
|
||||
id: guildId,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
getForApiUser(userId) {
|
||||
getForApiUser(userId: string) {
|
||||
return this.allowedGuilds
|
||||
.createQueryBuilder("allowed_guilds")
|
||||
.innerJoin(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue