From 9bd8b73e27429b70a11e0016f794d1a976076c9f Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 20 Aug 2018 16:20:51 -0400 Subject: [PATCH] standardize date types --- src/models/api/loginApi.ts | 2 +- src/models/data/loginData.ts | 2 +- src/models/domain/login.ts | 4 ++-- src/models/request/cipherRequest.ts | 3 ++- src/models/response/billingResponse.ts | 16 ++++++++-------- src/models/response/breachAccountResponse.ts | 6 +++--- src/models/response/eventResponse.ts | 2 +- .../response/organizationBillingResponse.ts | 4 ++-- src/models/view/folderView.ts | 2 ++ 9 files changed, 22 insertions(+), 19 deletions(-) diff --git a/src/models/api/loginApi.ts b/src/models/api/loginApi.ts index 7f5fac7b6ba..2f9f5579afe 100644 --- a/src/models/api/loginApi.ts +++ b/src/models/api/loginApi.ts @@ -4,7 +4,7 @@ export class LoginApi { uris: LoginUriApi[]; username: string; password: string; - passwordRevisionDate?: Date; + passwordRevisionDate: string; totp: string; constructor(data: any) { diff --git a/src/models/data/loginData.ts b/src/models/data/loginData.ts index 31a4d6bcce6..e3139a8c51d 100644 --- a/src/models/data/loginData.ts +++ b/src/models/data/loginData.ts @@ -6,7 +6,7 @@ export class LoginData { uris: LoginUriData[]; username: string; password: string; - passwordRevisionDate?: Date; + passwordRevisionDate: string; totp: string; constructor(data?: LoginApi) { diff --git a/src/models/domain/login.ts b/src/models/domain/login.ts index 23fc207335c..dc721503f4c 100644 --- a/src/models/domain/login.ts +++ b/src/models/domain/login.ts @@ -20,7 +20,7 @@ export class Login extends Domain { return; } - this.passwordRevisionDate = obj.passwordRevisionDate; + this.passwordRevisionDate = obj.passwordRevisionDate != null ? new Date(obj.passwordRevisionDate) : null; this.buildDomainModel(this, obj, { username: null, password: null, @@ -55,7 +55,7 @@ export class Login extends Domain { toLoginData(): LoginData { const l = new LoginData(); - l.passwordRevisionDate = this.passwordRevisionDate; + l.passwordRevisionDate = this.passwordRevisionDate != null ? this.passwordRevisionDate.toISOString() : null; this.buildDataModel(this, l, { username: null, password: null, diff --git a/src/models/request/cipherRequest.ts b/src/models/request/cipherRequest.ts index fa2caa326d3..46d1762018d 100644 --- a/src/models/request/cipherRequest.ts +++ b/src/models/request/cipherRequest.ts @@ -39,7 +39,8 @@ export class CipherRequest { uris: null, username: cipher.login.username ? cipher.login.username.encryptedString : null, password: cipher.login.password ? cipher.login.password.encryptedString : null, - passwordRevisionDate: cipher.login.passwordRevisionDate, + passwordRevisionDate: cipher.login.passwordRevisionDate != null ? + cipher.login.passwordRevisionDate.toISOString() : null, totp: cipher.login.totp ? cipher.login.totp.encryptedString : null, }; diff --git a/src/models/response/billingResponse.ts b/src/models/response/billingResponse.ts index d3e451696a2..4c3cd5ad01a 100644 --- a/src/models/response/billingResponse.ts +++ b/src/models/response/billingResponse.ts @@ -9,7 +9,7 @@ export class BillingResponse { upcomingInvoice: BillingInvoiceResponse; charges: BillingChargeResponse[] = []; license: any; - expiration: Date; + expiration: string; constructor(response: any) { this.storageName = response.StorageName; @@ -43,11 +43,11 @@ export class BillingSourceResponse { } export class BillingSubscriptionResponse { - trialStartDate: Date; - trialEndDate: Date; - periodStartDate: Date; - periodEndDate: Date; - cancelledDate: Date; + trialStartDate: string; + trialEndDate: string; + periodStartDate: string; + periodEndDate: string; + cancelledDate: string; cancelAtEndDate: boolean; status: string; cancelled: boolean; @@ -83,7 +83,7 @@ export class BillingSubscriptionItemResponse { } export class BillingInvoiceResponse { - date: Date; + date: string; amount: number; constructor(response: any) { @@ -93,7 +93,7 @@ export class BillingInvoiceResponse { } export class BillingChargeResponse { - createdDate: Date; + createdDate: string; amount: number; paymentSource: BillingSourceResponse; status: string; diff --git a/src/models/response/breachAccountResponse.ts b/src/models/response/breachAccountResponse.ts index cc5f748232c..68cf62d4ec1 100644 --- a/src/models/response/breachAccountResponse.ts +++ b/src/models/response/breachAccountResponse.ts @@ -1,13 +1,13 @@ export class BreachAccountResponse { - addedDate: Date; - breachDate: Date; + addedDate: string; + breachDate: string; dataClasses: string[]; description: string; domain: string; isActive: boolean; isVerified: boolean; logoType: string; - modifiedDate: Date; + modifiedDate: string; name: string; pwnCount: number; title: string; diff --git a/src/models/response/eventResponse.ts b/src/models/response/eventResponse.ts index db44bc1a7a6..658d05baa8f 100644 --- a/src/models/response/eventResponse.ts +++ b/src/models/response/eventResponse.ts @@ -10,7 +10,7 @@ export class EventResponse { groupId: string; organizationUserId: string; actingUserId: string; - date: Date; + date: string; deviceType: DeviceType; ipAddress: string; diff --git a/src/models/response/organizationBillingResponse.ts b/src/models/response/organizationBillingResponse.ts index 1cd35e8dc67..f68ef9e6c8e 100644 --- a/src/models/response/organizationBillingResponse.ts +++ b/src/models/response/organizationBillingResponse.ts @@ -13,7 +13,7 @@ export class OrganizationBillingResponse extends OrganizationResponse { subscription: BillingSubscriptionResponse; upcomingInvoice: BillingInvoiceResponse; charges: BillingChargeResponse[] = []; - expiration: Date; + expiration: string; constructor(response: any) { super(response); @@ -27,6 +27,6 @@ export class OrganizationBillingResponse extends OrganizationResponse { if (response.Charges != null) { this.charges = response.Charges.map((c: any) => new BillingChargeResponse(c)); } - this.expiration = response.Expiration != null ? new Date(response.Expiration) : null; + this.expiration = response.Expiration; } } diff --git a/src/models/view/folderView.ts b/src/models/view/folderView.ts index ebe8ea157a5..a0fa99b48dd 100644 --- a/src/models/view/folderView.ts +++ b/src/models/view/folderView.ts @@ -5,6 +5,7 @@ import { Folder } from '../domain/folder'; export class FolderView implements View { id: string = null; name: string; + revisionDate: Date; constructor(f?: Folder) { if (!f) { @@ -12,5 +13,6 @@ export class FolderView implements View { } this.id = f.id; + this.revisionDate = f.revisionDate; } }