1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

[SM-288] Rename models to follow naming convention (#3795)

This commit is contained in:
Oscar Hinton
2022-10-14 18:25:50 +02:00
committed by GitHub
parent 1fd8d316a1
commit e941f06bac
445 changed files with 939 additions and 938 deletions

View File

@@ -0,0 +1,68 @@
import { SendType } from "../../enums/sendType";
import { Utils } from "../../misc/utils";
import { Send } from "../domain/send";
import { SymmetricCryptoKey } from "../domain/symmetric-crypto-key";
import { SendFileView } from "./send-file.view";
import { SendTextView } from "./send-text.view";
import { View } from "./view";
export class SendView implements View {
id: string = null;
accessId: string = null;
name: string = null;
notes: string = null;
key: ArrayBuffer;
cryptoKey: SymmetricCryptoKey;
type: SendType = null;
text = new SendTextView();
file = new SendFileView();
maxAccessCount?: number = null;
accessCount = 0;
revisionDate: Date = null;
deletionDate: Date = null;
expirationDate: Date = null;
password: string = null;
disabled = false;
hideEmail = false;
constructor(s?: Send) {
if (!s) {
return;
}
this.id = s.id;
this.accessId = s.accessId;
this.type = s.type;
this.maxAccessCount = s.maxAccessCount;
this.accessCount = s.accessCount;
this.revisionDate = s.revisionDate;
this.deletionDate = s.deletionDate;
this.expirationDate = s.expirationDate;
this.disabled = s.disabled;
this.password = s.password;
this.hideEmail = s.hideEmail;
}
get urlB64Key(): string {
return Utils.fromBufferToUrlB64(this.key);
}
get maxAccessCountReached(): boolean {
if (this.maxAccessCount == null) {
return false;
}
return this.accessCount >= this.maxAccessCount;
}
get expired(): boolean {
if (this.expirationDate == null) {
return false;
}
return this.expirationDate <= new Date();
}
get pendingDelete(): boolean {
return this.deletionDate <= new Date();
}
}