1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-02 01:33:22 +00:00

name name and id optional in folder model

This commit is contained in:
jaasen-livefront
2025-11-07 12:26:32 -08:00
parent d9b522a341
commit 939ec1b448
2 changed files with 6 additions and 6 deletions

View File

@@ -25,6 +25,6 @@ export class FolderExport {
// Use build method instead of ctor so that we can control order of JSON stringify for pretty print
build(o: FolderView | FolderDomain) {
this.name = safeGetString(o.name) ?? "";
this.name = safeGetString(o.name ?? "") ?? "";
}
}

View File

@@ -8,8 +8,8 @@ import { FolderData } from "../data/folder.data";
import { FolderView } from "../view/folder.view";
export class Folder extends Domain {
id: string = "";
name: EncString = new EncString("");
id?: string;
name?: EncString;
revisionDate: Date;
constructor(obj?: FolderData) {
@@ -41,10 +41,10 @@ export class Folder extends Domain {
encryptService: EncryptService,
): Promise<FolderView> {
const folderView = new FolderView();
folderView.id = this.id;
folderView.id = this.id ?? "";
folderView.revisionDate = this.revisionDate;
try {
folderView.name = await encryptService.decryptString(this.name, key);
folderView.name = await encryptService.decryptString(this.name ?? new EncString(""), key);
} catch (e) {
// Note: This should be replaced by the owning team with appropriate, domain-specific behavior.
// eslint-disable-next-line no-console
@@ -58,6 +58,6 @@ export class Folder extends Domain {
if (obj == null) {
return null;
}
return new Folder({ name: obj.name, revisionDate: obj.revisionDate, id: obj.id });
return new Folder({ name: obj.name ?? "", revisionDate: obj.revisionDate, id: obj.id ?? "" });
}
}