feat: plugins v1.5
This commit is contained in:
16
electron/cqrs/commands/handlers/savePluginData.ts
Normal file
16
electron/cqrs/commands/handlers/savePluginData.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
import { PluginDataEntity } from '../../../entities';
|
||||
import { SavePluginDataCommand } from '../../types';
|
||||
|
||||
export async function handleSavePluginData(command: SavePluginDataCommand, dataSource: DataSource): Promise<void> {
|
||||
const { payload } = command;
|
||||
|
||||
await dataSource.getRepository(PluginDataEntity).save({
|
||||
key: payload.key,
|
||||
pluginId: payload.pluginId,
|
||||
scope: payload.scope,
|
||||
serverId: payload.serverId ?? '',
|
||||
updatedAt: Date.now(),
|
||||
valueJson: JSON.stringify(payload.value ?? null)
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user