1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 15:53:27 +00:00

move domain models to ts

This commit is contained in:
Kyle Spearrin
2017-11-04 22:43:07 -04:00
parent 8e998ff179
commit bdd40d8755
15 changed files with 545 additions and 442 deletions

View File

@@ -0,0 +1,43 @@
import { AttachmentData } from '../data/attachmentData';
import { CipherString } from './cipherString';
import Domain from './domain';
class Attachment extends Domain {
id: string;
url: string;
size: number;
sizeName: string;
fileName: CipherString;
constructor(obj?: AttachmentData, alreadyEncrypted: boolean = false) {
super();
if (obj == null) {
return;
}
this.size = obj.size;
this.buildDomainModel(this, obj, {
id: null,
url: null,
sizeName: null,
fileName: null,
}, alreadyEncrypted, ['id', 'url', 'sizeName']);
}
decrypt(orgId: string): Promise<any> {
const model = {
id: this.id,
size: this.size,
sizeName: this.sizeName,
url: this.url,
};
return this.decryptObj(model, this, {
fileName: null,
}, orgId);
}
}
export { Attachment };
(window as any).Attachment = Attachment;