mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 20:01:09 +02:00
fix(builds): repair inventar settings import and add skilltree storage service
- inventar-web: fix mangled icon import in settings page - skilltree-web: create missing lib/services/storage.ts for export/import - startup.sh: add umami/synapse DB creation + synapse user setup with C locale Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e5ca208cd8
commit
7bc4db7e63
3 changed files with 43 additions and 2 deletions
32
apps/skilltree/apps/web/src/lib/services/storage.ts
Normal file
32
apps/skilltree/apps/web/src/lib/services/storage.ts
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import { skillCollection, activityCollection, achievementCollection } from '$lib/data/local-store';
|
||||
|
||||
export async function exportData() {
|
||||
const [skills, activities, achievements] = await Promise.all([
|
||||
skillCollection.getAll(),
|
||||
activityCollection.getAll(),
|
||||
achievementCollection.getAll(),
|
||||
]);
|
||||
return { skills, activities, achievements, exportedAt: new Date().toISOString() };
|
||||
}
|
||||
|
||||
export async function importData(data: {
|
||||
skills?: unknown[];
|
||||
activities?: unknown[];
|
||||
achievements?: unknown[];
|
||||
}) {
|
||||
if (Array.isArray(data.skills)) {
|
||||
for (const skill of data.skills) {
|
||||
await skillCollection.insert(skill as never).catch(() => null);
|
||||
}
|
||||
}
|
||||
if (Array.isArray(data.activities)) {
|
||||
for (const activity of data.activities) {
|
||||
await activityCollection.insert(activity as never).catch(() => null);
|
||||
}
|
||||
}
|
||||
if (Array.isArray(data.achievements)) {
|
||||
for (const achievement of data.achievements) {
|
||||
await achievementCollection.insert(achievement as never).catch(() => null);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue