mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 16:53:34 +00:00
restructure attachment commands
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
import { AttachmentView } from 'jslib/models/view/attachmentView';
|
||||
|
||||
export class Attachment {
|
||||
static template(): Attachment {
|
||||
const req = new Attachment();
|
||||
req.fileName = 'photo.jpg';
|
||||
return req;
|
||||
}
|
||||
|
||||
static toView(req: Attachment, view = new AttachmentView()) {
|
||||
view.fileName = req.fileName;
|
||||
return view;
|
||||
}
|
||||
|
||||
fileName: string;
|
||||
|
||||
// Use build method instead of ctor so that we can control order of JSON stringify for pretty print
|
||||
build(o: AttachmentView) {
|
||||
this.fileName = o.fileName;
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,15 @@
|
||||
import { AttachmentView } from 'jslib/models/view/attachmentView';
|
||||
|
||||
import { Attachment } from '../attachment';
|
||||
|
||||
export class AttachmentResponse extends Attachment {
|
||||
export class AttachmentResponse {
|
||||
id: string;
|
||||
fileName: string;
|
||||
size: number;
|
||||
sizeName: string;
|
||||
url: string;
|
||||
|
||||
constructor(o: AttachmentView) {
|
||||
super();
|
||||
this.id = o.id;
|
||||
this.build(o);
|
||||
this.fileName = o.fileName;
|
||||
this.size = o.size;
|
||||
this.sizeName = o.sizeName;
|
||||
this.url = o.url;
|
||||
|
||||
Reference in New Issue
Block a user