Skip to content

Instantly share code, notes, and snippets.

@fireflysemantics
Created January 24, 2020 16:29
Show Gist options
  • Save fireflysemantics/691abe8645d212d647f4174271e1a8a2 to your computer and use it in GitHub Desktop.
Save fireflysemantics/691abe8645d212d647f4174271e1a8a2 to your computer and use it in GitHub Desktop.
/*
* Class mapped to the the contacts table in db.ts by the line:
* db.contacts.mapToClass(Contact)
*/
export class Contact extends AbstractEntity {
emails: EmailAddress[]
phones: PhoneNumber[]
constructor(
public firstName: string,
public lastName: string,
gid?: string
) {
super(gid)
// Define navigation properties.
// Making them non-enumerable will prevent them from being handled by indexedDB
// when doing put() or add().
Object.defineProperties(this, {
emails: { value: [], enumerable: false, writable: true },
phones: { value: [], enumerable: false, writable: true }
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment