1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 08:43:33 +00:00

sync folders and ciphers. fix dates

This commit is contained in:
Kyle Spearrin
2018-08-20 16:01:26 -04:00
parent ddee5908f1
commit d0c51bacfd
15 changed files with 127 additions and 49 deletions

View File

@@ -18,7 +18,7 @@ export class CipherData {
edit: boolean;
organizationUseTotp: boolean;
favorite: boolean;
revisionDate: Date;
revisionDate: string;
type: CipherType;
sizeName: string;
name: string;

View File

@@ -2,7 +2,7 @@ import { PasswordHistoryResponse } from '../response/passwordHistoryResponse';
export class PasswordHistoryData {
password: string;
lastUsedDate: Date;
lastUsedDate: string;
constructor(response?: PasswordHistoryResponse) {
if (response == null) {

View File

@@ -54,7 +54,7 @@ export class Cipher extends Domain {
this.favorite = obj.favorite;
this.organizationUseTotp = obj.organizationUseTotp;
this.edit = obj.edit;
this.revisionDate = obj.revisionDate;
this.revisionDate = obj.revisionDate != null ? new Date(obj.revisionDate) : null;
this.collectionIds = obj.collectionIds;
this.localData = localData;
@@ -178,7 +178,7 @@ export class Cipher extends Domain {
c.edit = this.edit;
c.organizationUseTotp = this.organizationUseTotp;
c.favorite = this.favorite;
c.revisionDate = this.revisionDate;
c.revisionDate = this.revisionDate.toISOString();
c.type = this.type;
c.collectionIds = this.collectionIds;

View File

@@ -8,6 +8,7 @@ import Domain from './domain';
export class Folder extends Domain {
id: string;
name: CipherString;
revisionDate: Date;
constructor(obj?: FolderData, alreadyEncrypted: boolean = false) {
super();
@@ -19,6 +20,8 @@ export class Folder extends Domain {
id: null,
name: null,
}, alreadyEncrypted, ['id']);
this.revisionDate = obj.revisionDate != null ? new Date(obj.revisionDate) : null;
}
decrypt(): Promise<FolderView> {

View File

@@ -17,8 +17,8 @@ export class Password extends Domain {
this.buildDomainModel(this, obj, {
password: null,
lastUsedDate: null,
}, alreadyEncrypted, ['lastUsedDate']);
}, alreadyEncrypted);
this.lastUsedDate = new Date(obj.lastUsedDate);
}
async decrypt(orgId: string): Promise<PasswordHistoryView> {
@@ -30,7 +30,7 @@ export class Password extends Domain {
toPasswordHistoryData(): PasswordHistoryData {
const ph = new PasswordHistoryData();
ph.lastUsedDate = this.lastUsedDate;
ph.lastUsedDate = this.lastUsedDate.toISOString();
this.buildDataModel(this, ph, {
password: null,
});

View File

@@ -1,9 +1,4 @@
export class PasswordHistoryRequest {
password: string;
lastUsedDate: Date;
constructor(response: any) {
this.password = response.Password;
this.lastUsedDate = response.LastUsedDate;
}
}

View File

@@ -22,7 +22,7 @@ export class CipherResponse {
favorite: boolean;
edit: boolean;
organizationUseTotp: boolean;
revisionDate: Date;
revisionDate: string;
attachments: AttachmentResponse[];
passwordHistory: PasswordHistoryResponse[];
collectionIds: string[];

View File

@@ -1,6 +1,6 @@
export class PasswordHistoryResponse {
password: string;
lastUsedDate: Date;
lastUsedDate: string;
constructor(response: any) {
this.password = response.Password;