@jrs-test/jrs-common
Version:
Types and functions for use in the JRS project
106 lines (102 loc) • 2.64 kB
text/typescript
import { ObjectId } from 'mongodb';
type Address = {
address1: string;
address2?: string;
city: string;
county: string;
state: string;
zipCode: string;
zipCodeStandardize: string;
zipCodePlusFour?: string;
country: string;
};
type StandardizedAddressComponent = {
componentName: {
text: string;
languageCode: string;
};
componentType: string;
confirmationLevel: string;
inferred?: boolean;
};
type LocationBase = {
locationNumber?: number;
name: string;
phone: string;
address: Address;
contactRoleAssignments: {
appointmentContact: {
displayName: string;
address: Address;
};
invoiceContact: {
displayName: string;
address: Address;
};
certificateContact: {
displayName: string;
address: Address;
};
ownerContact: {
displayName: string;
address: Address;
};
};
isAddressValidated?: boolean;
validatedAddress?: StandardizedAddressComponent[];
geocodes?: {
latitude: number;
longitude: number;
};
};
type LocationBE = LocationBase & {
_id?: ObjectId;
jurisdictionBusinessProfileIds: ObjectId[];
contactRoleAssignments: {
appointmentContact: {
contactId?: ObjectId;
};
invoiceContact: {
contactId?: ObjectId;
};
certificateContact: {
contactId?: ObjectId;
};
ownerContact: {
contactId?: ObjectId;
};
};
userDefinedFieldValues: LocationUserDefinedFieldBE[] | null;
};
type LocationFE = LocationBase & {
id: string;
jurisdictionBusinessProfileIds: string[];
contactRoleAssignments: {
appointmentContact: {
contactId?: string;
};
invoiceContact: {
contactId?: string;
};
certificateContact: {
contactId?: string;
};
ownerContact: {
contactId?: string;
};
};
appointmentContactId: string;
invoiceContactId: string;
certificateContactId: string;
ownerContactId: string;
userDefinedFieldValues: LocationUserDefinedFieldFE[] | null;
};
type LocationUserDefinedFieldBE = {
businessProfileId: ObjectId;
[key: string]: string | ObjectId;
};
type LocationUserDefinedFieldFE = {
businessProfileId: string;
[key: string]: string;
};
export type { Address, LocationBE, LocationFE, LocationUserDefinedFieldBE, LocationUserDefinedFieldFE, StandardizedAddressComponent };