All files / src/entities/settings/api activeProjectRepository.ts

100% Statements 5/5
100% Branches 2/2
100% Functions 3/3
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17    15x   4x 3x       4x       3x      
import { settingsTable } from '@/entities/settings/api/settings.db';
 
export const activeProjectRepository = {
	async get(): Promise<string | null> {
		const row = await settingsTable.get('active');
		return row?.projectId ?? null;
	},
 
	async set(projectId: string): Promise<void> {
		await settingsTable.put({ id: 'active', projectId });
	},
 
	async clear(): Promise<void> {
		await settingsTable.delete('active');
	},
};