34 lines
811 B
TypeScript
34 lines
811 B
TypeScript
import { BaseModel } from './base.model';
|
|
|
|
export class ContactDetail extends BaseModel {
|
|
static tableName = 'contact_details';
|
|
|
|
id!: string;
|
|
relatedObjectType!: 'Account' | 'Contact';
|
|
relatedObjectId!: string;
|
|
detailType!: string;
|
|
label?: string;
|
|
value!: string;
|
|
isPrimary!: boolean;
|
|
|
|
// Provide optional relations for each supported parent type.
|
|
static relationMappings = {
|
|
account: {
|
|
relation: BaseModel.BelongsToOneRelation,
|
|
modelClass: 'account.model',
|
|
join: {
|
|
from: 'contact_details.relatedObjectId',
|
|
to: 'accounts.id',
|
|
},
|
|
},
|
|
contact: {
|
|
relation: BaseModel.BelongsToOneRelation,
|
|
modelClass: 'contact.model',
|
|
join: {
|
|
from: 'contact_details.relatedObjectId',
|
|
to: 'contacts.id',
|
|
},
|
|
},
|
|
};
|
|
}
|