mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 01:33:33 +00:00
[Soft Delete] jslib updates for new API updates
New API methods and cipher Deleted Date property, plus search expansion to toggle on deleted flag.
This commit is contained in:
@@ -31,6 +31,7 @@ export class CipherData {
|
||||
attachments?: AttachmentData[];
|
||||
passwordHistory?: PasswordHistoryData[];
|
||||
collectionIds?: string[];
|
||||
deletedDate: string;
|
||||
|
||||
constructor(response?: CipherResponse, userId?: string, collectionIds?: string[]) {
|
||||
if (response == null) {
|
||||
@@ -49,6 +50,7 @@ export class CipherData {
|
||||
this.name = response.name;
|
||||
this.notes = response.notes;
|
||||
this.collectionIds = collectionIds != null ? collectionIds : response.collectionIds;
|
||||
this.deletedDate = response.deletedDate;
|
||||
|
||||
switch (this.type) {
|
||||
case CipherType.Login:
|
||||
|
||||
@@ -34,6 +34,7 @@ export class Cipher extends Domain {
|
||||
fields: Field[];
|
||||
passwordHistory: Password[];
|
||||
collectionIds: string[];
|
||||
deletedDate: Date;
|
||||
|
||||
constructor(obj?: CipherData, alreadyEncrypted: boolean = false, localData: any = null) {
|
||||
super();
|
||||
@@ -57,6 +58,7 @@ export class Cipher extends Domain {
|
||||
this.revisionDate = obj.revisionDate != null ? new Date(obj.revisionDate) : null;
|
||||
this.collectionIds = obj.collectionIds;
|
||||
this.localData = localData;
|
||||
this.deletedDate = obj.deletedDate != null ? new Date(obj.deletedDate) : null;
|
||||
|
||||
switch (this.type) {
|
||||
case CipherType.Login:
|
||||
@@ -172,6 +174,7 @@ export class Cipher extends Domain {
|
||||
c.revisionDate = this.revisionDate != null ? this.revisionDate.toISOString() : null;
|
||||
c.type = this.type;
|
||||
c.collectionIds = this.collectionIds;
|
||||
c.deletedDate = this.deletedDate != null ? this.deletedDate.toISOString() : null;
|
||||
|
||||
this.buildDataModel(this, c, {
|
||||
name: null,
|
||||
|
||||
7
src/models/request/cipherBulkRestoreRequest.ts
Normal file
7
src/models/request/cipherBulkRestoreRequest.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export class CipherBulkRestoreRequest {
|
||||
ids: string[];
|
||||
|
||||
constructor(ids: string[]) {
|
||||
this.ids = ids == null ? [] : ids;
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ export class CipherResponse extends BaseResponse {
|
||||
attachments: AttachmentResponse[];
|
||||
passwordHistory: PasswordHistoryResponse[];
|
||||
collectionIds: string[];
|
||||
deletedDate: string;
|
||||
|
||||
constructor(response: any) {
|
||||
super(response);
|
||||
@@ -41,6 +42,7 @@ export class CipherResponse extends BaseResponse {
|
||||
this.organizationUseTotp = this.getResponseProperty('OrganizationUseTotp');
|
||||
this.revisionDate = this.getResponseProperty('RevisionDate');
|
||||
this.collectionIds = this.getResponseProperty('CollectionIds');
|
||||
this.deletedDate = this.getResponseProperty('DeletedDate');
|
||||
|
||||
const login = this.getResponseProperty('Login');
|
||||
if (login != null) {
|
||||
|
||||
@@ -31,6 +31,7 @@ export class CipherView implements View {
|
||||
passwordHistory: PasswordHistoryView[] = null;
|
||||
collectionIds: string[] = null;
|
||||
revisionDate: Date = null;
|
||||
deletedDate: Date = null;
|
||||
|
||||
constructor(c?: Cipher) {
|
||||
if (!c) {
|
||||
@@ -47,6 +48,7 @@ export class CipherView implements View {
|
||||
this.localData = c.localData;
|
||||
this.collectionIds = c.collectionIds;
|
||||
this.revisionDate = c.revisionDate;
|
||||
this.deletedDate = c.deletedDate;
|
||||
}
|
||||
|
||||
get subTitle(): string {
|
||||
@@ -97,4 +99,8 @@ export class CipherView implements View {
|
||||
}
|
||||
return this.login.passwordRevisionDate;
|
||||
}
|
||||
|
||||
get isDeleted(): boolean {
|
||||
return this.deletedDate != null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user