insomnia/app/models/workspace-meta.js
Gregory Schier 2cdd4761c8 Remaining V5 Features (#122)
* Add digest auth and response timeline

* Some css fixes

* Fixed Button

* More auth methods, fixed URL regex, and fix gzip

* Get rid of negotiate auth

* Fix proxy

* Fixed GA tracking

* Some very small changes and fixes

* Fix content type names

* Even better auth switching and timeline syntax

* Some auth tweaks

* CSS tweaks

* Reworked toasts

* Fixed timer rounding quirk

* Request settings and render errors

* Fixed tests

* Vertical dragging and stuff

* Remove beta
2017-03-28 15:45:23 -07:00

45 lines
1023 B
JavaScript

import * as db from '../common/database';
import {DEFAULT_SIDEBAR_WIDTH, DEFAULT_PANE_WIDTH, DEFAULT_PANE_HEIGHT} from '../common/constants';
export const name = 'Workspace Meta';
export const type = 'WorkspaceMeta';
export const prefix = 'wrkm';
export const canDuplicate = true;
export function init () {
return {
parentId: null,
activeRequestId: null,
activeEnvironmentId: null,
sidebarFilter: '',
sidebarHidden: false,
sidebarWidth: DEFAULT_SIDEBAR_WIDTH,
paneWidth: DEFAULT_PANE_WIDTH,
paneHeight: DEFAULT_PANE_HEIGHT
};
}
export function migrate (doc) {
return doc;
}
export function create (patch = {}) {
if (!patch.parentId) {
throw new Error('New WorkspaceMeta missing `parentId`', patch);
}
return db.docCreate(type, patch);
}
export function update (workspaceMeta, patch) {
return db.docUpdate(workspaceMeta, patch);
}
export function getByParentId (parentId) {
return db.getWhere(type, {parentId});
}
export function all () {
return db.all(type);
}