refactor: fix types

This commit is contained in:
syuilo
2023-02-17 15:36:36 +09:00
parent 0e1b5d6f14
commit 60df819c60
19 changed files with 91 additions and 118 deletions

View File

@@ -56,7 +56,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
await this.db.queryResultCache!.remove(['meta_emojis']);
this.globalEventService.publishBroadcastStream('emojiUpdated', {
emojis: await this.emojiEntityService.packMany(ps.ids),
emojis: await this.emojiEntityService.packDetailedMany(ps.ids),
});
});
}

View File

@@ -92,7 +92,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
await this.db.queryResultCache!.remove(['meta_emojis']);
this.globalEventService.publishBroadcastStream('emojiAdded', {
emoji: await this.emojiEntityService.pack(copied.id),
emoji: await this.emojiEntityService.packDetailed(copied.id),
});
return {

View File

@@ -54,7 +54,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
}
this.globalEventService.publishBroadcastStream('emojiDeleted', {
emojis: await this.emojiEntityService.packMany(emojis),
emojis: await this.emojiEntityService.packDetailedMany(emojis),
});
});
}

View File

@@ -4,9 +4,9 @@ import { Endpoint } from '@/server/api/endpoint-base.js';
import type { EmojisRepository } from '@/models/index.js';
import { DI } from '@/di-symbols.js';
import { ModerationLogService } from '@/core/ModerationLogService.js';
import { ApiError } from '../../../error.js';
import { EmojiEntityService } from '@/core/entities/EmojiEntityService.js';
import { GlobalEventService } from '@/core/GlobalEventService.js';
import { ApiError } from '../../../error.js';
export const meta = {
tags: ['admin'],
@@ -57,7 +57,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
await this.db.queryResultCache!.remove(['meta_emojis']);
this.globalEventService.publishBroadcastStream('emojiDeleted', {
emojis: [await this.emojiEntityService.pack(emoji)],
emojis: [await this.emojiEntityService.packDetailed(emoji)],
});
this.moderationLogService.insertModerationLog(me, 'deleteEmoji', {

View File

@@ -101,7 +101,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
.take(ps.limit)
.getMany();
return this.emojiEntityService.packMany(emojis, { omitHost: false, omitId: false, withUrl: false });
return this.emojiEntityService.packDetailedMany(emojis);
});
}
}

View File

@@ -98,7 +98,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
emojis = await q.take(ps.limit).getMany();
}
return this.emojiEntityService.packMany(emojis, { omitHost: false, omitId: false, withUrl: false });
return this.emojiEntityService.packDetailedMany(emojis);
});
}
}

View File

@@ -56,7 +56,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
await this.db.queryResultCache!.remove(['meta_emojis']);
this.globalEventService.publishBroadcastStream('emojiUpdated', {
emojis: await this.emojiEntityService.packMany(ps.ids),
emojis: await this.emojiEntityService.packDetailedMany(ps.ids),
});
});
}

View File

@@ -52,7 +52,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
await this.db.queryResultCache!.remove(['meta_emojis']);
this.globalEventService.publishBroadcastStream('emojiUpdated', {
emojis: await this.emojiEntityService.packMany(ps.ids),
emojis: await this.emojiEntityService.packDetailedMany(ps.ids),
});
});
}

View File

@@ -54,7 +54,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
await this.db.queryResultCache!.remove(['meta_emojis']);
this.globalEventService.publishBroadcastStream('emojiUpdated', {
emojis: await this.emojiEntityService.packMany(ps.ids),
emojis: await this.emojiEntityService.packDetailedMany(ps.ids),
});
});
}

View File

@@ -3,9 +3,9 @@ import { DataSource } from 'typeorm';
import { Endpoint } from '@/server/api/endpoint-base.js';
import type { EmojisRepository } from '@/models/index.js';
import { DI } from '@/di-symbols.js';
import { ApiError } from '../../../error.js';
import { EmojiEntityService } from '@/core/entities/EmojiEntityService.js';
import { GlobalEventService } from '@/core/GlobalEventService.js';
import { ApiError } from '../../../error.js';
export const meta = {
tags: ['admin'],
@@ -68,7 +68,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
await this.db.queryResultCache!.remove(['meta_emojis']);
const updated = await this.emojiEntityService.pack(emoji.id);
const updated = await this.emojiEntityService.packDetailed(emoji.id);
if (emoji.name === ps.name) {
this.globalEventService.publishBroadcastStream('emojiUpdated', {
@@ -76,7 +76,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
});
} else {
this.globalEventService.publishBroadcastStream('emojiDeleted', {
emojis: [await this.emojiEntityService.pack(emoji)],
emojis: [await this.emojiEntityService.packDetailed(emoji)],
});
this.globalEventService.publishBroadcastStream('emojiAdded', {