frontend/src/app/structures/PageRecord.ts
garrettmills 0e0d237d4f
All checks were successful
continuous-integration/drone/push Build is passing
Start page versions modal
2020-11-02 21:47:29 -06:00

75 lines
1.7 KiB
TypeScript

export class PageVersionRecord {
currentVersion: boolean;
versionNum: number;
versionUserId: string;
versionMessage: string;
versionUUID: string;
versionCreateDate: Date;
userDisplay: string;
}
export default class PageRecord {
public UUID: string;
public Name: string;
public OrgUserId: string;
public IsPublic = true;
public IsVisibleInMenu = true;
public ParentId: string;
public NodeIds: Array<string>;
public CreatedAt: Date;
public UpdatedAt: Date;
public CreatedUserId: string;
public UpdateUserId: string;
public ChildPageIds: Array<string>;
public level: 'view'|'manage'|'update'|false;
constructor(data: any = {Name: 'Click to edit...'}) {
[
'UUID',
'Name',
'OrgUserId',
'IsPublic',
'IsVisibleInMenu',
'ParentId',
'NodeIds',
'CreatedAt',
'UpdatedAt',
'CreatedUserId',
'UpdateUserId',
'ChildPageIds',
'level'
].forEach(field => {
if ( field in data ) {
this[field] = data[field];
}
});
}
toSave() {
const data = {};
[
'UUID',
'Name',
'OrgUserId',
'IsPublic',
'IsVisibleInMenu',
'ParentId',
'NodeIds',
'CreatedAt',
'UpdatedAt',
'CreatedUserId',
'UpdateUserId',
'ChildPageIds'
].forEach(field => {
if ( field in this ) {
data[field] = this[field];
}
});
return data;
}
isViewOnly() {
return this.level === 'view';
}
}