insomnia/app/models/requestGroupMeta.js
Gregory Schier 2b6f02f6ca Migrate persistent redux stores to DB models (#70)
* Removed RequestGroupMeta reducer

* Converted rest of reducers to DB models
2016-11-30 17:50:59 -08:00

37 lines
698 B
JavaScript

import * as db from '../common/database';
export const name = 'Folder Meta';
export const type = 'RequestGroupMeta';
export const prefix = 'fldm';
export function init () {
return {
parentId: null,
collapsed: true,
}
}
export function migrate (doc) {
return doc;
}
export function create (patch = {}) {
if (!patch.parentId) {
throw new Error('New RequestGroupMeta missing `parentId`', patch);
}
return db.docCreate(type, patch);
}
export function update (requestGroupMeta, patch) {
return db.docUpdate(requestGroupMeta, patch);
}
export function getByParentId (parentId) {
return db.getWhere(type, {parentId})
}
export function all () {
return db.all(type);
}