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
|
|
@ -203,6 +203,7 @@ func (res *communicationR) hydrateCommunication(comm modelpublic.Communication,
|
|||
return communication{
|
||||
Created: comm.Created,
|
||||
ID: strconv.Itoa(int(comm.ID)),
|
||||
Log: []communicationLog{},
|
||||
Related: related,
|
||||
Response: response,
|
||||
Source: source_uri,
|
||||
|
|
|
|||
|
|
@ -74,12 +74,10 @@
|
|||
</div>
|
||||
|
||||
<div class="h-100 d-flex flex-column" v-else>
|
||||
<PublicReportCard
|
||||
v-if="selectedReport"
|
||||
:report="selectedReport"
|
||||
@viewImage="openPhotoViewer"
|
||||
<ResourceCard
|
||||
:resource="resource"
|
||||
v-for="(resource, index) in selectedCommunication.related"
|
||||
/>
|
||||
<p v-else>Loading details...</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -88,7 +86,7 @@
|
|||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
|
||||
import PublicReportCard from "@/components/PublicReportCard.vue";
|
||||
import ResourceCard from "@/components/ResourceCard.vue";
|
||||
import TimeRelative from "@/components/TimeRelative.vue";
|
||||
import Map, { LngLatBounds } from "@/map/Map.vue";
|
||||
import Layer from "@/map/Layer.vue";
|
||||
|
|
|
|||
|
|
@ -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