This commit is contained in:
@@ -1,9 +1,54 @@
|
||||
export default class HostRecord {
|
||||
public value = '';
|
||||
public type: 'paragraph'|'header1'|'header2'|'header3'|'header4'|'block_code'|'click_link' = 'paragraph';
|
||||
|
||||
public type: 'paragraph'|'header1'|'header2'|'header3'|'header4'|'block_code' = 'paragraph';
|
||||
public CreatedAt: string;
|
||||
public PageId: string;
|
||||
public UUID: string;
|
||||
public UpdatedAt: string;
|
||||
public Value: any;
|
||||
|
||||
constructor(value = '') {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
load(data: any) {
|
||||
this.type = data.Type;
|
||||
|
||||
[
|
||||
'CreatedAt',
|
||||
'PageId',
|
||||
'UUID',
|
||||
'UpdatedAt',
|
||||
'Value',
|
||||
].forEach(field => {
|
||||
if ( field in data ) {
|
||||
this[field] = data[field];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
toSave() {
|
||||
const data: any = {
|
||||
Type: this.type
|
||||
};
|
||||
|
||||
[
|
||||
'CreatedAt',
|
||||
'PageId',
|
||||
'UUID',
|
||||
'UpdatedAt',
|
||||
'Value',
|
||||
].forEach(field => {
|
||||
if ( field in this ) {
|
||||
data[field] = this[field];
|
||||
}
|
||||
});
|
||||
|
||||
if ( !data.Value ) {
|
||||
data.Value = {};
|
||||
}
|
||||
data.Value.Value = this.value;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user