Add log and related resources to API in frontend
This commit is contained in:
parent
999d69365c
commit
ec98c8226e
3 changed files with 29 additions and 6 deletions
|
|
@ -529,9 +529,27 @@ export class PublicReportWater extends PublicReport {
|
|||
uri: "",
|
||||
});
|
||||
*/
|
||||
export interface ResourceStubDTO {
|
||||
created: string;
|
||||
type: string;
|
||||
uri: string;
|
||||
}
|
||||
export class ResourceStub {
|
||||
constructor(
|
||||
public created: Date,
|
||||
public type: string,
|
||||
public uri: string,
|
||||
) {}
|
||||
static fromJSON(json: ResourceStubDTO): ResourceStub {
|
||||
return new ResourceStub(new Date(json.created), json.type, json.uri);
|
||||
}
|
||||
}
|
||||
export interface CommunicationDTO {
|
||||
created: string;
|
||||
id: string;
|
||||
log: LogEntryDTO[];
|
||||
related: ResourceStubDTO[];
|
||||
response: string;
|
||||
source: string;
|
||||
status: string;
|
||||
type: string;
|
||||
|
|
@ -541,6 +559,9 @@ export class Communication {
|
|||
constructor(
|
||||
public created: Date,
|
||||
public id: string,
|
||||
public log: LogEntry[],
|
||||
public related: ResourceStub[],
|
||||
public response: string,
|
||||
public source: string,
|
||||
public status: string,
|
||||
public type: string,
|
||||
|
|
@ -550,6 +571,9 @@ export class Communication {
|
|||
return new Communication(
|
||||
new Date(json.created),
|
||||
json.id,
|
||||
json.log.map((l) => LogEntry.fromJSON(l)),
|
||||
json.related.map((r) => ResourceStub.fromJSON(r)),
|
||||
json.response,
|
||||
json.source,
|
||||
json.status,
|
||||
json.type,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue