insomnia/packages/insomnia-app/app/models/request-group-meta.js

38 lines
731 B
JavaScript
Raw Normal View History

import * as db from '../common/database';
export const name = 'Folder Meta';
export const type = 'RequestGroupMeta';
export const prefix = 'fldm';
export const canDuplicate = false;
2018-06-25 17:42:50 +00:00
export function init() {
return {
parentId: null,
2018-05-25 01:44:49 +00:00
collapsed: false
};
}
2018-06-25 17:42:50 +00:00
export function migrate(doc) {
return doc;
}
2018-06-25 17:42:50 +00:00
export function create(patch = {}) {
if (!patch.parentId) {
throw new Error('New RequestGroupMeta missing `parentId`', patch);
}
return db.docCreate(type, patch);
}
2018-06-25 17:42:50 +00:00
export function update(requestGroupMeta, patch) {
return db.docUpdate(requestGroupMeta, patch);
}
2018-06-25 17:42:50 +00:00
export function getByParentId(parentId) {
return db.getWhere(type, { parentId });
}
2018-06-25 17:42:50 +00:00
export function all() {
return db.all(type);
}