1
0
mirror of https://github.com/bitwarden/jslib synced 2025-12-22 03:03:15 +00:00
Files
jslib/src/models/export/collection.ts
2018-12-17 10:29:37 -05:00

28 lines
789 B
TypeScript

import { CollectionView } from '../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.organizationId = req.organizationId;
}
return view;
}
organizationId: string;
name: string;
// Use build method instead of ctor so that we can control order of JSON stringify for pretty print
build(o: CollectionView) {
this.organizationId = o.organizationId;
this.name = o.name;
}
}