1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 15:23:33 +00:00

refactor req/res models

This commit is contained in:
Kyle Spearrin
2018-05-15 12:18:47 -04:00
parent 1d3ed93bff
commit 07cc64c0b8
25 changed files with 363 additions and 229 deletions

View File

@@ -5,8 +5,8 @@ import { FolderService } from 'jslib/services/folder.service';
import { Response } from '../models/response';
import { CipherRequest } from '../models/request/cipherRequest';
import { FolderRequest } from '../models/request/folderRequest';
import { Cipher } from '../models/cipher';
import { Folder } from '../models/folder';
export class CreateCommand {
constructor(private cipherService: CipherService, private folderService: FolderService) { }
@@ -30,8 +30,8 @@ export class CreateCommand {
}
}
private async createCipher(req: CipherRequest) {
const cipher = await this.cipherService.encrypt(CipherRequest.toView(req));
private async createCipher(req: Cipher) {
const cipher = await this.cipherService.encrypt(Cipher.toView(req));
try {
await this.cipherService.saveWithServer(cipher);
return Response.success();
@@ -40,8 +40,8 @@ export class CreateCommand {
}
}
private async createFolder(req: FolderRequest) {
const folder = await this.folderService.encrypt(FolderRequest.toView(req));
private async createFolder(req: Folder) {
const folder = await this.folderService.encrypt(Folder.toView(req));
try {
await this.folderService.saveWithServer(folder);
return Response.success();