Be consistent about using report.public_id over report.id
This commit is contained in:
parent
02139450c6
commit
3c62fe2ca1
9 changed files with 19 additions and 29 deletions
|
|
@ -28,7 +28,7 @@ type complianceR struct {
|
|||
}
|
||||
type compliance struct {
|
||||
District string `json:"district"`
|
||||
ID string `json:"id"`
|
||||
PublicID string `json:"public_id"`
|
||||
URI string `json:"uri"`
|
||||
}
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ func (res *complianceR) Create(ctx context.Context, r *http.Request, n publicrep
|
|||
}
|
||||
return &compliance{
|
||||
District: district_uri,
|
||||
ID: report.PublicID,
|
||||
PublicID: report.PublicID,
|
||||
URI: uri,
|
||||
}, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ function filterMatchesLogEntry(filter: string, logs: LogEntry[]) {
|
|||
function filterMatchesPublicReport(filter: string, pr: PublicReport) {
|
||||
if (
|
||||
pr.address.raw.includes(filter) ||
|
||||
pr.id.includes(filter) ||
|
||||
pr.public_id.includes(filter) ||
|
||||
filterMatchesLogEntry(filter, pr.log)
|
||||
) {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
Standing Water Report
|
||||
</span>
|
||||
</h5>
|
||||
<small class="text-muted">Report ID: #{{ report.id }}</small>
|
||||
<small class="text-muted">Report ID: #{{ report.public_id }}</small>
|
||||
</div>
|
||||
<span class="badge bg-secondary">
|
||||
<TimeRelative :time="report.created" />
|
||||
|
|
|
|||
|
|
@ -537,7 +537,7 @@ async function doSubmit() {
|
|||
});
|
||||
const data: PublicReport = (await resp.json()) as PublicReport;
|
||||
storePublicReport.add(data);
|
||||
router.push("/submitted/" + data.id);
|
||||
router.push("/submitted/" + data.public_id);
|
||||
} catch (error) {
|
||||
errorMessage.value =
|
||||
error instanceof Error ? error.message : "Upload failed";
|
||||
|
|
|
|||
|
|
@ -697,7 +697,7 @@ async function doSubmit() {
|
|||
});
|
||||
const data: PublicReport = (await resp.json()) as PublicReport;
|
||||
storePublicReport.add(data);
|
||||
router.push("/submitted/" + data.id);
|
||||
router.push("/submitted/" + data.public_id);
|
||||
} catch (error) {
|
||||
errorMessage.value =
|
||||
error instanceof Error ? error.message : "Upload failed";
|
||||
|
|
|
|||
|
|
@ -121,13 +121,6 @@
|
|||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.reference-number {
|
||||
text-align: center;
|
||||
color: #6c757d;
|
||||
font-size: 0.9rem;
|
||||
margin-top: 24px;
|
||||
}
|
||||
|
||||
.action-buttons {
|
||||
width: 100%;
|
||||
}
|
||||
|
|
@ -233,13 +226,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- Reference Number -->
|
||||
<div class="reference-number">
|
||||
<small>
|
||||
Reference number: <strong>{{ modelValue.public_id }}</strong>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
|
|
|
|||
|
|
@ -5,15 +5,19 @@ body {
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
body > .container-fluid {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
background-color: #0d6efd;
|
||||
transition: width 0.3s ease;
|
||||
}
|
||||
.reference-number {
|
||||
text-align: center;
|
||||
color: #6c757d;
|
||||
font-size: 0.9rem;
|
||||
margin-top: 24px;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<template v-if="district">
|
||||
|
|
@ -38,6 +42,12 @@ body > .container-fluid {
|
|||
<template v-else>
|
||||
<p>loading {{ slug }}...</p>
|
||||
</template>
|
||||
<!-- Reference Number -->
|
||||
<div class="reference-number" v-if="report && report.public_id">
|
||||
<small>
|
||||
Reference number: <strong>{{ report.public_id }}</strong>
|
||||
</small>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ export const useStorePublicReport = defineStore("publicreport", () => {
|
|||
//const ongoingFetch = ref<Promise<PublicReport[]> | null>(null);
|
||||
|
||||
function add(pr: PublicReport) {
|
||||
_byID.value.set(pr.id, pr);
|
||||
_byID.value.set(pr.public_id, pr);
|
||||
}
|
||||
// Actions
|
||||
async function byID(id: string): Promise<PublicReport | undefined> {
|
||||
|
|
|
|||
|
|
@ -153,7 +153,6 @@ export interface ComplianceUpdate {
|
|||
comments?: string;
|
||||
gate_code?: string;
|
||||
has_dog?: boolean;
|
||||
//id: string;
|
||||
//images?: Image[];
|
||||
location?: Location;
|
||||
permission_type?: string;
|
||||
|
|
@ -166,7 +165,6 @@ export interface PublicReportDTO {
|
|||
//compliance?: PublicReportCompliance;
|
||||
created: string;
|
||||
district: string;
|
||||
id: string;
|
||||
images: Image[];
|
||||
location: Location;
|
||||
log: LogEntryDTO[];
|
||||
|
|
@ -182,7 +180,6 @@ export interface PublicReportOptions {
|
|||
address: Address;
|
||||
created: Date;
|
||||
district: string;
|
||||
id: string;
|
||||
images: Image[];
|
||||
location: Location;
|
||||
log: LogEntry[];
|
||||
|
|
@ -196,7 +193,6 @@ export class PublicReport {
|
|||
address: Address;
|
||||
created: Date;
|
||||
district: string;
|
||||
id: string;
|
||||
images: Image[];
|
||||
log: LogEntry[];
|
||||
public_id: string;
|
||||
|
|
@ -209,7 +205,6 @@ export class PublicReport {
|
|||
this.address = options?.address ?? new Address();
|
||||
this.created = options?.created ?? new Date();
|
||||
this.district = options?.district ?? "";
|
||||
this.id = options?.id ?? "";
|
||||
this.images = options?.images ?? [];
|
||||
this.log = options?.log ?? [];
|
||||
this.public_id = options?.public_id ?? "";
|
||||
|
|
@ -224,7 +219,6 @@ export class PublicReport {
|
|||
address: json.address,
|
||||
created: new Date(json.created),
|
||||
district: json.district,
|
||||
id: json.id,
|
||||
images: json.images,
|
||||
location: json.location,
|
||||
log: json.log.map((l: LogEntryDTO) => LogEntry.fromJSON(l)),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue