WIP: creating contact resource
Some checks failed
/ golint (push) Has been cancelled

This commit is contained in:
Eli Ribble 2026-05-15 20:10:14 +00:00
parent 8b203908a0
commit 725945d95c
No known key found for this signature in database
22 changed files with 381 additions and 135 deletions

View file

@ -77,28 +77,47 @@ export class Bounds {
}
}
export interface ContactOptions {
can_sms: boolean;
email?: string;
has_email: boolean;
has_phone: boolean;
emails?: string[];
name?: string;
phone?: string;
phones?: Phone[];
uri?: string;
}
export interface Phone {
can_sms: boolean;
e164: string;
}
export interface PhoneReporter {
can_sms: boolean;
number: string;
}
export class Contact {
can_sms: boolean;
email: string;
has_email: boolean;
has_phone: boolean;
emails: string[];
name: string;
phone: string;
phones: Phone[];
uri: string;
constructor(options?: ContactOptions) {
this.can_sms = options?.can_sms ?? false;
this.email = options?.email ?? "";
this.has_email = options?.has_email ?? false;
this.has_phone = options?.has_phone ?? false;
this.emails = options?.emails ?? [];
this.name = options?.name ?? "";
this.phone = options?.phone ?? "";
this.phones = options?.phones ?? [];
this.uri = options?.uri ?? "";
}
static fromJSON(json: ContactDTO): Contact {
return new Contact(json);
}
}
export interface ContactDTO {
name: string;
emails: string[];
phones: Phone[];
uri: string;
}
export class ContactReporter {
constructor(
public name: string,
public email: string,
public phone: Phone,
public uri: string,
) {}
}
export interface District {
name: string;
@ -195,7 +214,7 @@ export interface ComplianceUpdate {
//images?: Image[];
location?: Location;
permission_type?: string;
reporter?: Contact;
reporter?: ContactReporter;
submitted?: string;
//uri: string;
wants_scheduled?: boolean;
@ -212,7 +231,7 @@ export interface PublicReportDTO {
location: Location;
log: LogEntryDTO[];
public_id: string;
reporter: Contact;
reporter: ContactReporter;
status: string;
type: string;
uri: string;
@ -224,7 +243,7 @@ export interface PublicReportUpdate {
images?: Image[];
location?: Location;
public_id?: string;
reporter?: Contact;
reporter?: ContactReporter;
status?: string;
type?: string;
uri?: string;
@ -242,7 +261,7 @@ export interface PublicReportOptions {
location: Location;
log: LogEntry[];
public_id: string;
reporter: Contact;
reporter: ContactReporter;
status: string;
type: string;
uri: string;
@ -254,7 +273,7 @@ export class PublicReport {
images: Image[];
log: LogEntry[];
public_id: string;
reporter: Contact;
reporter: ContactReporter;
status: string;
type: string;
uri: string;
@ -266,7 +285,7 @@ export class PublicReport {
this.images = options?.images ?? [];
this.log = options?.log ?? [];
this.public_id = options?.public_id ?? "";
this.reporter = options?.reporter ?? new Contact();
this.reporter = options?.reporter ?? new ContactReporter();
this.status = options?.status ?? "";
this.type = options?.type ?? "";
this.uri = options?.uri ?? "";