mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-07-07 19:17:19 +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,12 +1,13 @@
|
|||
import { Guild, Snowflake } from "discord.js";
|
||||
import moment from "moment-timezone";
|
||||
import { isDefaultSticker } from "src/utils/isDefaultSticker";
|
||||
import { Repository, getRepository } from "typeorm";
|
||||
import { Repository } from "typeorm";
|
||||
import { TemplateSafeValueContainer, renderTemplate } from "../templateFormatter";
|
||||
import { renderUsername, trimLines } from "../utils";
|
||||
import { decrypt, encrypt } from "../utils/crypt";
|
||||
import { channelToTemplateSafeChannel, guildToTemplateSafeGuild } from "../utils/templateSafeObjects";
|
||||
import { BaseGuildRepository } from "./BaseGuildRepository";
|
||||
import { dataSource } from "./dataSource";
|
||||
import { ArchiveEntry } from "./entities/ArchiveEntry";
|
||||
import { SavedMessage } from "./entities/SavedMessage";
|
||||
|
||||
|
@ -23,7 +24,7 @@ export class GuildArchives extends BaseGuildRepository<ArchiveEntry> {
|
|||
|
||||
constructor(guildId) {
|
||||
super(guildId);
|
||||
this.archives = getRepository(ArchiveEntry);
|
||||
this.archives = dataSource.getRepository(ArchiveEntry);
|
||||
}
|
||||
|
||||
protected async _processEntityFromDB(entity: ArchiveEntry | undefined) {
|
||||
|
@ -42,7 +43,7 @@ export class GuildArchives extends BaseGuildRepository<ArchiveEntry> {
|
|||
return entity;
|
||||
}
|
||||
|
||||
async find(id: string): Promise<ArchiveEntry | undefined> {
|
||||
async find(id: string): Promise<ArchiveEntry | null> {
|
||||
const result = await this.archives.findOne({
|
||||
where: { id },
|
||||
relations: this.getRelations(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue