mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 12:36:57 +00:00
fix TypeORM error from MetaService.fetch
This commit is contained in:
parent
070084889f
commit
4738b14d1c
1 changed files with 12 additions and 8 deletions
|
@ -74,11 +74,13 @@ export class MetaService implements OnApplicationShutdown {
|
||||||
if (!noCache && this.cache) return this.cache;
|
if (!noCache && this.cache) return this.cache;
|
||||||
|
|
||||||
// 過去のバグでレコードが複数出来てしまっている可能性があるので新しいIDを優先する
|
// 過去のバグでレコードが複数出来てしまっている可能性があるので新しいIDを優先する
|
||||||
let meta = await this.metasRepository.findOne({
|
let meta = await this.metasRepository.createQueryBuilder('meta')
|
||||||
order: {
|
.select()
|
||||||
|
.orderBy({
|
||||||
id: 'DESC',
|
id: 'DESC',
|
||||||
},
|
})
|
||||||
});
|
.limit(1)
|
||||||
|
.getOne();
|
||||||
|
|
||||||
if (!meta) {
|
if (!meta) {
|
||||||
await this.metasRepository.createQueryBuilder('meta')
|
await this.metasRepository.createQueryBuilder('meta')
|
||||||
|
@ -89,11 +91,13 @@ export class MetaService implements OnApplicationShutdown {
|
||||||
.orIgnore()
|
.orIgnore()
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
meta = await this.metasRepository.findOneOrFail({
|
meta = await this.metasRepository.createQueryBuilder('meta')
|
||||||
order: {
|
.select()
|
||||||
|
.orderBy({
|
||||||
id: 'DESC',
|
id: 'DESC',
|
||||||
},
|
})
|
||||||
});
|
.limit(1)
|
||||||
|
.getOneOrFail();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.cache = meta;
|
this.cache = meta;
|
||||||
|
|
Loading…
Add table
Reference in a new issue