This commit is contained in:
syuilo 2023-04-09 09:53:02 +09:00
parent 9feb6b0f5b
commit 1057da1556

View File

@ -45,6 +45,7 @@ export class CustomEmojiService {
fetcher: () => this.emojisRepository.find({ where: { host: IsNull() } }).then(emojis => new Map(emojis.map(emoji => [emoji.name, emoji]))), fetcher: () => this.emojisRepository.find({ where: { host: IsNull() } }).then(emojis => new Map(emojis.map(emoji => [emoji.name, emoji]))),
toRedisConverter: (value) => JSON.stringify(value.values()), toRedisConverter: (value) => JSON.stringify(value.values()),
fromRedisConverter: (value) => { fromRedisConverter: (value) => {
// 原因不明だが配列以外が入ってくることがあるため
if (!Array.isArray(JSON.parse(value))) return undefined; if (!Array.isArray(JSON.parse(value))) return undefined;
return new Map(JSON.parse(value).map((x: Emoji) => [x.name, x])); return new Map(JSON.parse(value).map((x: Emoji) => [x.name, x]));
}, // TODO: Date型の変換 }, // TODO: Date型の変換