folder and collection templates

This commit is contained in:
Kyle Spearrin 2018-05-15 12:53:08 -04:00
parent 1aa937724e
commit 9ce758e859
3 changed files with 21 additions and 0 deletions

View File

@ -16,7 +16,9 @@ import { TemplateResponse } from '../models/response/templateResponse';
import { Card } from '../models/card';
import { Cipher } from '../models/cipher';
import { Collection } from '../models/collection';
import { Field } from '../models/field';
import { Folder } from '../models/folder';
import { Identity } from '../models/identity';
import { Login } from '../models/login';
import { LoginUri } from '../models/loginUri';
@ -124,6 +126,12 @@ export class GetCommand {
case 'securenote':
template = SecureNote.template();
break;
case 'folder':
template = Folder.template();
break;
case 'collection':
template = Collection.template();
break;
default:
return Response.badRequest('Unknown template object.');
}

View File

@ -1,6 +1,13 @@
import { CollectionView } from 'jslib/models/view/collectionView';
export class Collection {
static template(): Collection {
const req = new Collection();
req.organizationId = '00000000-0000-0000-0000-000000000000';
req.name = 'Collection name';
return req;
}
static toView(req: Collection, view = new CollectionView()) {
view.name = req.name;
if (view.organizationId == null) {

View File

@ -1,6 +1,12 @@
import { FolderView } from 'jslib/models/view/folderView';
export class Folder {
static template(): Folder {
const req = new Folder();
req.name = 'Folder name';
return req;
}
static toView(req: Folder, view = new FolderView()) {
view.name = req.name;
return view;