Fix populating water report from ID, make ContactSimple
ContactSimple is the replacement for ContactReporter, which was the simplified form of a contact from a report. I made the name more generic and use it in the general report structures for consistency.
This commit is contained in:
parent
75d0283453
commit
5e103f46a0
14 changed files with 103 additions and 108 deletions
|
|
@ -103,23 +103,23 @@ export interface ContactDTO {
|
|||
phones: Phone[];
|
||||
uri: string;
|
||||
}
|
||||
export interface ContactReporterOptions {
|
||||
export interface ContactSimpleOptions {
|
||||
email?: string;
|
||||
name?: string;
|
||||
phone?: Phone;
|
||||
phone?: PhoneSimple;
|
||||
uri?: string;
|
||||
}
|
||||
export class ContactReporter {
|
||||
export class ContactSimple {
|
||||
email: string;
|
||||
name: string;
|
||||
phone: Phone;
|
||||
phone: PhoneSimple;
|
||||
uri: string;
|
||||
constructor(options?: ContactReporterOptions) {
|
||||
constructor(options?: ContactSimpleOptions) {
|
||||
this.email = options?.email ?? "";
|
||||
this.name = options?.name ?? "";
|
||||
this.phone = options?.phone ?? {
|
||||
e164: "",
|
||||
can_sms: true,
|
||||
number: "",
|
||||
};
|
||||
this.uri = options?.uri ?? "";
|
||||
}
|
||||
|
|
@ -219,7 +219,7 @@ export interface ComplianceUpdate {
|
|||
//images?: Image[];
|
||||
location?: Location;
|
||||
permission_type?: string;
|
||||
reporter?: ContactReporter;
|
||||
reporter?: ContactSimple;
|
||||
submitted?: string;
|
||||
//uri: string;
|
||||
wants_scheduled?: boolean;
|
||||
|
|
@ -236,7 +236,7 @@ export interface PublicReportDTO {
|
|||
location: Location;
|
||||
log: LogEntryDTO[];
|
||||
public_id: string;
|
||||
reporter: ContactReporter;
|
||||
reporter: ContactSimple;
|
||||
status: string;
|
||||
type: string;
|
||||
uri: string;
|
||||
|
|
@ -248,7 +248,7 @@ export interface PublicReportUpdate {
|
|||
images?: Image[];
|
||||
location?: Location;
|
||||
public_id?: string;
|
||||
reporter?: ContactReporter;
|
||||
reporter?: ContactSimple;
|
||||
status?: string;
|
||||
type?: string;
|
||||
uri?: string;
|
||||
|
|
@ -266,7 +266,7 @@ export interface PublicReportOptions {
|
|||
location: Location;
|
||||
log: LogEntry[];
|
||||
public_id: string;
|
||||
reporter: ContactReporter;
|
||||
reporter: ContactSimple;
|
||||
status: string;
|
||||
type: string;
|
||||
uri: string;
|
||||
|
|
@ -278,7 +278,7 @@ export class PublicReport {
|
|||
images: Image[];
|
||||
log: LogEntry[];
|
||||
public_id: string;
|
||||
reporter: ContactReporter;
|
||||
reporter: ContactSimple;
|
||||
status: string;
|
||||
type: string;
|
||||
uri: string;
|
||||
|
|
@ -290,7 +290,7 @@ export class PublicReport {
|
|||
this.images = options?.images ?? [];
|
||||
this.log = options?.log ?? [];
|
||||
this.public_id = options?.public_id ?? "";
|
||||
this.reporter = options?.reporter ?? new ContactReporter();
|
||||
this.reporter = options?.reporter ?? new ContactSimple();
|
||||
this.status = options?.status ?? "";
|
||||
this.type = options?.type ?? "";
|
||||
this.uri = options?.uri ?? "";
|
||||
|
|
@ -469,7 +469,7 @@ export interface PublicReportWaterDTO extends PublicReportDTO {
|
|||
has_pupae: boolean;
|
||||
is_reporter_confidential: boolean;
|
||||
is_reporter_owner: boolean;
|
||||
owner: Contact;
|
||||
owner: ContactSimple;
|
||||
}
|
||||
export interface PublicReportWaterOptions extends PublicReportOptions {
|
||||
access_comments: string;
|
||||
|
|
@ -485,7 +485,7 @@ export interface PublicReportWaterOptions extends PublicReportOptions {
|
|||
has_pupae: boolean;
|
||||
is_reporter_confidential: boolean;
|
||||
is_reporter_owner: boolean;
|
||||
owner: Contact;
|
||||
owner: ContactSimple;
|
||||
}
|
||||
export class PublicReportWater extends PublicReport {
|
||||
access_comments: string;
|
||||
|
|
@ -501,7 +501,7 @@ export class PublicReportWater extends PublicReport {
|
|||
has_pupae: boolean;
|
||||
is_reporter_confidential: boolean;
|
||||
is_reporter_owner: boolean;
|
||||
owner: Contact;
|
||||
owner: ContactSimple;
|
||||
constructor(options: PublicReportWaterOptions) {
|
||||
super(options);
|
||||
this.access_comments = options.access_comments;
|
||||
|
|
@ -848,6 +848,10 @@ export interface Phone {
|
|||
can_sms: boolean;
|
||||
e164: string;
|
||||
}
|
||||
export interface PhoneSimple {
|
||||
can_sms: boolean;
|
||||
number: string;
|
||||
}
|
||||
export interface PhoneReporter {
|
||||
can_sms: boolean;
|
||||
number: string;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue