feat: Add emoji and alot of other fixes
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
ReactionEntity,
|
||||
BanEntity,
|
||||
AttachmentEntity,
|
||||
CustomEmojiEntity,
|
||||
MetaEntity,
|
||||
PluginDataEntity
|
||||
} from '../../../entities';
|
||||
@@ -27,6 +28,7 @@ export async function handleClearAllData(dataSource: DataSource): Promise<void>
|
||||
await dataSource.getRepository(ReactionEntity).clear();
|
||||
await dataSource.getRepository(BanEntity).clear();
|
||||
await dataSource.getRepository(AttachmentEntity).clear();
|
||||
await dataSource.getRepository(CustomEmojiEntity).clear();
|
||||
await dataSource.getRepository(MetaEntity).clear();
|
||||
await dataSource.getRepository(PluginDataEntity).clear();
|
||||
}
|
||||
|
||||
7
electron/cqrs/commands/handlers/deleteCustomEmoji.ts
Normal file
7
electron/cqrs/commands/handlers/deleteCustomEmoji.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
import { CustomEmojiEntity } from '../../../entities';
|
||||
import { DeleteCustomEmojiCommand } from '../../types';
|
||||
|
||||
export async function handleDeleteCustomEmoji(command: DeleteCustomEmojiCommand, dataSource: DataSource): Promise<void> {
|
||||
await dataSource.getRepository(CustomEmojiEntity).delete({ id: command.payload.emojiId });
|
||||
}
|
||||
19
electron/cqrs/commands/handlers/saveCustomEmoji.ts
Normal file
19
electron/cqrs/commands/handlers/saveCustomEmoji.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
import { CustomEmojiEntity } from '../../../entities';
|
||||
import { SaveCustomEmojiCommand } from '../../types';
|
||||
|
||||
export async function handleSaveCustomEmoji(command: SaveCustomEmojiCommand, dataSource: DataSource): Promise<void> {
|
||||
const { emoji } = command.payload;
|
||||
|
||||
await dataSource.getRepository(CustomEmojiEntity).save({
|
||||
id: emoji.id,
|
||||
name: emoji.name,
|
||||
creatorUserId: emoji.creatorUserId,
|
||||
dataUrl: emoji.dataUrl,
|
||||
hash: emoji.hash,
|
||||
mime: emoji.mime,
|
||||
size: emoji.size,
|
||||
createdAt: emoji.createdAt,
|
||||
updatedAt: emoji.updatedAt
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user