3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25:02 +00:00

feat: upgrade to TypeORM 0.3

This commit is contained in:
Dragory 2023-07-01 12:17:45 +00:00
parent 8cee4ec1e4
commit 761ff27771
No known key found for this signature in database
57 changed files with 412 additions and 325 deletions

View file

@ -1,8 +1,8 @@
import moment from "moment-timezone";
import { getRepository, Repository } from "typeorm";
import { Repository } from "typeorm";
import { DBDateFormat } from "../utils";
import { BaseRepository } from "./BaseRepository";
import { connection } from "./db";
import { dataSource } from "./dataSource";
import { ApiUserInfoData, ApiUserInfo as ApiUserInfoEntity } from "./entities/ApiUserInfo";
export class ApiUserInfo extends BaseRepository {
@ -10,7 +10,7 @@ export class ApiUserInfo extends BaseRepository {
constructor() {
super();
this.apiUserInfo = getRepository(ApiUserInfoEntity);
this.apiUserInfo = dataSource.getRepository(ApiUserInfoEntity);
}
get(id) {
@ -22,7 +22,7 @@ export class ApiUserInfo extends BaseRepository {
}
update(id, data: ApiUserInfoData) {
return connection.transaction(async (entityManager) => {
return dataSource.transaction(async (entityManager) => {
const repo = entityManager.getRepository(ApiUserInfoEntity);
const existingInfo = await repo.findOne({ where: { id } });