domain

package
v0.0.0-...-c4b140d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCategoryAssignableLimitReached = errors.New("total category assignable limit reached")
View Source
var ErrContactSourcesLimitReached = errors.New("contact sources limit reached")
View Source
var ErrContactsLimitReached = errors.New("total contacts limit reached")
View Source
var GreaterThanOrEqual = ">="
View Source
var LessThanOrEqual = "<="

Functions

func GetBirthdayNumber

func GetBirthdayNumber(date time.Time) int

func GetBirthdayNumberFromString

func GetBirthdayNumberFromString(dateStr string) (number int, err error)

dateStr must of the format 'MM-dd"

func IsUpdated

func IsUpdated[T comparable](current []T, update []T) bool

func PareseBirthdayDate

func PareseBirthdayDate(dateStr string) (date time.Time, err error)

dateStr must of the format 'MM-dd"

Types

type Action

type Action string
const Create Action = "create"
const Delete Action = "delete"
const Update Action = "update"

type Address

type Address struct {
	City            string `firestore:"city,omitempty" json:"city,omitempty" fake:"{city}"`
	Country         string `firestore:"country,omitempty" json:"country,omitempty" fake:"{country}"`
	CountryCode     string `firestore:"country_code,omitempty" json:"country_code,omitempty" fake:"{countryabr}"`
	ExtendedAddress string `firestore:"extended_address,omitempty" json:"extended_address,omitempty" fake:"{street}, {streetnumber}, {city}"`
	PoBox           string `firestore:"po_box,omitempty" json:"po_box,omitempty"`
	PostalCode      string `firestore:"postal_code,omitempty" json:"postal_code,omitempty" fake:"{zip}"`
	Region          string `firestore:"region,omitempty" json:"region,omitempty" fake:"{state}"`
	StreetAddress   string `firestore:"street_address,omitempty" json:"street_address,omitempty" fake:"{street}"`
	Type            string `firestore:"type,omitempty" json:"type,omitempty"`
}

func (Address) MapToDto

func (address Address) MapToDto() (dto *models.Address)

type Birthday

type Birthday struct {
	Date string `firestore:"date,omitempty" json:"date,omitempty" fake:"{year}-{month}-{day}"`
	Text string `firestore:"text,omitempty" json:"text,omitempty" fake:"{year}-{month}-{day}"`
}

func (Birthday) MapToDto

func (birthday Birthday) MapToDto() (dto *models.Birthday)

type Contact

type Contact struct {
	ID             ContactID      `firestore:"id" json:"id"`
	DisplayName    string         `firestore:"display_name" json:"display_name"`
	Names          []*UserNames   `firestore:"names" json:"names"`
	Nicknames      []Nickname     `firestore:"nicknames" json:"nicknames" fakesize:"1"`
	Addresses      []Address      `firestore:"addresses" json:"addresses" fakesize:"1"`
	Birthdays      []Birthday     `firestore:"birthdays" json:"birthdays" fakesize:"1"`
	EmailAddresses []EmailAddress `firestore:"email_addresses" json:"email_addresses" fakesize:"1"`
	Genders        []Gender       `firestore:"genders" json:"genders" fakesize:"1"`
	Occupations    []Occupation   `firestore:"occupations" json:"occupations" fakesize:"1"`
	PhoneNumbers   []PhoneNumber  `firestore:"phone_numbers" json:"phone_numbers" fakesize:"1"`
	Photos         []Photo        `firestore:"photos" json:"photos" fakesize:"1"`
	Relations      []Relation     `firestore:"relations" json:"relations" fakesize:"1"`
	Urls           []Url          `firestore:"urls" json:"urls" fakesize:"1"`
	Organizations  []Organization `firestore:"organizations" json:"organizations" fakesize:"1"`
	CreatedAt      time.Time      `firestore:"created_at" json:"created_at"`
	UpdatedAt      time.Time      `firestore:"updated_at" json:"updated_at"`
}

func (*Contact) FromCsv

func (contact *Contact) FromCsv(dto CsvContact)

func (*Contact) FromDto

func (contact *Contact) FromDto(dto *models.CreateContactDto)

func (*Contact) FromUnified

func (contact *Contact) FromUnified(dto Unified)

func (Contact) IsUpdated

func (c Contact) IsUpdated(update Contact) bool

func (Contact) MapToDto

func (user Contact) MapToDto() (dto *models.Contact)

type ContactCatgeory

type ContactCatgeory string
const A ContactCatgeory = "A"
const B ContactCatgeory = "B"
const C ContactCatgeory = "C"
const D ContactCatgeory = "D"

func (ContactCatgeory) String

func (c ContactCatgeory) String() string

func (ContactCatgeory) Valid

func (catgeory ContactCatgeory) Valid() bool

type ContactID

type ContactID string

func (ContactID) String

func (c ContactID) String() string

type ContactLog

type ContactLog struct {
	ID        ContactLogId    `firestore:"id" json:"id"`
	UnifiedId UnifiedId       `firestore:"unified_id" json:"unified_id"`
	CreatedAt time.Time       `firestore:"created_at" json:"created_at"`
	Action    Action          `firestore:"action" json:"action"`
	Updates   *ContactUpdates `firestore:"updates" json:"updates"`
}

func NewContactLog

func NewContactLog(unified Unified, action Action) (log ContactLog)

type ContactLogId

type ContactLogId string

func (ContactLogId) String

func (id ContactLogId) String() string

type ContactOrigin

type ContactOrigin string

func NewContactOrigin

func NewContactOrigin(source Source, contactSourceId ContactSourceID, contactId ContactID) ContactOrigin

func (ContactOrigin) ContactId

func (c ContactOrigin) ContactId() (contactID ContactID)

func (ContactOrigin) Source

func (c ContactOrigin) Source() (source Source)

func (ContactOrigin) SourceId

func (c ContactOrigin) SourceId() (sourceId ContactSourceID)

func (ContactOrigin) String

func (c ContactOrigin) String() string

type ContactSearchFilter

type ContactSearchFilter struct {
	Field    SearchFilterField
	Operator SearchOperator
	Value    string
}

func MapSearchFilters

func MapSearchFilters(filters []*models.SearchFilter) (mapped []ContactSearchFilter)

type ContactSource

type ContactSource struct {
	ID        ContactSourceID `firestore:"id" json:"id"`
	UserID    UserID          `firestore:"user_id" json:"user_id"`
	CreatedAt time.Time       `firestore:"created_at" json:"created_at"`
	UpdatedAt time.Time       `firestore:"updated_at" json:"updated_at"`

	Source       Source    `firestore:"source" json:"source"`
	Email        string    `firestore:"email" json:"email"`
	GoogleUserId string    `firestore:"google_user_id" json:"google_user_id"`
	AccessToken  string    `firestore:"access_token" json:"access_token"`
	RefreshToken string    `firestore:"refresh_token" json:"refresh_token"`
	TokenExpiry  time.Time `firestore:"token_expiry" json:"token_expiry"`

	NextSyncAt time.Time `firestore:"next_sync_at" json:"next_sync_at"`
}

func (ContactSource) MapToDto

func (doc ContactSource) MapToDto() (dto *models.ContactSource)

type ContactSourceID

type ContactSourceID string

func (ContactSourceID) String

func (c ContactSourceID) String() string

type ContactSources

type ContactSources []ContactSource

func (ContactSources) MapToDto

func (docs ContactSources) MapToDto() (dto []*models.ContactSource)

type ContactUpdates

type ContactUpdates struct {
	Names          []*UserNames    `firestore:"names,omitempty" json:"names,omitempty"`
	Nicknames      []Nickname      `firestore:"nicknames,omitempty" json:"nicknames,omitempty" fakesize:"1"`
	Addresses      []Address       `firestore:"addresses,omitempty" json:"addresses,omitempty" fakesize:"1"`
	Birthdays      []Birthday      `firestore:"birthdays,omitempty" json:"birthdays,omitempty" fakesize:"1"`
	EmailAddresses []EmailAddress  `firestore:"email_addresses,omitempty" json:"email_addresses,omitempty" fakesize:"1"`
	Genders        []Gender        `firestore:"genders,omitempty" json:"genders,omitempty" fakesize:"1"`
	Occupations    []Occupation    `firestore:"occupations,omitempty" json:"occupations,omitempty" fakesize:"1"`
	PhoneNumbers   []PhoneNumber   `firestore:"phone_numbers,omitempty" json:"phone_numbers,omitempty" fakesize:"1"`
	Photos         []Photo         `firestore:"photos,omitempty" json:"photos,omitempty" fakesize:"1"`
	Relations      []Relation      `firestore:"relations,omitempty" json:"relations,omitempty" fakesize:"1"`
	Urls           []Url           `firestore:"urls,omitempty" json:"urls,omitempty" fakesize:"1"`
	Organizations  []Organization  `firestore:"organizations,omitempty" json:"organizations,omitempty" fakesize:"1"`
	NextContact    *time.Time      `firestore:"next_contact,omitempty" json:"next_contact,omitempty"`
	LastContact    *time.Time      `firestore:"last_contact,omitempty" json:"last_contact,omitempty"`
	Score          int             `firestore:"score,omitempty" json:"score,omitempty"`
	Category       ContactCatgeory `firestore:"category,omitempty" json:"category,omitempty"`
	Origins        map[string]bool `firestore:"origins,omitempty" json:"origins,omitempty"`
	SearchTerms    []string        `firestore:"search_terms,omitempty" json:"search_terms,omitempty"`
}

func (*ContactUpdates) FromUnified

func (contact *ContactUpdates) FromUnified(unified Unified)

type Contacts

type Contacts []Contact

func (Contacts) MapToDto

func (contacts Contacts) MapToDto() (dto []*models.Contact)

func (Contacts) MapToIds

func (contacts Contacts) MapToIds() (ids []ContactID)

type CsvContact

type CsvContact struct {
	DisplayName             string `csv:"display_name"`
	DisplayNameLastFirst    string `csv:"display_name_last_first"`
	FamilyName              string `csv:"family_name"`
	GivenName               string `csv:"given_name"`
	HonorificPrefix         string `csv:"honorific_prefix"`
	HonorificSuffix         string `csv:"honorific_suffix"`
	MiddleName              string `csv:"middle_name"`
	PhoneticFamilyName      string `csv:"phonetic_family_name"`
	PhoneticFullName        string `csv:"phonetic_full_name"`
	PhoneticGivenName       string `csv:"phonetic_given_name"`
	PhoneticHonorificPrefix string `csv:"phonetic_honorific_prefix"`
	PhoneticHonorificSuffix string `csv:"phonetic_honorific_suffix"`
	PhoneticMiddleName      string `csv:"phonetic_middle_name"`
	UnstructuredName        string `csv:"unstructured_name"`

	Nickname string `csv:"nickname"`

	City            string `csv:"city"`
	Country         string `csv:"country"`
	CountryCode     string `csv:"country_code"`
	ExtendedAddress string `csv:"extended_address"`
	PoBox           string `csv:"po_box"`
	PostalCode      string `csv:"postal_code"`
	Region          string `csv:"region"`
	StreetAddress   string `csv:"street_address"`
	AddressType     string `csv:"address_type"`

	BirthDate string `csv:"birth_date"`
	BirthText string `csv:"birth_text"`

	EmailDisplayName string `csv:"email_display_name"`
	EmailType        string `csv:"email_type"`
	Email            string `csv:"email"`

	AddressMeAs string `csv:"address_me_as"`
	Gender      string `csv:"gender"`

	Occupation string `csv:"occupation"`

	PhoneType string `csv:"phone_type"`
	Phone     string `csv:"phone"`

	PhotoDefault string `csv:"photo_default"`
	PhotoUrl     string `csv:"photo_url"`

	Relation     string `csv:"relation"`
	RelationType string `csv:"relation_type"`

	UrlType string `csv:"url_type"`
	Url     string `csv:"url"`

	Department       string `csv:"department"`
	Domain           string `csv:"domain"`
	EndDate          string `csv:"end_date"`
	JobDescription   string `csv:"job_description"`
	Location         string `csv:"location"`
	Name             string `csv:"name"`
	PhoneticName     string `csv:"phonetic_name"`
	StartDate        string `csv:"start_date"`
	Symbol           string `csv:"symbol"`
	Title            string `csv:"title"`
	OrganizationType string `csv:"organization_type"`
	IsCurrent        string `csv:"is_current"`
}

type EmailAddress

type EmailAddress struct {
	DisplayName string `firestore:"display_name,omitempty" json:"display_name,omitempty" fake:"{firstname}"`
	Type        string `firestore:"type,omitempty" json:"type,omitempty"`
	Value       string `firestore:"value,omitempty" json:"value,omitempty" fake:"{email}"`
}

func (EmailAddress) MapToDto

func (email EmailAddress) MapToDto() (dto *models.EmailAddress)

type Gender

type Gender struct {
	AddressMeAs string `firestore:"address_me_as,omitempty" json:"address_me_as,omitempty" fake:"{pronounpersonal}"`
	Value       string `firestore:"value,omitempty" json:"value,omitempty" fake:"{gender}"`
}

func (Gender) MapToDto

func (gender Gender) MapToDto() (dto *models.Gender)

type GoogleContact

type GoogleContact struct {
	ID             ContactID      `firestore:"id" json:"id"` // person id from google person
	Names          []*UserNames   `firestore:"names" json:"names"`
	Nicknames      []Nickname     `firestore:"nicknames" json:"nicknames" fakesize:"1"`
	Addresses      []Address      `firestore:"addresses" json:"addresses" fakesize:"1"`
	Birthdays      []Birthday     `firestore:"birthdays" json:"birthdays" fakesize:"1"`
	EmailAddresses []EmailAddress `firestore:"email_addresses" json:"email_addresses" fakesize:"1"`
	Genders        []Gender       `firestore:"genders" json:"genders" fakesize:"1"`
	Occupations    []Occupation   `firestore:"occupations" json:"occupations" fakesize:"1"`
	PhoneNumbers   []PhoneNumber  `firestore:"phone_numbers" json:"phone_numbers" fakesize:"1"`
	Photos         []Photo        `firestore:"photos" json:"photos" fakesize:"1"`
	Relations      []Relation     `firestore:"relations" json:"relations" fakesize:"1"`
	Urls           []Url          `firestore:"urls" json:"urls" fakesize:"1"`
	Organizations  []Organization `firestore:"organizations" json:"organizations" fakesize:"1"`
	CreatedAt      time.Time      `firestore:"created_at" json:"created_at"`
	UpdatedAt      time.Time      `firestore:"updated_at" json:"updated_at"`

	ResourceName string                 `firestore:"resource_name" json:"resource_name,omitempty"`
	Metadata     *people.PersonMetadata `firestore:"metadata" json:"metadata,omitempty"`
}

func (*GoogleContact) FromGooglePerson

func (contact *GoogleContact) FromGooglePerson(person *people.Person)

func (GoogleContact) IsContactDataUpdated

func (c GoogleContact) IsContactDataUpdated(update GoogleContact) bool

func (GoogleContact) MapToDomain

func (user GoogleContact) MapToDomain() (dto Contact)

type LinkMatch

type LinkMatch struct {
	UnifiedId   UnifiedId `firestore:"unified_id" json:"unified_id"`
	DisplayName string    `firestore:"display_name" json:"display_name"`
}

func (LinkMatch) MapToDto

func (match LinkMatch) MapToDto() (dto *models.LinkMatch)

type LinkSuggestion

type LinkSuggestion struct {
	ID      LinkSuggestionID  `firestore:"id" json:"id"`
	Key     LinkSuggestionKey `firestore:"key" json:"key"`
	Value   string            `firestore:"value" json:"value"`
	Matches []LinkMatch       `firestore:"matches" json:"matches"`
}

func (LinkSuggestion) MapToDto

func (suggestion LinkSuggestion) MapToDto() (dto *models.LinkSuggestion)

type LinkSuggestionID

type LinkSuggestionID string

func (LinkSuggestionID) String

func (c LinkSuggestionID) String() string

type LinkSuggestionKey

type LinkSuggestionKey string
const KeyEmail LinkSuggestionKey = "email"
const KeyName LinkSuggestionKey = "name"
const KeyPhone LinkSuggestionKey = "phone"

func (LinkSuggestionKey) String

func (c LinkSuggestionKey) String() string

type LinkSuggestions

type LinkSuggestions []LinkSuggestion

func (LinkSuggestions) MapToDto

func (suggestions LinkSuggestions) MapToDto() (dto []*models.LinkSuggestion)

type Nickname

type Nickname struct {
	Value string `firestore:"value,omitempty" json:"value,omitempty" fake:"{firstname}"`
}

func (Nickname) MapToDto

func (name Nickname) MapToDto() (dto *models.Nickname)

type Note

type Note struct {

	// created at
	CreatedAt time.Time `firestore:"created_at" json:"created_at,omitempty"`

	// id
	ID NoteID `firestore:"id" json:"id,omitempty"`

	// is updated
	IsUpdated bool `firestore:"is_updated" json:"is_updated,omitempty"`

	// note
	Note string `firestore:"note" json:"note,omitempty" fake:"{sentence:5}"`
}

func (*Note) FromDto

func (user *Note) FromDto(dto *models.Note)

func (*Note) MapToDto

func (note *Note) MapToDto() (dto *models.Note)

type NoteID

type NoteID string

func (NoteID) String

func (c NoteID) String() string

type Notes

type Notes []Note

func (Notes) MapToDto

func (notes Notes) MapToDto() (dto []*models.Note)

type Occupation

type Occupation struct {
	Value string `firestore:"value,omitempty" json:"value,omitempty" fake:"{jobtitle}"`
}

func (Occupation) MapToDto

func (occupation Occupation) MapToDto() (dto *models.Occupation)

type Organization

type Organization struct {
	Department     string `firestore:"department,omitempty" json:"department,omitempty"`
	Domain         string `firestore:"domain,omitempty" json:"domain,omitempty"`
	EndDate        string `firestore:"end_date,omitempty" json:"end_date,omitempty" fake:"{year}-{month}-{day}"`
	JobDescription string `firestore:"job_description,omitempty" json:"job_description,omitempty" fake:"{sentence:3}"`
	Location       string `firestore:"location,omitempty" json:"location,omitempty"`
	Name           string `firestore:"name,omitempty" json:"name,omitempty" fake:"{company}"`
	PhoneticName   string `firestore:"phonetic_name,omitempty" json:"phonetic_name,omitempty" fake:"{company}"`
	StartDate      string `firestore:"start_date,omitempty" json:"start_date,omitempty" fake:"{year}-{month}-{day}"`
	Symbol         string `firestore:"symbol,omitempty" json:"symbol,omitempty"`
	Title          string `firestore:"title,omitempty" json:"title,omitempty" fake:"{jobtitle}"`
	Type           string `firestore:"type,omitempty" json:"type,omitempty"`
	IsCurrent      bool   `firestore:"is_current,omitempty" json:"is_current,omitempty"`
}

func (Organization) MapToDto

func (organization Organization) MapToDto() (dto *models.Organization)

type PhoneNumber

type PhoneNumber struct {
	Type  string `firestore:"type,omitempty" json:"type,omitempty"`
	Value string `firestore:"value,omitempty" json:"value,omitempty" fake:"{phone}"`
}

func (PhoneNumber) MapToDto

func (phone PhoneNumber) MapToDto() (dto *models.PhoneNumber)

type Photo

type Photo struct {
	Default bool   `firestore:"default,omitempty" json:"default,omitempty"`
	Url     string `firestore:"url,omitempty" json:"url,omitempty" fake:"{url}"`
}

func (Photo) MapToDto

func (phone Photo) MapToDto() (dto *models.Photo)

type Quota

type Quota struct {

	// counter to track total number of contacts added
	TotalContacts int64 `firestore:"total_contacts" json:"total_contacts"`

	// counter to track total number of contacts with category assigned
	TotalCategoryAssigned int64 `firestore:"total_category_assigned" json:"total_category_assigned"`

	// total contact sources
	TotalContactSources int64 `firestore:"total_contact_sources" json:"total_contact_sources"`
}

active subscription/role can be queried from /customers/userId/subscriptions collection where status is active firebase token includes stripeRole

func (*Quota) CategoryAssigned

func (q *Quota) CategoryAssigned() int64

func (*Quota) ContactSources

func (q *Quota) ContactSources() int64

func (*Quota) Contacts

func (q *Quota) Contacts() int64

func (Quota) MapToDto

func (q Quota) MapToDto() (dto *models.Quota)

type Relation

type Relation struct {
	Person string `firestore:"person,omitempty" json:"person,omitempty"`
	Type   string `firestore:"type,omitempty" json:"type,omitempty"`
}

func (Relation) MapToDto

func (relation Relation) MapToDto() (dto *models.Relation)

type Role

type Role string
const Role1000 Role = "1000"
const Role1500 Role = "1500"
const Role2000 Role = "2000"
const Role2500 Role = "2500"
const Role3000 Role = "3000"
const RoleContactSync Role = "contactSync"
const RoleFree Role = "Free"

func (*Role) MaxCategoryAssignable

func (role *Role) MaxCategoryAssignable() int64

func (*Role) MaxContactSources

func (role *Role) MaxContactSources() int64

func (*Role) MaxContacts

func (role *Role) MaxContacts() int64

type SearchFilterField

type SearchFilterField string
var BirthdayField SearchFilterField = "birthday"
var CategoryField SearchFilterField = "category"
var ContactField SearchFilterField = "next_contact"
var GenderField SearchFilterField = "genders"
var LastContactField SearchFilterField = "last_contact"
var ScoreField SearchFilterField = "score"

func (SearchFilterField) String

func (c SearchFilterField) String() string

type SearchOperator

type SearchOperator string
var Equal SearchOperator = "="
var GreaterThan SearchOperator = ">"
var LessThan SearchOperator = "<"
var NotEqual SearchOperator = "!="

func (SearchOperator) String

func (c SearchOperator) String() string

type SearchParams

type SearchParams struct {
	Filters []ContactSearchFilter
	Query   string
	Sort    []Sort
	Page    int
	PerPage int
}

func (*SearchParams) FromModel

func (params *SearchParams) FromModel(model *models.SearchContactDto)

type Sort

type Sort struct {
	Field string
	Order SortOrder
}

func MapSearchSorts

func MapSearchSorts(sorts []*models.SearchSort) (mapped []Sort)

type SortOrder

type SortOrder string
var ASC SortOrder = "asc"
var Desc SortOrder = "desc"

type Source

type Source string
const Default Source = "default"
const Google Source = "google"

func (Source) String

func (c Source) String() string

type Tag

type Tag struct {

	// created at
	CreatedAt time.Time `firestore:"created_at" json:"created_at,omitempty"`

	// id
	ID TagID `firestore:"id" json:"id,omitempty"`

	// tag name
	TagName string `firestore:"tag_name" json:"tag_name,omitempty" fake:"{noun}"`
}

func (*Tag) FromDto

func (tag *Tag) FromDto(dto *models.Tag)

func (*Tag) MapToDto

func (tag *Tag) MapToDto() (dto *models.Tag)

type TagID

type TagID string

func (TagID) String

func (c TagID) String() string

type Tags

type Tags []Tag

func (Tags) MapToDto

func (tags Tags) MapToDto() (dto []*models.Tag)

type Unified

type Unified struct {
	ID          UnifiedId `firestore:"id" json:"id"`
	DisplayName string    `firestore:"display_name" json:"display_name"`

	Names          []*UserNames    `firestore:"names" json:"names"`
	Nicknames      []Nickname      `firestore:"nicknames" json:"nicknames" fakesize:"1"`
	Addresses      []Address       `firestore:"addresses" json:"addresses" fakesize:"1"`
	Birthdays      []Birthday      `firestore:"birthdays" json:"birthdays" fakesize:"1"`
	EmailAddresses []EmailAddress  `firestore:"email_addresses" json:"email_addresses" fakesize:"1"`
	Genders        []Gender        `firestore:"genders" json:"genders" fakesize:"1"`
	Occupations    []Occupation    `firestore:"occupations" json:"occupations" fakesize:"1"`
	PhoneNumbers   []PhoneNumber   `firestore:"phone_numbers" json:"phone_numbers" fakesize:"1"`
	Photos         []Photo         `firestore:"photos" json:"photos" fakesize:"1"`
	Relations      []Relation      `firestore:"relations" json:"relations" fakesize:"1"`
	Urls           []Url           `firestore:"urls" json:"urls" fakesize:"1"`
	Organizations  []Organization  `firestore:"organizations" json:"organizations" fakesize:"1"`
	CreatedAt      time.Time       `firestore:"created_at" json:"created_at"`
	UpdatedAt      time.Time       `firestore:"updated_at" json:"updated_at"`
	NextContact    *time.Time      `firestore:"next_contact" json:"next_contact"`
	LastContact    *time.Time      `firestore:"last_contact" json:"last_contact"`
	Score          int             `firestore:"score" json:"score"`
	Category       ContactCatgeory `firestore:"category" json:"category"`

	// Fields unique to unified
	// contact sources from which this unified contact is created/linked
	Origins     map[string]bool `firestore:"origins" json:"origins"`
	SearchTerms []string        `firestore:"search_terms" json:"search_terms"`
}

func (Unified) ComputeSearchTerms

func (contact Unified) ComputeSearchTerms() (terms []string)

func (*Unified) FromContact

func (contact *Unified) FromContact(dto Contact, sourceId ContactOrigin)

func (*Unified) FromDto

func (contact *Unified) FromDto(dto *models.Unified)

TODO: type of param dto will be renamed to *models.CreateUserParams

func (*Unified) FromUpdateDto

func (contact *Unified) FromUpdateDto(dto *models.UpdateUnifiedDto)

func (Unified) GetDisplayName

func (u Unified) GetDisplayName() string

func (Unified) MapToDto

func (user Unified) MapToDto() (dto *models.Unified)

func (*Unified) Merge

func (u *Unified) Merge(duplicate Unified)

func (*Unified) MergeAddresses

func (u *Unified) MergeAddresses(duplicate []Address)

func (*Unified) MergeBirthDays

func (u *Unified) MergeBirthDays(duplicate []Birthday)

func (*Unified) MergeEmails

func (u *Unified) MergeEmails(duplicate []EmailAddress)

func (*Unified) MergeGenders

func (u *Unified) MergeGenders(duplicate []Gender)

func (*Unified) MergeNicknames

func (u *Unified) MergeNicknames(duplicate []Nickname)

func (*Unified) MergeOccupations

func (u *Unified) MergeOccupations(duplicate []Occupation)

func (*Unified) MergeOrganizations

func (u *Unified) MergeOrganizations(duplicate []Organization)

func (*Unified) MergePhones

func (u *Unified) MergePhones(duplicate []PhoneNumber)

func (*Unified) MergePhotos

func (u *Unified) MergePhotos(duplicate []Photo)

func (*Unified) MergeRelations

func (u *Unified) MergeRelations(duplicate []Relation)

func (*Unified) MergeUrls

func (u *Unified) MergeUrls(duplicate []Url)

type UnifiedContacts

type UnifiedContacts []Unified

func (UnifiedContacts) FilterByEmail

func (contacts UnifiedContacts) FilterByEmail(emailFilter string) (filtered []Unified)

func (UnifiedContacts) FilterByFamilyName

func (contacts UnifiedContacts) FilterByFamilyName(nameFilter string) (filtered []Unified)

func (UnifiedContacts) FilterByGivenName

func (contacts UnifiedContacts) FilterByGivenName(nameFilter string) (filtered []Unified)

func (UnifiedContacts) FilterByMiddleName

func (contacts UnifiedContacts) FilterByMiddleName(nameFilter string) (filtered []Unified)

func (UnifiedContacts) FilterByPhone

func (contacts UnifiedContacts) FilterByPhone(phoneFilter string) (filtered []Unified)

func (UnifiedContacts) MapToDto

func (contacts UnifiedContacts) MapToDto() (dto []*models.Unified)

type UnifiedId

type UnifiedId string

func (UnifiedId) String

func (c UnifiedId) String() string

type UnifiedIds

type UnifiedIds []UnifiedId

func (*UnifiedIds) FromArray

func (c *UnifiedIds) FromArray(ids []string)

type UnifiedSearch

type UnifiedSearch struct {
	ID             UnifiedSearchId `json:"id"`
	UnifiedId      UnifiedId       `json:"unified_id"`
	UserId         UserID          `json:"user_id"`
	DisplayName    string          `json:"display_name"`
	Names          []string        `json:"names"`
	Nicknames      []string        `json:"nicknames"`
	EmailAddresses []string        `json:"email_addresses" fakesize:"1"`
	Addresses      []string        `json:"addresses"`
	Genders        []string        `json:"genders"`
	Occupations    []string        `json:"occupations"`
	Organizations  []string        `json:"organizations"`
	PhoneNumbers   []string        `json:"phone_numbers"`
	Birthday       *int64          `json:"birthday"`
	NextContact    *int64          `json:"next_contact"` // unix timestamp
	LastContact    *int64          `json:"last_contact"` // unix timestamp
	Score          int             `json:"score"`
	Category       ContactCatgeory `json:"category"`
	BirthdayNumber *int            `json:"birthday_number"`
}

type UnifiedSearchId

type UnifiedSearchId string

type UnifiedSearchResults

type UnifiedSearchResults []UnifiedSearch

func (UnifiedSearchResults) MapToUnifiedIds

func (results UnifiedSearchResults) MapToUnifiedIds() (ids []UnifiedId)

type Url

type Url struct {
	Type  string `firestore:"type,omitempty" json:"type,omitempty"`
	Value string `firestore:"value,omitempty" json:"value,omitempty" fake:"{url}"`
}

func (Url) MapToDto

func (url Url) MapToDto() (dto *models.URL)

type User

type User struct {
	ID             UserID         `firestore:"id" json:"id"`
	Names          []UserNames    `firestore:"names" json:"names"`
	Nicknames      []Nickname     `firestore:"nicknames" json:"nicknames" fakesize:"1"`
	Addresses      []Address      `firestore:"addresses" json:"addresses" fakesize:"1"`
	Birthdays      []Birthday     `firestore:"birthdays" json:"birthdays" fakesize:"1"`
	EmailAddresses []EmailAddress `firestore:"email_addresses" json:"email_addresses" fakesize:"1"`
	Genders        []Gender       `firestore:"genders" json:"genders" fakesize:"1"`
	Occupations    []Occupation   `firestore:"occupations" json:"occupations" fakesize:"1"`
	PhoneNumbers   []PhoneNumber  `firestore:"phone_numbers" json:"phone_numbers" fakesize:"1"`
	Photos         []Photo        `firestore:"photos" json:"photos" fakesize:"1"`
	Relations      []Relation     `firestore:"relations" json:"relations" fakesize:"1"`
	Urls           []Url          `firestore:"urls" json:"urls" fakesize:"1"`
	Organizations  []Organization `firestore:"organizations" json:"organizations" fakesize:"1"`
	CreatedAt      time.Time      `firestore:"created_at" json:"created_at"`
	UpdatedAt      time.Time      `firestore:"updated_at" json:"updated_at"`

	Quota *Quota `firestore:"quota" json:"quota"`
}

func (*User) AddToTotalCategoryAssigned

func (u *User) AddToTotalCategoryAssigned(count int64)

func (*User) AddToTotalContactSources

func (u *User) AddToTotalContactSources(count int64)

func (*User) AddToTotalContacts

func (u *User) AddToTotalContacts(count int64)

func (*User) FromDto

func (user *User) FromDto(dto *models.User)

TODO: type of param dto will be renamed to *models.CreateUserParams

func (*User) InitQuota

func (u *User) InitQuota()

func (User) MapToDto

func (user User) MapToDto() (dto *models.User)

type UserID

type UserID string

func (UserID) String

func (c UserID) String() string

type UserNames

type UserNames struct {
	DisplayName             string `firestore:"display_name,omitempty" json:"display_name,omitempty" fake:"{firstname}"`
	DisplayNameLastFirst    string `firestore:"display_name_last_first,omitempty" json:"display_name_last_first,omitempty" fake:"{firstname} {lastname}"`
	FamilyName              string `firestore:"family_name,omitempty" json:"family_name,omitempty" fake:"{lastname}"`
	GivenName               string `firestore:"given_name,omitempty" json:"given_name,omitempty" fake:"{lastname}"`
	HonorificPrefix         string `firestore:"honorific_prefix,omitempty" json:"honorific_prefix,omitempty"`
	HonorificSuffix         string `firestore:"honorific_suffix,omitempty" json:"honorific_suffix,omitempty"`
	MiddleName              string `firestore:"middle_name,omitempty" json:"middle_name,omitempty" fake:"{lastname}"`
	PhoneticFamilyName      string `firestore:"phonetic_family_name,omitempty" json:"phonetic_family_name,omitempty" fake:"{lastname}"`
	PhoneticFullName        string `firestore:"phonetic_full_name,omitempty" json:"phonetic_full_name,omitempty" fake:"{firstname} {lastname}"`
	PhoneticGivenName       string `firestore:"phonetic_given_name,omitempty" json:"phonetic_given_name,omitempty" fake:"{firstname}"`
	PhoneticHonorificPrefix string `firestore:"phonetic_honorific_prefix,omitempty" json:"phonetic_honorific_prefix,omitempty"`
	PhoneticHonorificSuffix string `firestore:"phonetic_honorific_suffix,omitempty" json:"phonetic_honorific_suffix,omitempty"`
	PhoneticMiddleName      string `firestore:"phonetic_middle_name,omitempty" json:"phonetic_middle_name,omitempty" fake:"{lastname}"`
	UnstructuredName        string `firestore:"unstructured_name,omitempty" json:"unstructured_name,omitempty" fake:"{firstname} {lastname}"`
}

func (UserNames) MapToDto

func (name UserNames) MapToDto() (dto *models.UserNames)

func (*UserNames) Merge

func (name *UserNames) Merge(duplicate *UserNames)

type Users

type Users []User

func (Users) MapToDto

func (users Users) MapToDto() (dto []*models.User)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL