projects/web-mev/src/app/features/workspace-detail/models/workspace-resource.ts
Properties |
|
constructor(id: string, url: string, name: string, resource_type: FileType, readable_resource_type: string, owner_email: string, is_active: boolean, is_public: boolean, status: string, workspace: string, workspace_name: string, created: Date, size: number)
|
| Public created |
Type : Date
|
| Public id |
Type : string
|
| Public is_active |
Type : boolean
|
| Public is_public |
Type : boolean
|
| Public name |
Type : string
|
| Public owner_email |
Type : string
|
| Public readable_resource_type |
Type : string
|
| Public resource_type |
Type : FileType
|
| Public size |
Type : number
|
| Public status |
Type : string
|
| Public url |
Type : string
|
| Public workspace |
Type : string
|
| Public workspace_name |
Type : string
|
import { FileType } from '@app/shared/models/file-type';
import { Injectable } from '@angular/core';
export class WorkspaceResource {
constructor(
public id: string,
public url: string,
public name: string,
public resource_type: FileType,
public readable_resource_type: string,
public owner_email: string,
public is_active: boolean,
public is_public: boolean,
public status: string,
public workspace: string,
public workspace_name: string,
public created: Date,
public size: number
) {}
}
@Injectable({
providedIn: 'root'
})
export class WorkspaceResourceAdapter {
adapt(item: any): WorkspaceResource {
const re = /[()]/g;
const created_formatted = item.created.replace(re, '');
return new WorkspaceResource(
item.id,
item.url,
item.name,
item.resource_type,
item.readable_resource_type,
item.owner_email,
item.is_active,
item.is_public,
item.status,
item.workspace,
item.workspace_name,
new Date(created_formatted),
item.size
);
}
}