Skip to content

Commit

Permalink
Feat/specify multiview layout when doing production-config(#16)
Browse files Browse the repository at this point in the history
* feat: added another mv-preset and updated code to be arr instead of single-object

* feat: added optional style to be added to the options-dropdown

* feat: first draft of a multiview-layout setting

* feat: possible to create new layouts as multiview-previews and add it to productions
  • Loading branch information
malmen237 committed Sep 19, 2024
1 parent 34a0421 commit c669245
Show file tree
Hide file tree
Showing 16 changed files with 810 additions and 202 deletions.
11 changes: 11 additions & 0 deletions src/api/manager/presets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export async function getMultiviewPresets(): Promise<MultiviewPreset[]> {
const db = await getDatabase();
return await db.collection<MultiviewPreset>('multiviews').find({}).toArray();
}

export async function getMultiviewPreset(
id: string
): Promise<WithId<MultiviewPreset>> {
Expand All @@ -26,6 +27,16 @@ export async function getMultiviewPreset(
.collection<MultiviewPreset>('multiviews')
.findOne({ _id: new ObjectId(id) })) as WithId<MultiviewPreset>;
}

export async function putMultiviewPreset(
newMultiviewPreset: MultiviewPreset
): Promise<void> {
const db = await getDatabase();
await db
.collection('multiviews')
.insertOne({ ...newMultiviewPreset, _id: new ObjectId() });
}

export async function putPreset(
id: string,
preset: PresetWithId
Expand Down
3 changes: 2 additions & 1 deletion src/api/mongoClient/dbClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ async function bootstrapDbCollections(db: Db) {
const multiviews = await db.collection('multiviews').countDocuments();
if (multiviews === 0) {
Log().info('Bootstrapping database with default multiview');
await db.collection('multiviews').insertOne(defaultMultiview);

await db.collection('multiviews').insertMany(defaultMultiview);
} else {
await migrateMultiviewPresets(db);
}
Expand Down
Loading

0 comments on commit c669245

Please sign in to comment.