feat(editor): Add v1 banner (#6443)

This commit is contained in:
Iván Ovejero
2023-06-19 16:23:57 +02:00
committed by कारतोफ्फेलस्क्रिप्ट™
parent 85372aabdf
commit 0fe415add2
17 changed files with 198 additions and 5 deletions

View File

@@ -1,10 +1,23 @@
import { Service } from 'typedi';
import { DataSource, Repository } from 'typeorm';
import { Settings } from '../entities/Settings';
import config from '@/config';
@Service()
export class SettingsRepository extends Repository<Settings> {
constructor(dataSource: DataSource) {
super(Settings, dataSource.manager);
}
async saveSetting(key: string, value: string, loadOnStartup = true) {
const setting = await this.findOneBy({ key });
if (setting) {
await this.update({ key }, { value, loadOnStartup });
} else {
await this.save({ key, value, loadOnStartup });
}
if (loadOnStartup) config.set('ui.banners.v1.dismissed', true);
}
}