From 9ce758e859025cb2978cd5ec26b5e41ae891053c Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 15 May 2018 12:53:08 -0400 Subject: [PATCH] folder and collection templates --- src/commands/get.command.ts | 8 ++++++++ src/models/collection.ts | 7 +++++++ src/models/folder.ts | 6 ++++++ 3 files changed, 21 insertions(+) diff --git a/src/commands/get.command.ts b/src/commands/get.command.ts index f6eba68d09..225bdccea1 100644 --- a/src/commands/get.command.ts +++ b/src/commands/get.command.ts @@ -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.'); } diff --git a/src/models/collection.ts b/src/models/collection.ts index 27bb9e71e2..0585b758ad 100644 --- a/src/models/collection.ts +++ b/src/models/collection.ts @@ -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) { diff --git a/src/models/folder.ts b/src/models/folder.ts index d8638057c8..b0de5025e2 100644 --- a/src/models/folder.ts +++ b/src/models/folder.ts @@ -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;