1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-13 14:53:33 +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,32 @@
import { EncString } from "../domain/enc-string";
import { Folder as FolderDomain } from "../domain/folder";
import { FolderView } from "../view/folder.view";
export class FolderExport {
static template(): FolderExport {
const req = new FolderExport();
req.name = "Folder name";
return req;
}
static toView(req: FolderExport, view = new FolderView()) {
view.name = req.name;
return view;
}
static toDomain(req: FolderExport, domain = new FolderDomain()) {
domain.name = req.name != null ? new EncString(req.name) : null;
return domain;
}
name: string;
// Use build method instead of ctor so that we can control order of JSON stringify for pretty print
build(o: FolderView | FolderDomain) {
if (o instanceof FolderView) {
this.name = o.name;
} else {
this.name = o.name?.encryptedString;
}
}
}