repository

package
v0.0.0-...-23e3271 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2025 License: Apache-2.0 Imports: 24 Imported by: 15

Documentation

Index

Constants

View Source
const (
	ContactSearchParamStage = "STAGE"
)
View Source
const (
	OrganizationSearchParamStage = "STAGE"
)
View Source
const (
	Relationship_Subsidiary = "SUBSIDIARY_OF"
)

Variables

This section is empty.

Functions

func LogAndExecuteWriteQuery

func LogAndExecuteWriteQuery(ctx context.Context, driver neo4j.DriverWithContext, cypher string, params map[string]any, span opentracing.Span) error

func WaitForNodeCreatedInNeo4j

func WaitForNodeCreatedInNeo4j(ctx context.Context, repositories *Repositories, id, nodeLabel string, span opentracing.Span)

func WaitForNodeCreatedInNeo4jWithConfig

func WaitForNodeCreatedInNeo4jWithConfig(ctx context.Context, span opentracing.Span, repositories *Repositories, id, nodeLabel string, maxWaitTime time.Duration)

func WaitForNodeDeletedFromNeo4j

func WaitForNodeDeletedFromNeo4j(ctx context.Context, repositories *Repositories, id, nodeLabel string, span opentracing.Span)

Types

type ActionReadRepository

type ActionReadRepository interface {
	GetFor(ctx context.Context, tenant string, entityType model.EntityType, entityIds []string) ([]*utils.DbNodeAndId, error)
	GetLastAction(ctx context.Context, tenant, entityId string, entityType model.EntityType, actionType enum.ActionType) (*dbtype.Node, error)
}

func NewActionReadRepository

func NewActionReadRepository(driver *neo4j.DriverWithContext, database string) ActionReadRepository

type ActionWriteRepository

type ActionWriteRepository interface {
	Create(ctx context.Context, tenant, entityId string, entityType model.EntityType, actionType enum.ActionType, content, metadata string, createdAt time.Time, appSource string) (*dbtype.Node, error)
	CreateWithProperties(ctx context.Context, tenant, entityId string, entityType model.EntityType, actionType enum.ActionType, content, metadata string, createdAt time.Time, appSource string, extraProperties map[string]any) (*dbtype.Node, error)
	MergeByActionType(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, entityId string, entityType model.EntityType, actionType enum.ActionType, content, metadata string, createdAt time.Time, appSource string) (*dbtype.Node, error)
}

func NewActionWriteRepository

func NewActionWriteRepository(driver *neo4j.DriverWithContext, database string) ActionWriteRepository

type AddressDetails

type AddressDetails struct {
	Latitude      *float64 `json:"latitude"`
	Longitude     *float64 `json:"longitude"`
	Country       string   `json:"country"`
	CountryCodeA2 string   `json:"countryCodeA2"`
	CountryCodeA3 string   `json:"countryCodeA3"`
	Region        string   `json:"region"`
	District      string   `json:"district"`
	Locality      string   `json:"locality"`
	Street        string   `json:"street"`
	Address       string   `json:"address"`
	Address2      string   `json:"address2"`
	Zip           string   `json:"zip"`
	AddressType   string   `json:"addressType"`
	HouseNumber   string   `json:"houseNumber"`
	PostalCode    string   `json:"postalCode"`
	PlusFour      string   `json:"plusFour"`
	Commercial    bool     `json:"commercial"`
	Predirection  string   `json:"predirection"`
	TimeZone      string   `json:"timeZone"`
	UtcOffset     *float64 `json:"utcOffset"`
}

type AttachmentReadRepository

type AttachmentReadRepository interface {
	GetById(ctx context.Context, tenant string, id string) (*neo4j.Node, error)
	GetFor(ctx context.Context, tenant string, entityType neo4jenum.EntityType, entityRelation *neo4jenum.EntityRelation, ids []string) ([]*utils.DbNodeAndId, error)
}

func NewAttachmentReadRepository

func NewAttachmentReadRepository(driver *neo4j.DriverWithContext, database string) AttachmentReadRepository

type AttachmentWriteRepository

type AttachmentWriteRepository interface {
	Create(ctx context.Context, tx neo4j.ManagedTransaction, tenant, id, cdnUrl, basePath, fileName, mimeType string, size int64, createdAt *time.Time, source, sourceOfTruth neo4jentity.DataSource, appSource string) (*dbtype.Node, error)
}

func NewAttachmentWriteRepository

func NewAttachmentWriteRepository(driver *neo4j.DriverWithContext, database string) AttachmentWriteRepository

type BankAccountReadRepository

type BankAccountReadRepository interface {
	GetBankAccounts(ctx context.Context, tenant string) ([]*dbtype.Node, error)
	GetBankAccountById(ctx context.Context, tenant, id string) (*dbtype.Node, error)
}

func NewBankAccountReadRepository

func NewBankAccountReadRepository(driver *neo4j.DriverWithContext, database string) BankAccountReadRepository

type BankAccountWriteRepository

type BankAccountWriteRepository interface {
	CreateBankAccount(ctx context.Context, tenant string, data data_fields.BankAccountFields) error
	UpdateBankAccount(ctx context.Context, tenant string, data data_fields.BankAccountFields) error
	DeleteBankAccount(ctx context.Context, tenant, id string) error
}

func NewBankAccountWriteRepository

func NewBankAccountWriteRepository(driver *neo4j.DriverWithContext, database string) BankAccountWriteRepository

type BillingProfileCreateFields

type BillingProfileCreateFields struct {
	OrganizationId string             `json:"organizationId"`
	LegalName      string             `json:"legalName"`
	TaxId          string             `json:"taxId"`
	CreatedAt      time.Time          `json:"createdAt"`
	SourceFields   model.SourceFields `json:"sourceFields"`
}

type BillingProfileUpdateFields

type BillingProfileUpdateFields struct {
	OrganizationId  string `json:"organizationId"`
	LegalName       string `json:"legalName"`
	TaxId           string `json:"taxId"`
	UpdateLegalName bool   `json:"updateLegalName"`
	UpdateTaxId     bool   `json:"updateTaxId"`
}

type BillingProfileWriteRepository

type BillingProfileWriteRepository interface {
	Create(ctx context.Context, tenant, billingProfileId string, data BillingProfileCreateFields) error
	Update(ctx context.Context, tenant, billingProfileId string, data BillingProfileUpdateFields) error
	LinkEmailToBillingProfile(ctx context.Context, tenant, organizationId, billingProfileId, emailId string, primary bool) error
	UnlinkEmailFromBillingProfile(ctx context.Context, tenant, organizationId, billingProfileId, emailId string) error
	LinkLocationToBillingProfile(ctx context.Context, tenant, organizationId, billingProfileId, locationId string) error
	UnlinkLocationFromBillingProfile(ctx context.Context, tenant, organizationId, billingProfileId, locationId string) error
}

func NewBillingProfileWriteRepository

func NewBillingProfileWriteRepository(driver *neo4j.DriverWithContext, database string) BillingProfileWriteRepository

type CommentCreateFields

type CommentCreateFields struct {
	Content          string             `json:"content"`
	CreatedAt        time.Time          `json:"createdAt"`
	ContentType      string             `json:"contentType"`
	AuthorUserId     string             `json:"authorUserId"`
	CommentedIssueId string             `json:"commentedIssueId"`
	SourceFields     model.SourceFields `json:"sourceFields"`
}

type CommentReadRepository

type CommentReadRepository interface {
	GetAllForIssues(ctx context.Context, tenant string, issueIds []string) ([]*utils.DbNodeAndId, error)
}

func NewCommentReadRepository

func NewCommentReadRepository(driver *neo4j.DriverWithContext, database string) CommentReadRepository

type CommentUpdateFields

type CommentUpdateFields struct {
	Content     string `json:"content"`
	ContentType string `json:"contentType"`
	Source      string `json:"source"`
}

type CommentWriteRepository

type CommentWriteRepository interface {
	Create(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, commentId string, data data_fields.CommentFields) error
	Update(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, commentId string, data data_fields.CommentFields) error
}

func NewCommentWriteRepository

func NewCommentWriteRepository(driver *neo4j.DriverWithContext, database string) CommentWriteRepository

type CommonReadRepository

type CommonReadRepository interface {
	GenerateId(ctx context.Context, tenant, label string) (string, error)

	ExistsById(ctx context.Context, tenant, id, label string) (bool, error)
	ExistsByIdInTx(ctx context.Context, tx neo4j.ManagedTransaction, tenant, id, label string) (bool, error)
	GetById(ctx context.Context, tenant, id, label string) (*dbtype.Node, error)
	IsLinkedWith(ctx context.Context, tenant, parentId string, parentType model.EntityType, relationship, childId string, childType model.EntityType) (bool, error)
	ExistsByIdLinkedTo(ctx context.Context, tenant, id, label, linkedToId, linkedToLabel, linkRelationship string) (bool, error)
	ExistsByIdLinkedFrom(ctx context.Context, tenant, id, label, linkedFromId, linkedFromLabel, linkRelationship string) (bool, error)
	ExecuteIntegrityCheckerQuery(ctx context.Context, name, cypherQuery string) (int64, error)
	GetDbNodesLinkedTo(ctx context.Context, tenant, linkToId, linkedToLabel, linkRelationship string) ([]*dbtype.Node, error)
}

func NewCommonReadRepository

func NewCommonReadRepository(driver *neo4j.DriverWithContext, database string) CommonReadRepository

type CommonWriteRepository

type CommonWriteRepository interface {
	Link(ctx context.Context, tx *neo4j.ManagedTransaction, tenant string, details LinkDetails) error
	Unlink(ctx context.Context, tx *neo4j.ManagedTransaction, tenant string, details LinkDetails) error
	Delete(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, id, label string) error
	UpdateTimeProperty(ctx context.Context, tenant, nodeLabel, entityId, property string, value *time.Time) error
	UpdateInt64Property(ctx context.Context, tenant, nodeLabel, entityId, property string, value int64) error
	UpdateBoolProperty(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, nodeLabel, entityId, property string, value bool) error
	UpdateStringProperty(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, nodeLabel, entityId, property string, value string) error
	IncrementProperty(ctx context.Context, tenant, nodeLabel, entityId, property string) error
	RemoveProperty(ctx context.Context, tenant, nodeLabel, entityId, property string) error
	TouchEntity(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, nodeLabel, entityId string) error
}

func NewCommonWriteRepository

func NewCommonWriteRepository(driver *neo4j.DriverWithContext, database string) CommonWriteRepository

type ContactReadRepository

type ContactReadRepository interface {
	CountByTenant(ctx context.Context, tenant string) (int64, error)
	GetContact(ctx context.Context, tenant, contactId string) (*dbtype.Node, error)
	GetContacts(ctx context.Context, tenant string, contactIds []string) ([]*dbtype.Node, error)
	GetContactsEnrichedNotLinkedToOrganization(ctx context.Context) ([]TenantAndContactId, error)
	GetContactsWithSocialUrl(ctx context.Context, tenant, socialUrl string) ([]*dbtype.Node, error)
	GetContactsWithEmail(ctx context.Context, tenant, email string) ([]*dbtype.Node, error)
	GetContactInOrganizationByEmail(ctx context.Context, tenant, organizationId, email string) (*neo4j.Node, error)
	GetActiveContactsForOrganizations(ctx context.Context, tenant string, organizationIds []string) ([]*utils.DbNodeAndId, error)
	GetContactCountByOrganizations(ctx context.Context, tenant string, ids []string) (map[string]int64, error)
	GetContactsToFindWorkEmailWithBetterContact(ctx context.Context, minutesFromLastContactUpdate, limit int) ([]ContactsEnrichWorkEmail, error)
	GetContactsToEnrichWithEmailFromBetterContact(ctx context.Context, limit int) ([]TenantAndContactId, error)
	GetContactsToEnrich(ctx context.Context, minutesFromLastContactUpdate, minutesFromLastEnrichAttempt, limit int) ([]TenantAndContactId, error)
	GetContactsWithGroupOrSystemGeneratedEmail(ctx context.Context, limit int) ([]TenantAndContactId, error)
	GetContactsWithEmailForNameUpdate(ctx context.Context, limit int) ([]TenantAndContactId, error)
	GetContactsToCheck(ctx context.Context, minutesSinceLastUpdate, hoursSinceLastCheck, limit int) ([]TenantAndContact, error)
	GetContactsByLinkedIn(ctx context.Context, tenant, url, alias, externalId string) ([]*dbtype.Node, error)
	GetContactsToSetPrimaryJobRole(ctx context.Context, limit int) ([]TenantAndContactId, error)
}

func NewContactReadRepository

func NewContactReadRepository(driver *neo4j.DriverWithContext, database string) ContactReadRepository

type ContactWithFiltersReadRepository

type ContactWithFiltersReadRepository interface {
	GetFilteredContactIds(ctx context.Context, tenant string, filter *model.Filter) ([]string, error)
}

func NewContactWithFiltersReadRepository

func NewContactWithFiltersReadRepository(driver *neo4j.DriverWithContext, database string) ContactWithFiltersReadRepository

type ContactWriteRepository

type ContactWriteRepository interface {
	SaveContactInTx(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, contactId string, data data_fields.ContactFields, updateOnlyIfEmpty bool) error
	ResetEnrichAttempts(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, contactId string) error
}

func NewContactWriteRepository

func NewContactWriteRepository(driver *neo4j.DriverWithContext, database string) ContactWriteRepository

type ContactsEnrichWorkEmail

type ContactsEnrichWorkEmail struct {
	Tenant             string
	ContactId          string
	ContactFirstName   string
	ContactLastName    string
	LinkedInUrl        string
	OrganizationId     string
	OrganizationName   string
	OrganizationDomain string
}

type ContractReadRepository

type ContractReadRepository interface {
	GetContractById(ctx context.Context, tenant, contractId string) (*dbtype.Node, error)
	GetContractByServiceLineItemId(ctx context.Context, tenant, serviceLineItemId string) (*dbtype.Node, error)
	GetContractByOpportunityId(ctx context.Context, tenant string, opportunityId string) (*dbtype.Node, error)
	GetContractsForOrganizations(ctx context.Context, tenant string, organizationIds []string) ([]*utils.DbNodeAndId, error)
	GetContractForInvoice(ctx context.Context, tenant string, invoiceId string) (*dbtype.Node, error)
	GetContractsForInvoices(ctx context.Context, tenant string, invoiceIds []string) ([]*utils.DbNodeAndId, error)
	TenantsHasAtLeastOneContract(ctx context.Context, tenant string) (bool, error)
	CountContracts(ctx context.Context, tenant string) (int64, error)
	GetContractsToGenerateCycleInvoices(ctx context.Context, referenceTime time.Time, delayMinutes, limit int) ([]*utils.DbNodeAndTenant, error)
	GetContractsToGenerateOffCycleInvoices(ctx context.Context, referenceTime time.Time, delayMinutes, limit int) ([]*utils.DbNodeAndTenant, error)
	GetContractsToGenerateNextScheduledInvoices(ctx context.Context, referenceTime time.Time, delayMinutes int) ([]*utils.DbNodeAndTenant, error)
	GetContractsForStatusRenewal(ctx context.Context, referenceTime time.Time, limit int) ([]TenantAndContractId, error)
	GetContractsForRenewalRollout(ctx context.Context, referenceTime time.Time, limit int) ([]TenantAndContractId, error)
	IsContractInvoiced(ctx context.Context, tenant, contractId string) (bool, error)
	GetPaginatedContracts(ctx context.Context, tenant string, skip, limit int) (*utils.DbNodesWithTotalCount, error)
	GetLiveContractsWithoutRenewalOpportunities(ctx context.Context, limit int) ([]TenantAndContractId, error)
}

func NewContractReadRepository

func NewContractReadRepository(driver *neo4j.DriverWithContext, database string) ContractReadRepository

type ContractWriteRepository

type ContractWriteRepository interface {
	CreateForOrganization(ctx context.Context, tenant, contractId string, data data_fields.ContractSaveFields) error
	UpdateContract(ctx context.Context, tenant, contractId string, data data_fields.ContractSaveFields) error
	UpdateStatus(ctx context.Context, tenant, contractId, status string) error
	SuspendActiveRenewalOpportunity(ctx context.Context, tenant, contractId string) error
	ActivateSuspendedRenewalOpportunity(ctx context.Context, tenant, contractId string) error
	ContractCausedOnboardingStatusChange(ctx context.Context, tenant, contractId string) error
	MarkStatusRenewalRequested(ctx context.Context, tenant, contractId string) error
	MarkRolloutRenewalRequested(ctx context.Context, tenant, contractId string) error
	MarkCycleInvoicingRequested(ctx context.Context, tenant, contractId string, invoicingStartedAt time.Time) error
	MarkOffCycleInvoicingRequested(ctx context.Context, tenant, contractId string, invoicingStartedAt time.Time) error
	MarkNextPreviewInvoicingRequested(ctx context.Context, tenant, contractId string, invoicingStartedAt time.Time) error
	SoftDelete(ctx context.Context, tenant, contractId string) error
	SetLtv(ctx context.Context, tenant, contractId string, ltv float64) error
}

func NewContractWriteRepository

func NewContractWriteRepository(driver *neo4j.DriverWithContext, database string) ContractWriteRepository

type CountryReadRepository

type CountryReadRepository interface {
	GetDefaultCountryCodeA3(ctx context.Context, tenant string) (string, error)
	GetCountryByCodeIfExists(ctx context.Context, code string) (*dbtype.Node, error)
	GetCountryByCodeA3IfExists(ctx context.Context, codeA3 string) (*dbtype.Node, error)
	GetCountryByCodeA2IfExists(ctx context.Context, codeA2 string) (*dbtype.Node, error)
	GetCountriesPaginated(ctx context.Context, skip, limit int) (*utils.DbNodesWithTotalCount, error)
	GetCountries(ctx context.Context) ([]*dbtype.Node, error)
	GetAllForPhoneNumbers(ctx context.Context, tenant string, ids []string) ([]*utils.DbNodeAndId, error)
}

func NewCountryReadRepository

func NewCountryReadRepository(driver *neo4j.DriverWithContext, database string) CountryReadRepository

type CountryWriteRepository

type CountryWriteRepository interface {
	CreateCountry(ctx context.Context, id, name, codeA2, codeA3, phoneCode string, createdAt time.Time) error
	UpdateCountry(ctx context.Context, id, name, codeA2, codeA3, phoneCode string) error
}

func NewCountryWriteRepository

func NewCountryWriteRepository(driver *neo4j.DriverWithContext, database string) CountryWriteRepository

type CustomFieldCreateFields

type CustomFieldCreateFields struct {
	CreatedAt           time.Time              `json:"createdAt"`
	ExistsInEventStore  bool                   `json:"existsInEventStore"`
	TemplateId          *string                `json:"templateId,omitempty"`
	CustomFieldId       string                 `json:"customFieldId"`
	CustomFieldName     string                 `json:"customFieldName"`
	CustomFieldDataType string                 `json:"customFieldDataType"`
	CustomFieldValue    model.CustomFieldValue `json:"customFieldValue"`
	SourceFields        model.SourceFields     `json:"sourceFields,omitempty"`
}

type CustomFieldTemplateReadRepository

type CustomFieldTemplateReadRepository interface {
	GetAllForTenant(ctx context.Context, tenant string) ([]*dbtype.Node, error)
	GetById(ctx context.Context, tenant, id string) (*dbtype.Node, error)
}

func NewCustomFieldTemplateReadRepository

func NewCustomFieldTemplateReadRepository(driver *neo4j.DriverWithContext, database string) CustomFieldTemplateReadRepository

type CustomFieldTemplateSaveFields

type CustomFieldTemplateSaveFields struct {
	Name        string           `json:"name"`
	EntityType  model.EntityType `json:"entityType"`
	Type        string           `json:"type"`
	ValidValues []string         `json:"validValues"`
	Order       *int64           `json:"order,omitempty"`
	Required    *bool            `json:"required,omitempty"`
	Length      *int64           `json:"length,omitempty"`
	Min         *int64           `json:"min,omitempty"`
	Max         *int64           `json:"max,omitempty"`

	UpdateName        bool `json:"updateName"`
	UpdateType        bool `json:"updateType"`
	UpdateValidValues bool `json:"updateValidValues"`
	UpdateOrder       bool `json:"updateOrder"`
	UpdateRequired    bool `json:"updateRequired"`
	UpdateLength      bool `json:"updateLength"`
	UpdateMin         bool `json:"updateMin"`
	UpdateMax         bool `json:"updateMax"`
}

type CustomFieldTemplateWriteRepository

type CustomFieldTemplateWriteRepository interface {
	Save(ctx context.Context, tenant, customFieldTemplateId string, data CustomFieldTemplateSaveFields) error
	Delete(ctx context.Context, tenant, customFieldTemplateId string) error
}

func NewCustomFieldTemplateWriteRepository

func NewCustomFieldTemplateWriteRepository(driver *neo4j.DriverWithContext, database string) CustomFieldTemplateWriteRepository

type CustomFieldWriteRepository

type CustomFieldWriteRepository interface {
	AddCustomFieldToOrganization(ctx context.Context, tenant, organizationId string, data CustomFieldCreateFields) error
}

func NewCustomFieldWriteRepository

func NewCustomFieldWriteRepository(driver *neo4j.DriverWithContext, database string) CustomFieldWriteRepository

type DomainReadRepository

type DomainReadRepository interface {
	GetDomain(ctx context.Context, tx *neo4j.ManagedTransaction, domain string) (*dbtype.Node, error)
	GetForOrganizations(ctx context.Context, tenant string, organizationIds []string) ([]*utils.DbNodeAndId, error)
	GetDomainsForPrimaryCheck(ctx context.Context, delayFromPreviousCheckInDays, limit int) ([]string, error)
}

func NewDomainReadRepository

func NewDomainReadRepository(driver *neo4j.DriverWithContext, database string) DomainReadRepository

type DomainWriteRepository

type DomainWriteRepository interface {
	MergeDomain(ctx context.Context, tx *neo4j.ManagedTransaction, domain, source, appSource string) (bool, error)
	SetPrimaryDetails(ctx context.Context, domain, primaryDomain string, primary bool) error
}

func NewDomainWriteRepository

func NewDomainWriteRepository(driver *neo4j.DriverWithContext, database string) DomainWriteRepository

type EmailCreateFields

type EmailCreateFields struct {
	RawEmail  string            `json:"rawEmail"`
	Source    entity.DataSource `json:"source"`
	CreatedAt time.Time         `json:"createdAt"`
}

type EmailDeliverableStatus

type EmailDeliverableStatus string
const (
	True    EmailDeliverableStatus = "true"
	False   EmailDeliverableStatus = "false"
	Unknown EmailDeliverableStatus = "unknown"
)

type EmailReadRepository

type EmailReadRepository interface {
	GetEmailIdIfExists(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, email string) (string, error)
	GetEmailForUser(ctx context.Context, tenant string, userId string) (*dbtype.Node, error)
	GetById(ctx context.Context, tenant, emailId string) (*dbtype.Node, error)
	GetFirstByEmail(ctx context.Context, tenant, email string) (*dbtype.Node, error)
	GetAllEmailNodesForLinkedEntityIds(ctx context.Context, tenant string, entityType neo4jenum.EntityType, entityIds []string) ([]*utils.DbNodeWithRelationAndId, error)
	GetPrimaryEmailNodesForLinkedEntityIds(ctx context.Context, tenant string, entityType neo4jenum.EntityType, entityIds []string) ([]*utils.DbNodeWithRelationAndId, error)
	GetEmailsForValidation(ctx context.Context, delayFromLastUpdateInSeconds, delayFromLastValidationAttemptInMinutes, limit int) ([]TenantAndEmailId, error)
	IsLinkedToEntityByEmailAddress(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, email, entityId string, entityType neo4jenum.EntityType) (bool, error)
	GetOrphanEmailNodes(ctx context.Context, limit, hoursFromLastUpdate int) ([]TenantAndEmailId, error)
	IsOrphanEmail(ctx context.Context, tenant, emailId string) (bool, error)
	GetTestEmailForFlows(ctx context.Context, tenant string) (string, error)
}

func NewEmailReadRepository

func NewEmailReadRepository(driver *neo4j.DriverWithContext, database string) EmailReadRepository

type EmailWriteRepository

type EmailWriteRepository interface {
	CreateEmail(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, emailId string, data EmailCreateFields) error
	EmailValidated(ctx context.Context, tenant, emailId string, data data_fields.EmailValidationFields) error
	CleanEmailValidation(ctx context.Context, tenant, emailId string) error
	LinkWithContact(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, contactId, emailId string, primary bool) error
	LinkWithOrganization(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, organizationId, emailId string, primary bool) error
	LinkWithUser(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, userId, emailId string, primary bool) error
	UnlinkFromUser(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, usedId, email string) error
	UnlinkFromContact(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, contactId, email string) error
	UnlinkFromOrganization(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, organizationId, email string) error
	SetDeliverableByEmailForAllTenants(ctx context.Context, email string, deliverable EmailDeliverableStatus) error
	SetPrimaryForEntity(ctx context.Context, tenant, entityId, email string, entityType model.EntityType) error
	DeleteOrphanEmail(ctx context.Context, tenant, emailId string) error
}

func NewEmailWriteRepository

func NewEmailWriteRepository(driver *neo4j.DriverWithContext, database string) EmailWriteRepository

type ExternalSystemReadRepository

type ExternalSystemReadRepository interface {
	GetFirstExternalIdForLinkedEntity(ctx context.Context, tenant, externalSystemId, entityId, entityLabel string) (string, error)
	GetAllExternalIdsForLinkedEntity(ctx context.Context, tenant, externalSystemId, entityId, entityLabel string) ([]string, error)
	GetAllForTenant(ctx context.Context, tenant string) ([]*dbtype.Node, error)
	GetFor(ctx context.Context, tenant string, ids []string, label string) ([]*utils.DbNodeWithRelationAndId, error)
}

func NewExternalSystemReadRepository

func NewExternalSystemReadRepository(driver *neo4j.DriverWithContext, database string) ExternalSystemReadRepository

type ExternalSystemWriteRepository

type ExternalSystemWriteRepository interface {
	CreateIfNotExists(ctx context.Context, tenant, externalSystemId, externalSystemName string) error
	LinkWithEntity(ctx context.Context, tenant, linkedEntityId, linkedEntityNodeLabel string, externalSystem model.ExternalSystem) error
	LinkWithEntityInTx(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, linkedEntityId, linkedEntityNodeLabel string, externalSystem model.ExternalSystem) error
	SetProperty(ctx context.Context, tenant, externalSystemId, propertyName string, propertyValue any) error
	SetPrimaryExternalId(ctx context.Context, tenant, externalSystemId string, externalId, linkedEntityNodeLabel, linkedEntityId string) error
}

func NewExternalSystemWriteRepository

func NewExternalSystemWriteRepository(driver *neo4j.DriverWithContext, database string) ExternalSystemWriteRepository

type FlowActionExecutionReadRepository

type FlowActionExecutionReadRepository interface {
	GetById(ctx context.Context, id string) (*dbtype.Node, error)
	GetExecution(ctx context.Context, flowId, actionId, entityId string, entityType model.EntityType) (*dbtype.Node, error)
	GetForParticipants(ctx context.Context, participantIds []string) ([]*utils.DbNodeAndId, error)
	GetForEntity(ctx context.Context, tx *neo4j.ManagedTransaction, flowId, entityId string, entityType model.EntityType) ([]*dbtype.Node, error)
	GetFirstSlotForMailbox(ctx context.Context, tx *neo4j.ManagedTransaction, mailbox string) (*time.Time, error)
	GetLastScheduledForMailbox(ctx context.Context, tx *neo4j.ManagedTransaction, mailbox string) (*dbtype.Node, error)
	GetScheduledBefore(ctx context.Context, before time.Time) ([]*dbtype.Node, error)
	GetByMailboxAndTimeInterval(ctx context.Context, tx *neo4j.ManagedTransaction, mailbox string, startTime, endTime time.Time) (*dbtype.Node, error)
	GetForEntityWithActionType(ctx context.Context, entityId string, entityType model.EntityType, actionType neo4jentity.FlowActionType) ([]*dbtype.Node, error)

	CountEmailsPerMailboxPerDay(ctx context.Context, tx *neo4j.ManagedTransaction, mailbox string, startDate, endDate time.Time) (int64, error)
}

func NewFlowActionExecutionReadRepository

func NewFlowActionExecutionReadRepository(driver *neo4j.DriverWithContext, database string) FlowActionExecutionReadRepository

type FlowActionExecutionWriteRepository

type FlowActionExecutionWriteRepository interface {
	Merge(ctx context.Context, tx *neo4j.ManagedTransaction, entity *entity.FlowActionExecutionEntity) (*dbtype.Node, error)
	RelinkWithActions(ctx context.Context) error
	Delete(ctx context.Context, tx *neo4j.ManagedTransaction, id string) error
	DeleteScheduledForFlow(ctx context.Context, flowId string) error
}

func NewFlowActionExecutionWriteRepository

func NewFlowActionExecutionWriteRepository(driver *neo4j.DriverWithContext, database string) FlowActionExecutionWriteRepository

type FlowActionReadRepository

type FlowActionReadRepository interface {
	GetList(ctx context.Context, flowIds []string) ([]*utils.DbNodeAndId, error)
	GetById(ctx context.Context, id string) (*neo4j.Node, error)
	GetStartAction(ctx context.Context, flowId string) (*neo4j.Node, error)
	GetPrevious(ctx context.Context, actionId string) ([]*neo4j.Node, error)
	GetNext(ctx context.Context, actionId string) ([]*neo4j.Node, error)
	GetFlowByActionId(ctx context.Context, id string) (*neo4j.Node, error)
	GetFlowByEntity(ctx context.Context, entityId string, entityType model.EntityType) (*neo4j.Node, error)
}

func NewFlowActionReadRepository

func NewFlowActionReadRepository(driver *neo4j.DriverWithContext, database string) FlowActionReadRepository

type FlowActionWriteRepository

type FlowActionWriteRepository interface {
	Merge(ctx context.Context, tx *neo4j.ManagedTransaction, entity *entity.FlowActionEntity) (*dbtype.Node, error)
	DeleteForFlow(ctx context.Context, tx *neo4j.ManagedTransaction, id string) error
	Delete(ctx context.Context, id string) error
}

func NewFlowActionWriteRepository

func NewFlowActionWriteRepository(driver *neo4j.DriverWithContext, database string) FlowActionWriteRepository

type FlowExecutionSettingsReadRepository

type FlowExecutionSettingsReadRepository interface {
	GetForEntity(ctx context.Context, tx *neo4j.ManagedTransaction, flowId, entityId, entityType string) (*dbtype.Node, error)
}

func NewFlowExecutionSettingsReadRepository

func NewFlowExecutionSettingsReadRepository(driver *neo4j.DriverWithContext, database string) FlowExecutionSettingsReadRepository

type FlowExecutionSettingsWriteRepository

type FlowExecutionSettingsWriteRepository interface {
	Merge(ctx context.Context, tx *neo4j.ManagedTransaction, entity *entity.FlowExecutionSettingsEntity) (*dbtype.Node, error)
}

func NewFlowExecutionSettingsWriteRepository

func NewFlowExecutionSettingsWriteRepository(driver *neo4j.DriverWithContext, database string) FlowExecutionSettingsWriteRepository

type FlowParticipantReadRepository

type FlowParticipantReadRepository interface {
	GetList(ctx context.Context, flowIds []string) ([]*utils.DbNodeAndId, error)
	CountWithStatus(ctx context.Context, flowId string, status entity.FlowParticipantStatus) (int64, error)
	Identify(ctx context.Context, flowId, entityId string, entityType model.EntityType) (*neo4j.Node, error)
	GetById(ctx context.Context, id string) (*neo4j.Node, error)
}

func NewFlowParticipantReadRepository

func NewFlowParticipantReadRepository(driver *neo4j.DriverWithContext, database string) FlowParticipantReadRepository

type FlowParticipantWriteRepository

type FlowParticipantWriteRepository interface {
	Merge(ctx context.Context, tx *neo4j.ManagedTransaction, entity *entity.FlowParticipantEntity) (*dbtype.Node, error)
	Delete(ctx context.Context, tx *neo4j.ManagedTransaction, id string) error

	MarkReadyContactsAsScheduled(ctx context.Context, tx *neo4j.ManagedTransaction, flowId string) ([]string, error)
}

func NewFlowParticipantWriteRepository

func NewFlowParticipantWriteRepository(driver *neo4j.DriverWithContext, database string) FlowParticipantWriteRepository

type FlowReadRepository

type FlowReadRepository interface {
	GetList(ctx context.Context) ([]*dbtype.Node, error)
	GetWithParticipant(ctx context.Context, tx *neo4j.ManagedTransaction, flowParticipantId string) (*dbtype.Node, error)
	GetFlowsForParticipants(ctx context.Context, entityIds []string, entityType model.EntityType) ([]*utils.DbNodeAndId, error)
	GetListWithSender(ctx context.Context, senderIds []string) ([]*utils.DbNodeAndId, error)
	GetById(ctx context.Context, id string) (*dbtype.Node, error)
}

func NewFlowReadRepository

func NewFlowReadRepository(driver *neo4j.DriverWithContext, database string) FlowReadRepository

type FlowSenderReadRepository

type FlowSenderReadRepository interface {
	GetList(ctx context.Context, flowIds []string) ([]*utils.DbNodeAndId, error)
	GetById(ctx context.Context, id string) (*neo4j.Node, error)
	GetFlowBySenderId(ctx context.Context, id string) (*neo4j.Node, error)
	GetUsersUsedInFlows(ctx context.Context, userIds []string) ([]string, error)
}

func NewFlowSenderReadRepository

func NewFlowSenderReadRepository(driver *neo4j.DriverWithContext, database string) FlowSenderReadRepository

type FlowSenderWriteRepository

type FlowSenderWriteRepository interface {
	Merge(ctx context.Context, entity *entity.FlowSenderEntity) (*dbtype.Node, error)
	Delete(ctx context.Context, id string) error
}

func NewFlowSenderWriteRepository

func NewFlowSenderWriteRepository(driver *neo4j.DriverWithContext, database string) FlowSenderWriteRepository

type FlowWriteRepository

type FlowWriteRepository interface {
	Merge(ctx context.Context, tx *neo4j.ManagedTransaction, entity *entity.FlowEntity) (*dbtype.Node, error)

	UpdateStatistics(ctx context.Context) ([]*utils.StringsWithTenant, error)
	UpdateFlowStatistics(ctx context.Context, tx *neo4j.ManagedTransaction, flowId string) ([]*utils.StringsWithTenant, error)
}

func NewFlowWriteRepository

func NewFlowWriteRepository(driver *neo4j.DriverWithContext, database string) FlowWriteRepository

type InteractionEventCreateFields

type InteractionEventCreateFields struct {
	SourceFields       model.SourceFields `json:"sourceFields"`
	CreatedAt          time.Time          `json:"createdAt"`
	Content            string             `json:"content"`
	ContentType        string             `json:"contentType"`
	Channel            string             `json:"channel"`
	ChannelData        string             `json:"channelData"`
	Identifier         string             `json:"identifier"`
	EventType          string             `json:"eventType"`
	BelongsToIssueId   string             `json:"belongsToIssueId"`
	BelongsToSessionId string             `json:"belongsToSessionId"`
	Hide               bool               `json:"hide"`
}

type InteractionEventReadRepository

type InteractionEventReadRepository interface {
	GetAllForInteractionSessions(ctx context.Context, tenant string, ids []string, returnContent bool) ([]*utils.DbPropsAndId, error)
	GetAllForMeetings(ctx context.Context, tenant string, ids []string, returnContent bool) ([]*utils.DbPropsAndId, error)
	GetAllForIssues(ctx context.Context, tenant string, issueIds []string, returnContent bool) ([]*utils.DbPropsAndId, error)
	GetSentByFor(ctx context.Context, tenant string, ids []string) ([]*utils.DbNodeWithRelationAndId, error)
	GetSentToFor(ctx context.Context, tenant string, ids []string) ([]*utils.DbNodeWithRelationAndId, error)
	GetReplyToFor(ctx context.Context, tenant string, ids []string, returnContent bool) ([]*utils.DbPropsAndId, error)
	GetInteractionEventByCustomerOSIdentifier(ctx context.Context, customerOSInternalIdentifier string) (*dbtype.Node, error)
	InteractionEventSentByUser(ctx context.Context, tenant, interactionEventId string) (bool, error)
	GetInteractionEventIdByExternalId(ctx context.Context, tenant, externalSystemId, externalId string) (string, error)
}

func NewInteractionEventReadRepository

func NewInteractionEventReadRepository(driver *neo4j.DriverWithContext, database string) InteractionEventReadRepository

type InteractionEventUpdateFields

type InteractionEventUpdateFields struct {
	Content     string `json:"content"`
	ContentType string `json:"contentType"`
	Channel     string `json:"channel"`
	ChannelData string `json:"channelData"`
	Identifier  string `json:"identifier"`
	EventType   string `json:"eventType"`
	Hide        bool   `json:"hide"`
	Source      string `json:"source"`
}

type InteractionEventWriteRepository

type InteractionEventWriteRepository interface {
	CreateInTx(ctx context.Context, tx neo4j.ManagedTransaction, tenant, interactionEventId string, data neo4jentity.InteractionEventEntity) error
	Update(ctx context.Context, tenant, interactionEventId string, data InteractionEventUpdateFields) error
	MergeByExternalSystem(ctx context.Context, tx *neo4j.ManagedTransaction, tenant string, syncDate time.Time, message commonmodel.SaveEmailMessage, source, appSource string) (string, error)
	LinkInteractionEventToSession(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, interactionEventId, interactionSessionId string) error
	InteractionEventSentByEmail(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, interactionEventId, emailId string) error
	InteractionEventSentToEmails(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, interactionEventId, sentType string, emailIds []string) error
}

func NewInteractionEventWriteRepository

func NewInteractionEventWriteRepository(driver *neo4j.DriverWithContext, database string) InteractionEventWriteRepository

type InteractionSessionReadRepository

type InteractionSessionReadRepository interface {
	GetForInteractionEvent(ctx context.Context, tenant, interactionEventId string) (*neo4j.Node, error)
	GetAllForInteractionEvents(ctx context.Context, tenant string, ids []string) ([]*utils.DbNodeAndId, error)
	GetByIdentifierAndChannel(ctx context.Context, tenant, identifier, channel string) (*neo4j.Node, error)
	GetAttendedByParticipantsForInteractionSessions(ctx context.Context, tenant string, ids []string) ([]*utils.DbNodeWithRelationAndId, error)
}

func NewInteractionSessionReadRepository

func NewInteractionSessionReadRepository(driver *neo4j.DriverWithContext, database string) InteractionSessionReadRepository

type InteractionSessionWriteRepository

type InteractionSessionWriteRepository interface {
	CreateInTx(ctx context.Context, tx neo4j.ManagedTransaction, tenant, interactionSessionId string, data entity.InteractionSessionEntity) error
	MergeByIdentifierAndChannel(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, identifier string, syncDate time.Time, message commonmodel.SaveEmailMessage, sessionType commonenum.InteractionSessionType, channel commonenum.InteractionSessionChannel, source, appSource string) (string, error)
}

func NewInteractionSessionWriteRepository

func NewInteractionSessionWriteRepository(driver *neo4j.DriverWithContext, database string) InteractionSessionWriteRepository

type InvoiceCreateFields

type InvoiceCreateFields struct {
	ContractId           string                  `json:"contractId"`
	Currency             neo4jenum.Currency      `json:"currency"`
	DryRun               bool                    `json:"dryRun"`
	OffCycle             bool                    `json:"offCycle"`
	Postpaid             bool                    `json:"postpaid"`
	Preview              bool                    `json:"preview"`
	PeriodStartDate      time.Time               `json:"periodStartDate"`
	PeriodEndDate        time.Time               `json:"periodEndDate"`
	CreatedAt            time.Time               `json:"createdAt"`
	IssuedDate           time.Time               `json:"issuedDate"`
	DueDate              time.Time               `json:"dueDate"`
	SourceFields         model.SourceFields      `json:"sourceFields"`
	BillingCycleInMonths int64                   `json:"billingCycleInMonths"`
	Status               neo4jenum.InvoiceStatus `json:"status"`
	Note                 string                  `json:"note"`
}

type InvoiceFillFields

type InvoiceFillFields struct {
	Amount                       float64                 `json:"amount"`
	VAT                          float64                 `json:"vat"`
	TotalAmount                  float64                 `json:"totalAmount"`
	ContractId                   string                  `json:"contractId"`
	Currency                     neo4jenum.Currency      `json:"currency"`
	DryRun                       bool                    `json:"dryRun"`
	OffCycle                     bool                    `json:"offCycle"`
	Postpaid                     bool                    `json:"postpaid"`
	Preview                      bool                    `json:"preview"`
	InvoiceNumber                string                  `json:"invoiceNumber"`
	PeriodStartDate              time.Time               `json:"periodStartDate"`
	PeriodEndDate                time.Time               `json:"periodEndDate"`
	BillingCycleInMonths         int64                   `json:"billingCycleInMonths"`
	Status                       neo4jenum.InvoiceStatus `json:"status"`
	Note                         string                  `json:"note"`
	CustomerName                 string                  `json:"customerName"`
	CustomerEmail                string                  `json:"customerEmail"`
	CustomerAddressLine1         string                  `json:"customerAddressLine1"`
	CustomerAddressLine2         string                  `json:"customerAddressLine2"`
	CustomerAddressZip           string                  `json:"customerAddressZip"`
	CustomerAddressLocality      string                  `json:"customerAddressLocality"`
	CustomerAddressCountry       string                  `json:"customerAddressCountry"`
	CustomerAddressRegion        string                  `json:"customerAddressRegion"`
	ProviderLogoRepositoryFileId string                  `json:"providerLogoRepositoryFileId"`
	ProviderName                 string                  `json:"providerName"`
	ProviderEmail                string                  `json:"providerEmail"`
	ProviderAddressLine1         string                  `json:"providerAddressLine1"`
	ProviderAddressLine2         string                  `json:"providerAddressLine2"`
	ProviderAddressZip           string                  `json:"providerAddressZip"`
	ProviderAddressLocality      string                  `json:"providerAddressLocality"`
	ProviderAddressCountry       string                  `json:"providerAddressCountry"`
	ProviderAddressRegion        string                  `json:"providerAddressRegion"`
}

type InvoiceLineCreateFields

type InvoiceLineCreateFields struct {
	CreatedAt               time.Time          `json:"createdAt"`
	SourceFields            model.SourceFields `json:"sourceFields"`
	Name                    string             `json:"name"`
	Price                   float64            `json:"price"`
	Quantity                int64              `json:"quantity"`
	Amount                  float64            `json:"amount"`
	VAT                     float64            `json:"vat"`
	TotalAmount             float64            `json:"totalAmount"`
	ServiceLineItemId       string             `json:"serviceLineItemId"`
	ServiceLineItemParentId string             `json:"serviceLineItemParentId"`
	BilledType              enum.BilledType    `json:"billedType"`
}

type InvoiceLineReadRepository

type InvoiceLineReadRepository interface {
	GetAllForInvoice(ctx context.Context, tenant string, invoiceId string) ([]*dbtype.Node, error)
	GetAllForInvoices(ctx context.Context, tenant string, ids []string) ([]*utils.DbNodeAndId, error)
	GetLatestInvoiceLineWithInvoiceIdByServiceLineItemParentId(ctx context.Context, tenant, sliParentId string) (*utils.DbNodeAndId, error)
}

func NewInvoiceLineReadRepository

func NewInvoiceLineReadRepository(driver *neo4j.DriverWithContext, database string) InvoiceLineReadRepository

type InvoiceLineWriteRepository

type InvoiceLineWriteRepository interface {
	CreateInvoiceLine(ctx context.Context, tenant, invoiceId, invoiceLineId string, data InvoiceLineCreateFields) error
}

func NewInvoiceLineWriteRepository

func NewInvoiceLineWriteRepository(driver *neo4j.DriverWithContext, database string) InvoiceLineWriteRepository

type InvoiceReadRepository

type InvoiceReadRepository interface {
	GetInvoiceById(ctx context.Context, tenant, invoiceId string) (*dbtype.Node, error)
	GetInvoiceByIdAcrossAllTenants(ctx context.Context, invoiceId string) (*dbtype.Node, string, error)
	GetInvoiceByNumber(ctx context.Context, tenant, invoiceNumber string) (*dbtype.Node, error)
	CountInvoices(ctx context.Context, tenant, filterString string, filterParams map[string]interface{}) (int64, error)
	GetPaginatedInvoices(ctx context.Context, tenant string, skip, limit int, filterCypher string, filterParams map[string]interface{}, sorting *utils.Cypher) (*utils.DbNodesWithTotalCount, error)
	GetInvoicesForPayNotifications(ctx context.Context, minutesFromLastUpdate, lookbackWindow int, referenceTime time.Time) ([]*utils.DbNodeAndTenant, error)
	GetInvoicesForRemindNotifications(ctx context.Context, referenceTime time.Time, overdueDays, limit int) ([]*utils.DbNodeAndTenant, error)
	CountNonDryRunInvoicesForContract(ctx context.Context, tenant, contractId string) (int, error)
	GetInvoicesForPaymentLinkRequest(ctx context.Context, minutesFromLastUpdate, lookbackWindow int, referenceTime time.Time, limit int) ([]*utils.DbNodeAndTenant, error)
	GetPreviousCycleInvoice(ctx context.Context, tenant, contractId string) (*dbtype.Node, error)
	GetLastIssuedOnCycleInvoiceForContract(ctx context.Context, tenant, contractId string) (*dbtype.Node, error)
	GetLastIssuedInvoiceForContract(ctx context.Context, tenant, contractId string) (*dbtype.Node, error)
	GetFirstPreviewFilledInvoice(ctx context.Context, tenant, contractId string) (*dbtype.Node, error)
	GetExpiredDryRunInvoices(ctx context.Context) ([]*utils.DbNodeAndTenant, error)
	GetAllForContracts(ctx context.Context, tenant string, ids []string) ([]*utils.DbNodeAndId, error)
	GetInvoicesForOverdue(ctx context.Context) ([]*utils.DbNodeAndTenant, error)
	GetInvoicesForOnHold(ctx context.Context) ([]*utils.DbNodeAndTenant, error)
	GetInvoicesForScheduled(ctx context.Context) ([]*utils.DbNodeAndTenant, error)
	GetReadyInvoicesForFinalizedEvent(ctx context.Context, delayInMinutes int, referenceTime time.Time, limit int) ([]*utils.DbNodeAndTenant, error)
	GetNonDryRunInvoicesForOrganization(ctx context.Context, tenant, organizationId string) ([]*dbtype.Node, error)
}

func NewInvoiceReadRepository

func NewInvoiceReadRepository(driver *neo4j.DriverWithContext, database string) InvoiceReadRepository

type InvoiceUpdateFields

type InvoiceUpdateFields struct {
	Status                neo4jenum.InvoiceStatus `json:"status"`
	PaymentLink           string                  `json:"paymentLink"`
	PaymentLinkValidUntil *time.Time              `json:"paymentLinkValidUntil"`
	UpdateStatus          bool                    `json:"updateStatus"`
	UpdatePaymentLink     bool                    `json:"updatePaymentLink"`
}

type InvoiceWriteRepository

type InvoiceWriteRepository interface {
	CreateInvoiceForContract(ctx context.Context, tenant, invoiceId string, data InvoiceCreateFields) error
	FillInvoice(ctx context.Context, tenant, invoiceId string, data InvoiceFillFields) error
	InvoicePdfGenerated(ctx context.Context, tenant, id, repositoryFileId string) error
	UpdateInvoice(ctx context.Context, tenant, invoiceId string, data InvoiceUpdateFields) error
	MarkPayNotificationRequested(ctx context.Context, tenant, invoiceId string, requestedAt time.Time) error
	MarkPaymentLinkRequested(ctx context.Context, tenant, invoiceId string) error
	SetPaidInvoiceNotificationSentAt(ctx context.Context, tenant, invoiceId string) error
	SetVoidInvoiceNotificationSentAt(ctx context.Context, tenant, invoiceId string) error
	SetPayInvoiceNotificationSentAt(ctx context.Context, tenant, invoiceId string) error
	DeleteInitializedInvoice(ctx context.Context, tenant, invoiceId string) error
	DeletePreviewCycleInvoices(ctx context.Context, tenant, contractId, skipInvoiceId string) error
	DeletePreviewCycleInitializedInvoices(ctx context.Context, tenant, contractId, skipInvoiceId string) error
	DeleteDryRunInvoice(ctx context.Context, tenant, invoiceId string) error
}

func NewInvoiceWriteRepository

func NewInvoiceWriteRepository(driver *neo4j.DriverWithContext, database string) InvoiceWriteRepository

type IssueReadRepository

type IssueReadRepository interface {
	GetById(ctx context.Context, tenant, issueId string) (*dbtype.Node, error)
	GetMatchedIssueId(ctx context.Context, tenant, externalSystem, externalId string) (string, error)
	GetIssueIdByExternalId(ctx context.Context, tenant, externalId, externalSystemId string) (string, error)
}

func NewIssueReadRepository

func NewIssueReadRepository(driver *neo4j.DriverWithContext, database string) IssueReadRepository

type IssueWriteRepository

type IssueWriteRepository interface {
	Create(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, issueId string, data data_fields.IssueFields) error
	Update(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, issueId string, data data_fields.IssueFields) error
	AddUserAssignee(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, issueId, userId string) error
	RemoveUserAssignee(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, issueId, userId string) error
	AddUserFollower(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, issueId, userId string) error
	RemoveUserFollower(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, issueId, userId string) error

	ReportedByOrganizationWithGroupId(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, organizationId, groupId string) error
	RemoveReportedByOrganizationWithGroupId(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, organizationId, groupId string) error

	LinkUnthreadIssuesToOrganizationByGroupId(ctx context.Context) error
}

func NewIssueWriteRepository

func NewIssueWriteRepository(driver *neo4j.DriverWithContext, database string) IssueWriteRepository

type JobRoleFields

type JobRoleFields struct {
	Description  string             `json:"description"`
	JobTitle     string             `json:"jobTitle"`
	StartedAt    *time.Time         `json:"startedAt"`
	EndedAt      *time.Time         `json:"endedAt"`
	SourceFields model.SourceFields `json:"sourceFields"`
	Primary      bool               `json:"primary"`
}

type JobRoleReadRepository

type JobRoleReadRepository interface {
	GetAllForContact(ctx context.Context, session neo4j.SessionWithContext, tenant, contactId string) ([]*dbtype.Node, error)
	GetAllForContacts(ctx context.Context, tenant string, contactIds []string) ([]*utils.DbNodeAndId, error)
	GetAllForOrganization(ctx context.Context, session neo4j.SessionWithContext, tenant, organizationId string) ([]*dbtype.Node, error)
	GetAllForOrganizations(ctx context.Context, tenant string, organizationIds []string) ([]*utils.DbNodeAndId, error)
	GetAllForUsers(ctx context.Context, tenant string, userIds []string) ([]*utils.DbNodeAndId, error)
	ExistsForContactAndOrganization(ctx context.Context, tenant, contactId, organizationId string) (bool, error)
	GetAllForContactWithOrganizationId(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, contactId string) ([]*utils.DbNodeAndId, error)
}

func NewJobRoleReadRepository

func NewJobRoleReadRepository(driver *neo4j.DriverWithContext, database string) JobRoleReadRepository

type JobRoleWriteRepository

type JobRoleWriteRepository interface {
	CreateJobRole(ctx context.Context, tenant, jobRoleId string, data JobRoleFields) error
	CreateJobRoleInTx(ctx context.Context, tx neo4j.ManagedTransaction, tenant, contactId string, input entity.JobRoleEntity) (*dbtype.Node, error)
	LinkWithUser(ctx context.Context, tenant, userId, jobRoleId string) error
	LinkContactWithOrganization(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, contactId, organizationId string, data JobRoleFields) error
	DeleteJobRoleInTx(ctx context.Context, tx neo4j.ManagedTransaction, tenant, contactId, roleId string) error
	SetOtherJobRolesForContactNonPrimaryInTx(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, contactId, skipRoleId string) error
	SetJobRolePrimaryInTx(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, roleId string) error
	UpdateJobRoleDetails(ctx context.Context, tx neo4j.ManagedTransaction, tenant, contactId, roleId string, input entity.JobRoleEntity) (*dbtype.Node, error)
	LinkWithOrganization(ctx context.Context, tx neo4j.ManagedTransaction, tenant, roleId, organizationId string) error
}

func NewJobRoleWriteRepository

func NewJobRoleWriteRepository(driver *neo4j.DriverWithContext, database string) JobRoleWriteRepository

type LinkDetails

type LinkDetails struct {
	FromEntityId   string
	FromEntityType model.EntityType

	Relationship           model.EntityRelation
	RelationshipProperties *map[string]interface{}

	ToEntityId   string
	ToEntityType model.EntityType
}

type LinkedinConnectionRequestReadRepository

type LinkedinConnectionRequestReadRepository interface {
	GetPendingRequestByUserForSocialUrl(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, userId, socialUrl string) (*dbtype.Node, error)
	GetLastScheduledForUser(ctx context.Context, tx *neo4j.ManagedTransaction, userId string) (*dbtype.Node, error)

	CountRequestsPerUserPerDay(ctx context.Context, tx *neo4j.ManagedTransaction, userId string, startDate, endDate time.Time) (int64, error)
}

func NewLinkedinConnectionRequestReadRepository

func NewLinkedinConnectionRequestReadRepository(driver *neo4j.DriverWithContext, database string) LinkedinConnectionRequestReadRepository

type LinkedinConnectionRequestWriteRepository

type LinkedinConnectionRequestWriteRepository interface {
	Save(ctx context.Context, tx *neo4j.ManagedTransaction, input *entity.LinkedinConnectionRequest) error
}

func NewLinkedinConnectionRequestWriteRepository

func NewLinkedinConnectionRequestWriteRepository(driver *neo4j.DriverWithContext, database string) LinkedinConnectionRequestWriteRepository

type LocationReadRepository

type LocationReadRepository interface {
	GetAllForContact(ctx context.Context, tenant, contactId string) ([]*dbtype.Node, error)
	GetAllForContacts(ctx context.Context, tenant string, contactIds []string) ([]*utils.DbNodeAndId, error)
	GetAllForOrganization(ctx context.Context, tenant, organizationId string) ([]*dbtype.Node, error)
	GetAllForOrganizations(ctx context.Context, tenant string, organizationIds []string) ([]*utils.DbNodeAndId, error)
}

func NewLocationReadRepository

func NewLocationReadRepository(driver *neo4j.DriverWithContext, database string) LocationReadRepository

type LocationUpdateFields

type LocationUpdateFields struct {
	AddressDetails AddressDetails `json:"addressDetails"`
	Source         string         `json:"source"`
	RawAddress     string         `json:"rawAddress"`
	Name           string         `json:"name"`
}

type LocationWriteRepository

type LocationWriteRepository interface {
	CreateLocation(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, locationId string, data data_fields.LocationFields) error
	UpdateLocation(ctx context.Context, tenant, locationId string, data LocationUpdateFields) error
	FailLocationValidation(ctx context.Context, tenant, locationId, validationError string, validatedAt time.Time) error
	LocationValidated(ctx context.Context, tenant, locationId string, addressDetails AddressDetails, validatedAt time.Time) error
	LinkWithOrganization(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, organizationId, locationId string) error
	LinkWithContact(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, contactId, locationId string) error
}

func NewLocationWriteRepository

func NewLocationWriteRepository(driver *neo4j.DriverWithContext, database string) LocationWriteRepository

type LogEntryReadRepository

type LogEntryReadRepository interface {
	GetById(ctx context.Context, tenant, id string) (*dbtype.Node, error)
}

func NewLogEntryReadRepository

func NewLogEntryReadRepository(driver *neo4j.DriverWithContext, database string) LogEntryReadRepository

type LogEntryWriteRepository

type LogEntryWriteRepository interface {
	CreateInTx(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, logEntryId string, data data_fields.LogEntryFields) error
	UpdateInTx(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, logEntryId string, data data_fields.LogEntryFields) error
}

func NewLogEntryWriteRepository

func NewLogEntryWriteRepository(driver *neo4j.DriverWithContext, database string) LogEntryWriteRepository

type MarkdownEventWriteRepository

type MarkdownEventWriteRepository interface {
	CreateInTx(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, markdownEventId string, data data_fields.MarkdownEventFields) error
}

func NewMarkdownEventWriteRepository

func NewMarkdownEventWriteRepository(driver *neo4j.DriverWithContext, database string) MarkdownEventWriteRepository

type OpportunityReadRepository

type OpportunityReadRepository interface {
	GetOpportunityById(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, opportunityId string) (*dbtype.Node, error)
	GetActiveRenewalOpportunityForContract(ctx context.Context, tenant, contractId string) (*dbtype.Node, error)
	GetActiveRenewalOpportunitiesForOrganization(ctx context.Context, tenant, organizationId string, includeDraftContracts bool) ([]*dbtype.Node, error)
	GetRenewalOpportunitiesForClosingAsLost(ctx context.Context, limit int) ([]TenantAndOpportunityId, error)
	GetPreviousClosedWonRenewalOpportunityForContract(ctx context.Context, tenant, contractId string) (*dbtype.Node, error)
	GetForContracts(ctx context.Context, tenant string, contractIds []string) ([]*utils.DbNodeAndId, error)
	GetForOrganizations(ctx context.Context, tenant string, organizationIds []string) ([]*utils.DbNodeAndId, error)
	GetPaginatedOpportunitiesLinkedToAnOrganization(ctx context.Context, tenant string, skip, limit int) (*utils.DbNodesWithTotalCount, error)
}

func NewOpportunityReadRepository

func NewOpportunityReadRepository(driver *neo4j.DriverWithContext, database string) OpportunityReadRepository

type OpportunityWriteRepository

type OpportunityWriteRepository interface {
	Save(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, opportunityId string, data data_fields.OpportunityFields) error
	ReplaceOwner(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, opportunityId, userId string) error
	RemoveOwner(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, opportunityId string) error
	CreateRenewal(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, opportunityId string, data data_fields.OpportunityFields) (bool, error)
	UpdateRenewal(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, opportunityId string, data data_fields.OpportunityFields) error
	CloseWon(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, opportunityId string, closedAt time.Time) error
	CloseLost(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, opportunityId string, closedAt time.Time) error
	MarkRenewalRequested(ctx context.Context, tenant, opportunityId string) error
	Archive(ctx context.Context, tenant, opportunityId string) error
}

func NewOpportunityWriteRepository

func NewOpportunityWriteRepository(driver *neo4j.DriverWithContext, database string) OpportunityWriteRepository

type OrganizationReadRepository

type OrganizationReadRepository interface {
	CountByTenant(ctx context.Context, tenant string) (int64, error)
	GetOrganization(ctx context.Context, tenant, organizationId string) (*dbtype.Node, error)
	GetOrganizationIdsConnectedToInteractionEvent(ctx context.Context, tenant, interactionEventId string) ([]string, error)
	GetOrganizationByOpportunityId(ctx context.Context, tenant, opportunityId string) (*dbtype.Node, error)
	GetOrganizationByContactId(ctx context.Context, tenant, contactId string) (*dbtype.Node, error)
	GetOrganizationByContractId(ctx context.Context, tenant, contractId string) (*dbtype.Node, error)
	GetOrganizationByInvoiceId(ctx context.Context, tenant, invoiceId string) (*dbtype.Node, error)
	GetOrganizationByCustomerOsId(ctx context.Context, tenant, customerOsId string) (*dbtype.Node, error)
	GetOrganizationByReferenceId(ctx context.Context, tenant, referenceId string) (*dbtype.Node, error)
	GetOrganizationByIdOrCustomerOsId(ctx context.Context, tenant, id string) (*dbtype.Node, error)
	GetOrganizationByDomain(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, domain string) (*dbtype.Node, error)
	GetOrganizationBySocialUrl(ctx context.Context, tenant, socialUrl string) (*dbtype.Node, error)
	GetOrganizationsByLinkedIn(ctx context.Context, tenant, url, alias, externalId string) ([]*dbtype.Node, error)
	GetForApiCache(ctx context.Context, tenant string, skip, limit int) ([]map[string]interface{}, error)
	GetPatchesForApiCache(ctx context.Context, tenant string, lastPatchTimestamp time.Time) ([]map[string]interface{}, error)
	GetAllForInvoices(ctx context.Context, tenant string, invoiceIds []string) ([]*utils.DbNodeAndId, error)
	GetAllForSlackChannels(ctx context.Context, tenant string, slackChannelIds []string) ([]*utils.DbNodeAndId, error)
	GetAllForOpportunities(ctx context.Context, tenant string, opportunityIds []string) ([]*utils.DbNodeAndId, error)
	GetOrganizationsForUpdateNextRenewalDate(ctx context.Context, limit int) ([]TenantAndOrganizationId, error)
	GetOrganizationsWithWebsiteAndWithoutDomains(ctx context.Context, limit, delayInMinutes int) ([]TenantAndOrganizationId, error)
	GetOrganizationsForEnrichByDomain(ctx context.Context, limit, delayInMinutes int) ([]TenantAndOrganizationIdExtended, error)
	GetOrganizationsForAdjustIndustry(ctx context.Context, delayInMinutes, limit int, validIndustries []string) ([]TenantAndOrganizationId, error)
	GetOrganizationsForUpdateLastTouchpoint(ctx context.Context, limit, delayFromPreviousCheckMin int) ([]TenantAndOrganizationId, error)
	GetPrimaryOrganizationsWithJobRoleForContacts(ctx context.Context, tenant string, contactIds []string) ([]*utils.DbNodePairAndId, error)
	GetHiddenOrganizationIds(ctx context.Context, tenant string, hiddenAfter time.Time) ([]string, error)
	GetMergedOrganizationIds(ctx context.Context, tenant string, mergedAfter time.Time) ([]string, error)
	GetOrganizationsWithEmail(ctx context.Context, tenant, email string) ([]*dbtype.Node, error)
	GetOrganizationsToCheck(ctx context.Context, minutesSinceLastUpdate, hoursSinceLastCheck, limit int) ([]TenantAndOrganization, error)
	GetActiveOrganizationIdsByDomain(ctx context.Context, tenant string, domains []string) (map[string]string, error)
	GetLinkedSubOrganizations(ctx context.Context, tenant string, parentOrganizationIds []string, relationName string) ([]*utils.DbNodeWithRelationAndId, error)
	GetLinkedParentOrganizations(ctx context.Context, tenant string, organizationIds []string, relationName string) ([]*utils.DbNodeWithRelationAndId, error)
}

func NewOrganizationReadRepository

func NewOrganizationReadRepository(driver *neo4j.DriverWithContext, database string) OrganizationReadRepository

type OrganizationWithFiltersReadRepository

type OrganizationWithFiltersReadRepository interface {
	GetFilteredOrganizationIds(ctx context.Context, tenant string, filter *model.Filter) ([]string, error)
}

func NewOrganizationWithFiltersReadRepository

func NewOrganizationWithFiltersReadRepository(driver *neo4j.DriverWithContext, database string) OrganizationWithFiltersReadRepository

type OrganizationWriteRepository

type OrganizationWriteRepository interface {
	Save(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, organizationId string, data data_fields.OrganizationFields) error
	LinkWithDomain(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, organizationId, domain string) (bool, error)
	UnlinkDomain(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, organizationId, domain string) error
	ReplaceOwner(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, organizationId, userId string) error
	// Deprecated -> use Save with Hide property
	SetVisibility(ctx context.Context, tenant, organizationId string, hide bool) error
	UpdateLastTouchpoint(ctx context.Context, tenant, organizationId string, touchpointAt *time.Time, touchpointId, touchpointType string) error
	SetCustomerOsIdIfMissing(ctx context.Context, tenant, organizationId, customerOsId string) error
	LinkWithParentOrganization(ctx context.Context, tenant, organizationId, parentOrganizationId, subOrganizationType string) error
	UnlinkParentOrganization(ctx context.Context, tenant, organizationId, parentOrganizationId string) error
	UpdateArr(ctx context.Context, tenant, organizationId string) error
	UpdateRenewalSummary(ctx context.Context, tenant, organizationId string, likelihood *string, likelihoodOrder *int64, nextRenewalDate *time.Time) error
	WebScrapeRequested(ctx context.Context, tenant, organizationId, url string, attempt int64, requestedAt time.Time) error
	UpdateOnboardingStatus(ctx context.Context, tenant, organizationId, status, comments string, statusOrder *int64, updatedAt time.Time) error
	UpdateTimeProperty(ctx context.Context, tenant, organizationId, property string, value *time.Time) error
	UpdateFloatProperty(ctx context.Context, tenant, organizationId, property string, value float64) error
	UpdateStringProperty(ctx context.Context, tenant, organizationId, property string, value string) error
	Archive(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, organizationId string) error
	ResetEnrichAttempts(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, organizationId string) error
	RefreshContactCountByOrgId(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, organizationId string) error
	RefreshContactCountByContactId(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, contactId string) error
}

func NewOrganizationWriteRepository

func NewOrganizationWriteRepository(driver *neo4j.DriverWithContext, database string) OrganizationWriteRepository

type PhoneNumberCreateFields

type PhoneNumberCreateFields struct {
	RawPhoneNumber string             `json:"rawPhoneNumber"`
	SourceFields   model.SourceFields `json:"sourceFields"`
	CreatedAt      time.Time          `json:"createdAt"`
}

type PhoneNumberReadRepository

type PhoneNumberReadRepository interface {
	GetPhoneNumberIdIfExists(ctx context.Context, tenant, phoneNumber string) (string, error)
	GetCountryCodeA2ForPhoneNumber(ctx context.Context, tenant, phoneNumberId string) (string, error)
	GetById(ctx context.Context, tenant, phoneNumberId string) (*dbtype.Node, error)
	GetAllForLinkedEntityIds(ctx context.Context, tenant string, entityType neo4jenum.EntityType, entityIds []string) ([]*utils.DbNodeWithRelationAndId, error)
	Exists(ctx context.Context, tenant string, e164 string) (bool, error)
	GetByPhoneNumber(ctx context.Context, tenant, e164 string) (*dbtype.Node, error)
}

func NewPhoneNumberReadRepository

func NewPhoneNumberReadRepository(driver *neo4j.DriverWithContext, database string) PhoneNumberReadRepository

type PhoneNumberValidateFields

type PhoneNumberValidateFields struct {
	E164          string    `json:"e164"`
	CountryCodeA2 string    `json:"countryCodeA2"`
	ValidatedAt   time.Time `json:"validatedAt"`
	Source        string    `json:"source"`
	AppSource     string    `json:"appSource"`
}

type PhoneNumberWriteRepository

type PhoneNumberWriteRepository interface {
	CreatePhoneNumber(ctx context.Context, tenant, phoneNumberId string, data PhoneNumberCreateFields) error
	UpdatePhoneNumber(ctx context.Context, tenant, phoneNumberId, rawPhoneNumber, source string) error
	FailPhoneNumberValidation(ctx context.Context, tenant, phoneNumberId, validationError string) error
	PhoneNumberValidated(ctx context.Context, tenant, phoneNumberId string, data PhoneNumberValidateFields) error
	LinkWithContact(ctx context.Context, tenant, contactId, phoneNumberId, label string, primary bool) error
	LinkWithOrganization(ctx context.Context, tenant, organizationId, phoneNumberId, label string, primary bool) error
	LinkWithUser(ctx context.Context, tenant, userId, phoneNumberId, label string, primary bool) error
	CleanPhoneNumberValidation(ctx context.Context, tenant, phoneNumberId string) error
	RemoveRelationship(ctx context.Context, entityType commonModel.EntityType, tenant, entityId, phoneNumber string) error
	RemoveRelationshipById(ctx context.Context, entityType commonModel.EntityType, tenant, entityId, phoneNumberId string) error
}

func NewPhoneNumberWriteRepository

func NewPhoneNumberWriteRepository(driver *neo4j.DriverWithContext, database string) PhoneNumberWriteRepository

type PlayerFields

type PlayerFields struct {
	AuthId       string             `json:"authId"`
	Provider     string             `json:"provider"`
	IdentityId   string             `json:"identityId"`
	CreatedAt    time.Time          `json:"createdAt"`
	SourceFields model.SourceFields `json:"sourceFields"`
}

type PlayerReadRepository

type PlayerReadRepository interface {
	GetPlayerByAuthIdProvider(ctx context.Context, authId string, provider string) (*dbtype.Node, error)
	GetUsersForPlayer(ctx context.Context, ids []string) ([]*utils.DbNodeWithRelationIdAndTenant, error)
	GetPlayerByIdentityId(ctx context.Context, identityId string) (*dbtype.Node, error)
	GetPlayerForUser(ctx context.Context, userId string, relation entity.PlayerRelation) (*dbtype.Node, error)
}

func NewPlayerReadRepository

func NewPlayerReadRepository(driver *neo4j.DriverWithContext, database string) PlayerReadRepository

type PlayerWriteRepository

type PlayerWriteRepository interface {
	Merge(ctx context.Context, userId string, data entity.PlayerEntity) error

	SetDefaultUser(ctx context.Context, tenant, userId, playerId string, relation entity.PlayerRelation) error
	LinkWithUser(ctx context.Context, tenant, userId, playerId string, relation entity.PlayerRelation) error
	UnlinkUser(ctx context.Context, tenant, userId, playerId string, relation entity.PlayerRelation) error
}

func NewPlayerWriteRepository

func NewPlayerWriteRepository(driver *neo4j.DriverWithContext, database string) PlayerWriteRepository

type ReminderReadRepository

type ReminderReadRepository interface {
	GetReminderById(ctx context.Context, id string) (*dbtype.Node, error)
	GetRemindersOrderByDueDateAsc(ctx context.Context, organizationId string, dismissed *bool) ([]*dbtype.Node, error)
	GetReadyToSend(ctx context.Context, dueDate time.Time) ([]*dbtype.Node, error)
}

func NewReminderReadRepository

func NewReminderReadRepository(driver *neo4j.DriverWithContext, database string) ReminderReadRepository

type ReminderUpdateFields

type ReminderUpdateFields struct {
	Content         *string
	DueDate         *time.Time
	Dismissed       *bool
	Sent            *bool
	UpdateContent   bool
	UpdateDueDate   bool
	UpdateDismissed bool
	UpdateSent      bool
}

type ReminderWriteRepository

type ReminderWriteRepository interface {
	CreateReminder(ctx context.Context, tenant, id, userId, organizationId, content string, createdAt, dueDate time.Time) error
	UpdateReminder(ctx context.Context, tenant, id string, data ReminderUpdateFields) error
	DeleteReminder(ctx context.Context, tenant, id string) error
}

func NewReminderWriteRepository

func NewReminderWriteRepository(driver *neo4j.DriverWithContext, database string) ReminderWriteRepository

type RenewalOpportunityUpdateFields

type RenewalOpportunityUpdateFields struct {
	UpdatedAt                 time.Time  `json:"updatedAt"`
	Source                    string     `json:"source"`
	UpdatedByUserId           string     `json:"updatedByUserId"`
	SetUpdatedByUserId        bool       `json:"setUpdatedByUserId"`
	Comments                  string     `json:"comments"`
	Amount                    float64    `json:"amount"`
	RenewalLikelihood         string     `json:"renewalLikelihood"`
	RenewalApproved           bool       `json:"renewalApproved"`
	RenewedAt                 *time.Time `json:"renewedAt"`
	RenewalAdjustedRate       int64      `json:"renewalAdjustedRate"`
	UpdateComments            bool       `json:"updateComments"`
	UpdateAmount              bool       `json:"updateAmount"`
	UpdateRenewalLikelihood   bool       `json:"updateRenewalLikelihood"`
	UpdateRenewalApproved     bool       `json:"updateRenewalApproved"`
	UpdateRenewedAt           bool       `json:"updateRenewedAt"`
	UpdateRenewalAdjustedRate bool       `json:"updateRenewalAdjustedRate"`
}

type Repositories

type Repositories struct {
	Neo4jDriver *neo4j.DriverWithContext
	Database    string

	ActionReadRepository                     ActionReadRepository
	ActionWriteRepository                    ActionWriteRepository
	AttachmentReadRepository                 AttachmentReadRepository
	AttachmentWriteRepository                AttachmentWriteRepository
	BankAccountReadRepository                BankAccountReadRepository
	BankAccountWriteRepository               BankAccountWriteRepository
	BillingProfileWriteRepository            BillingProfileWriteRepository
	CommentReadRepository                    CommentReadRepository
	CommentWriteRepository                   CommentWriteRepository
	CommonReadRepository                     CommonReadRepository
	CommonWriteRepository                    CommonWriteRepository
	ContactReadRepository                    ContactReadRepository
	ContactWithFiltersReadRepository         ContactWithFiltersReadRepository
	ContactWriteRepository                   ContactWriteRepository
	ContractReadRepository                   ContractReadRepository
	ContractWriteRepository                  ContractWriteRepository
	CountryReadRepository                    CountryReadRepository
	CountryWriteRepository                   CountryWriteRepository
	CustomFieldWriteRepository               CustomFieldWriteRepository
	CustomFieldTemplateReadRepository        CustomFieldTemplateReadRepository
	CustomFieldTemplateWriteRepository       CustomFieldTemplateWriteRepository
	DomainReadRepository                     DomainReadRepository
	DomainWriteRepository                    DomainWriteRepository
	EmailReadRepository                      EmailReadRepository
	EmailWriteRepository                     EmailWriteRepository
	ExternalSystemReadRepository             ExternalSystemReadRepository
	ExternalSystemWriteRepository            ExternalSystemWriteRepository
	FlowReadRepository                       FlowReadRepository
	FlowWriteRepository                      FlowWriteRepository
	FlowActionReadRepository                 FlowActionReadRepository
	FlowActionWriteRepository                FlowActionWriteRepository
	FlowParticipantReadRepository            FlowParticipantReadRepository
	FlowParticipantWriteRepository           FlowParticipantWriteRepository
	FlowSenderReadRepository                 FlowSenderReadRepository
	FlowSenderWriteRepository                FlowSenderWriteRepository
	FlowExecutionSettingsReadRepository      FlowExecutionSettingsReadRepository
	FlowExecutionSettingsWriteRepository     FlowExecutionSettingsWriteRepository
	FlowActionExecutionReadRepository        FlowActionExecutionReadRepository
	FlowActionExecutionWriteRepository       FlowActionExecutionWriteRepository
	InteractionEventReadRepository           InteractionEventReadRepository
	InteractionEventWriteRepository          InteractionEventWriteRepository
	InteractionSessionReadRepository         InteractionSessionReadRepository
	InteractionSessionWriteRepository        InteractionSessionWriteRepository
	InvoiceReadRepository                    InvoiceReadRepository
	InvoiceWriteRepository                   InvoiceWriteRepository
	InvoiceLineReadRepository                InvoiceLineReadRepository
	InvoiceLineWriteRepository               InvoiceLineWriteRepository
	IssueReadRepository                      IssueReadRepository
	IssueWriteRepository                     IssueWriteRepository
	JobRoleReadRepository                    JobRoleReadRepository
	JobRoleWriteRepository                   JobRoleWriteRepository
	LocationReadRepository                   LocationReadRepository
	LocationWriteRepository                  LocationWriteRepository
	LogEntryReadRepository                   LogEntryReadRepository
	LogEntryWriteRepository                  LogEntryWriteRepository
	LinkedinConnectionRequestReadRepository  LinkedinConnectionRequestReadRepository
	LinkedinConnectionRequestWriteRepository LinkedinConnectionRequestWriteRepository
	MarkdownEventWriteRepository             MarkdownEventWriteRepository
	OpportunityReadRepository                OpportunityReadRepository
	OpportunityWriteRepository               OpportunityWriteRepository
	OrganizationReadRepository               OrganizationReadRepository
	OrganizationWithFiltersReadRepository    OrganizationWithFiltersReadRepository
	OrganizationWriteRepository              OrganizationWriteRepository
	PhoneNumberReadRepository                PhoneNumberReadRepository
	PhoneNumberWriteRepository               PhoneNumberWriteRepository
	PlayerReadRepository                     PlayerReadRepository
	PlayerWriteRepository                    PlayerWriteRepository
	ReminderReadRepository                   ReminderReadRepository
	ReminderWriteRepository                  ReminderWriteRepository
	ServiceLineItemReadRepository            ServiceLineItemReadRepository
	ServiceLineItemWriteRepository           ServiceLineItemWriteRepository
	StateReadRepository                      StateReadRepository
	SocialReadRepository                     SocialReadRepository
	SocialWriteRepository                    SocialWriteRepository
	TagReadRepository                        TagReadRepository
	TagWriteRepository                       TagWriteRepository
	TenantReadRepository                     TenantReadRepository
	TenantWriteRepository                    TenantWriteRepository
	TimelineEventReadRepository              TimelineEventReadRepository
	UserReadRepository                       UserReadRepository
	UserWriteRepository                      UserWriteRepository
	WorkspaceReadRepository                  WorkspaceReadRepository
	WorkspaceWriteRepository                 WorkspaceWriteRepository
}

func InitNeo4jRepositories

func InitNeo4jRepositories(driver *neo4j.DriverWithContext, neo4jDatabase string) *Repositories

type ServiceLineItemReadRepository

type ServiceLineItemReadRepository interface {
	GetServiceLineItemById(ctx context.Context, tenant, serviceLineItemId string) (*dbtype.Node, error)
	GetServiceLineItemsByParentId(ctx context.Context, tenant, sliParentId string) ([]*dbtype.Node, error)
	GetServiceLineItemsForContract(ctx context.Context, tenant, contractId string) ([]*dbtype.Node, error)
	GetServiceLineItemsForContracts(ctx context.Context, tenant string, contractIds []string) ([]*utils.DbNodeAndId, error)
	GetServiceLineItemsForInvoiceLines(ctx context.Context, tenant string, invoiceLineIds []string) ([]*utils.DbNodeAndId, error)
	GetLatestServiceLineItemByParentId(ctx context.Context, tenant, serviceLineItemParentId string, beforeDate *time.Time) (*dbtype.Node, error)
	WasServiceLineItemInvoiced(ctx context.Context, tenant, serviceLineItemId string) (bool, error)
}

func NewServiceLineItemReadRepository

func NewServiceLineItemReadRepository(driver *neo4j.DriverWithContext, database string) ServiceLineItemReadRepository

type ServiceLineItemUpdateFields

type ServiceLineItemUpdateFields struct {
	Price     float64    `json:"price"`
	Quantity  int64      `json:"quantity"`
	Name      string     `json:"name"`
	Billed    string     `json:"billed"`
	Comments  string     `json:"comments"`
	Source    string     `json:"source"`
	VatRate   float64    `json:"vatRate"`
	StartedAt *time.Time `json:"startedAt"`
}

type ServiceLineItemWriteRepository

type ServiceLineItemWriteRepository interface {
	CreateForContract(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, serviceLineItemId string, data data_fields.SLIFields) error
	Update(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, serviceLineItemId string, data data_fields.SLIFields) error
	Delete(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, serviceLineItemId string) error
	Close(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, serviceLineItemId string, endedAt time.Time, isCanceled bool) error
	AdjustEndDates(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, parentId string) error
}

func NewServiceLineItemWriteRepository

func NewServiceLineItemWriteRepository(driver *neo4j.DriverWithContext, database string) ServiceLineItemWriteRepository

type SocialFields

type SocialFields struct {
	SocialId       string             `json:"socialId"`
	Url            string             `json:"url"`
	Alias          string             `json:"alias"`
	FollowersCount int64              `json:"followersCount"`
	ExternalId     string             `json:"externalId"`
	CreatedAt      time.Time          `json:"createdAt"`
	SourceFields   model.SourceFields `json:"sourceFields"`
}

type SocialReadRepository

type SocialReadRepository interface {
	GetDuplicatedSocialsForEntityType(ctx context.Context, linkedEntityNodeLabel string, minutesSinceLastUpdate, limit int) ([]TenantSocialIdAndEntityId, error)
	GetEmptySocialsForEntityType(ctx context.Context, linkedEntityNodeLabel string, minutesSinceLastUpdate, limit int) ([]TenantSocialIdAndEntityId, error)
	GetAllForEntities(ctx context.Context, tenant string, linkedEntityType neo4jenum.EntityType, linkedEntityIds []string) ([]*utils.DbNodeAndId, error)
	GetAllLinkedinForEntities(ctx context.Context, tenant string, linkedEntityType neo4jenum.EntityType, linkedEntityIds []string) ([]*utils.DbNodeAndId, error)
	GetById(ctx context.Context, tenant, socialId string) (*dbtype.Node, error)
}

func NewSocialReadRepository

func NewSocialReadRepository(driver *neo4j.DriverWithContext, database string) SocialReadRepository

type SocialWriteRepository

type SocialWriteRepository interface {
	MergeSocialForEntity(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, linkedEntityId, linkedEntityNodeLabel string, data SocialFields) error
	PermanentlyDelete(ctx context.Context, tenant, socialId string) error
	RemoveSocialForEntityById(ctx context.Context, tenant, linkedEntityId, linkedEntityNodeLabel, socialId string) error
	RemoveSocialForEntityByUrl(ctx context.Context, tenant, linkedEntityId, linkedEntityNodeLabel, socialUrl string) error
	Update(ctx context.Context, tenant string, socialId, url string, alias, externalId *string) (*dbtype.Node, error)
}

func NewSocialWriteRepository

func NewSocialWriteRepository(driver *neo4j.DriverWithContext, database string) SocialWriteRepository

type StateReadRepository

type StateReadRepository interface {
	GetStatesByCountryId(ctx context.Context, countryId string) ([]*dbtype.Node, error)
}

func NewStateReadRepository

func NewStateReadRepository(driver *neo4j.DriverWithContext, database string) StateReadRepository

type TagReadRepository

type TagReadRepository interface {
	GetById(ctx context.Context, tenant, tagId string) (*dbtype.Node, error)
	GetAll(ctx context.Context, tenant string) ([]*dbtype.Node, error)
	GetAllByEntityType(ctx context.Context, tenant string, entityType commonmodel.EntityType) ([]*dbtype.Node, error)
	GetByEntityTypeAndName(ctx context.Context, tenant string, entityType commonmodel.EntityType, name string) (*dbtype.Node, error)
	GetForContacts(ctx context.Context, tenant string, contactIds []string) ([]*utils.DbNodeWithRelationAndId, error)
	GetForLogEntries(ctx context.Context, tenant string, logEntryIds []string) ([]*utils.DbNodeWithRelationAndId, error)
	GetForIssues(ctx context.Context, tenant string, issueIds []string) ([]*utils.DbNodeWithRelationAndId, error)
	GetForOrganizations(ctx context.Context, tenant string, organizationIds []string) ([]*utils.DbNodeWithRelationAndId, error)
}

func NewTagReadRepository

func NewTagReadRepository(driver *neo4j.DriverWithContext, database string) TagReadRepository

type TagWriteRepository

type TagWriteRepository interface {
	Merge(ctx context.Context, tx *neo4j.ManagedTransaction, tenant string, tag neo4jentity.TagEntity) (*dbtype.Node, error)
	LinkTagByIdToEntity(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, tagId, linkedEntityId string, entityType model.EntityType) error
	UnlinkTagByIdFromEntity(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, tagId, entityId string, entityType model.EntityType) error
	UnlinkAllAndDelete(ctx context.Context, tenant, tagId string) error
	UpdateName(ctx context.Context, tenant, tagId, name string) error
}

func NewTagWriteRepository

func NewTagWriteRepository(driver *neo4j.DriverWithContext, database string) TagWriteRepository

type TenantAndContact

type TenantAndContact struct {
	Tenant  string
	Contact *dbtype.Node
}

type TenantAndContactId

type TenantAndContactId struct {
	Tenant    string
	ContactId string
	FieldStr1 string
}

type TenantAndContractId

type TenantAndContractId struct {
	Tenant     string
	ContractId string
}

type TenantAndEmailId

type TenantAndEmailId struct {
	Tenant  string
	EmailId string
}

type TenantAndOpportunityId

type TenantAndOpportunityId struct {
	Tenant        string
	OpportunityId string
}

type TenantAndOrganization

type TenantAndOrganization struct {
	Tenant       string
	Organization *dbtype.Node
}

type TenantAndOrganizationId

type TenantAndOrganizationId struct {
	Tenant         string
	OrganizationId string
}

type TenantAndOrganizationIdExtended

type TenantAndOrganizationIdExtended struct {
	Tenant         string
	OrganizationId string
	Param1         string
}

type TenantReadRepository

type TenantReadRepository interface {
	GetAll(ctx context.Context) ([]*dbtype.Node, error)
	TenantExists(ctx context.Context, name string) (bool, error)
	GetTenantByName(ctx context.Context, tenant string) (*dbtype.Node, error)
	GetTenantByNameIgnoreCase(ctx context.Context, tenant string) (*dbtype.Node, error)
	GetTenantForWorkspaceProvider(ctx context.Context, workspaceName, workspaceProvider string) (*dbtype.Node, error)
	GetTenantForWorkspace(ctx context.Context, workspaceName string) (*dbtype.Node, error)
	GetTenantForUserEmail(ctx context.Context, email string) (*dbtype.Node, error)
	GetTenantSettings(ctx context.Context, tenant string) (*dbtype.Node, error)
	GetTenantBillingProfiles(ctx context.Context, tenant string) ([]*dbtype.Node, error)
	GetTenantBillingProfileById(ctx context.Context, tenant, id string) (*dbtype.Node, error)
}

func NewTenantReadRepository

func NewTenantReadRepository(driver *neo4j.DriverWithContext, database string) TenantReadRepository

type TenantSocialIdAndEntityId

type TenantSocialIdAndEntityId struct {
	Tenant         string
	SocialId       string
	LinkedEntityId string
}

type TenantWriteRepository

type TenantWriteRepository interface {
	CreateTenantIfNotExistAndReturn(ctx context.Context, tenant neo4jentity.TenantEntity) (*dbtype.Node, error)

	CreateTenantBillingProfile(ctx context.Context, tenant string, data data_fields.TenantBillingProfileFields) error
	UpdateTenantBillingProfile(ctx context.Context, tenant string, data data_fields.TenantBillingProfileFields) error

	UpdateTenantSettings(ctx context.Context, tenant string, data data_fields.TenantSettingsFields) error

	HardDeleteTenant(ctx context.Context, tenant string) error

	LinkWithWorkspace(ctx context.Context, tenant string, workspace neo4jentity.WorkspaceEntity) (bool, error)
}

func NewTenantWriteRepository

func NewTenantWriteRepository(driver *neo4j.DriverWithContext, database string) TenantWriteRepository

type TimelineEventReadRepository

type TimelineEventReadRepository interface {
	GetTimelineEvent(ctx context.Context, tenant, id string) (*dbtype.Node, error)
	CalculateAndGetLastTouchPoint(ctx context.Context, tenant, organizationId string) (*time.Time, string, error)
	GetTimelineEventsForContact(ctx context.Context, tenant, contactId string, startingDate time.Time, size int, labels []string) ([]*dbtype.Node, error)
	GetTimelineEventsForOrganization(ctx context.Context, tenant, organizationId string, startingDate time.Time, size int, labels []string) ([]*dbtype.Node, error)
	GetTimelineEventsTotalCountForContact(ctx context.Context, tenant string, id string, labels []string) (int64, error)
	GetTimelineEventsTotalCountForOrganization(ctx context.Context, tenant string, id string, labels []string) (int64, error)
	GetTimelineEventsWithIds(ctx context.Context, tenant string, ids []string) ([]*dbtype.Node, error)
	GetInboundCommsTimelineEventsCountByOrganizations(ctx context.Context, tenant string, orgIds []string) (map[string]int64, error)
	GetOutboundCommsTimelineEventsCountByOrganizations(ctx context.Context, tenant string, orgIds []string) (map[string]int64, error)
}

func NewTimelineEventReadRepository

func NewTimelineEventReadRepository(driver *neo4j.DriverWithContext, database string) TimelineEventReadRepository

type UserReadRepository

type UserReadRepository interface {
	GetAllForTenant(ctx context.Context, tenant string) ([]*dbtype.Node, error)
	GetByIds(ctx context.Context, tenant string, ids []string) ([]*dbtype.Node, error)
	GetUserById(ctx context.Context, tenant, userId string) (*dbtype.Node, error)
	FindFirstUserWithRolesByEmail(ctx context.Context, email string) (string, string, []string, error)
	FindTestUser(ctx context.Context) (*dbtype.Node, error)
	GetFirstUserByEmail(ctx context.Context, tenant, email string) (*dbtype.Node, error)
	GetAllOwnersForOrganizations(ctx context.Context, tenant string, organizationIDs []string) ([]*utils.DbNodeAndId, error)
	GetOwnerForOrganization(ctx context.Context, tenant, organizationId string) (*dbtype.Node, error)
	IsOwner(parentCtx context.Context, tenant, userId string) (bool, error)
	GetOwnerForContact(ctx context.Context, tenant, contactId string) (*dbtype.Node, error)
	GetCreatorForNote(ctx context.Context, tenant, noteId string) (*dbtype.Node, error)
	GetPaginatedCustomerUsers(ctx context.Context, tenant string, skip, limit int, filter *utils.CypherFilter, sort *utils.CypherSort) (*utils.DbNodesWithTotalCount, error)
	GetAllForEmails(ctx context.Context, tenant string, emailIds []string) ([]*utils.DbNodeAndId, error)
	GetAllForPhoneNumbers(ctx context.Context, tenant string, phoneNumberIds []string) ([]*utils.DbNodeAndId, error)
	GetAllOwnersForOpportunities(ctx context.Context, tenant string, opportunityIds []string) ([]*utils.DbNodeAndId, error)
	GetAllCreatorsForOpportunities(ctx context.Context, tenant string, opportunityIds []string) ([]*utils.DbNodeAndId, error)
	GetAllCreatorsForServiceLineItems(ctx context.Context, tenant string, serviceLineItemIds []string) ([]*utils.DbNodeAndId, error)
	GetAllCreatorsForContracts(ctx context.Context, tenant string, contractIds []string) ([]*utils.DbNodeAndId, error)
	GetAllAuthorsForLogEntries(ctx context.Context, tenant string, logEntryIDs []string) ([]*utils.DbNodeAndId, error)
	GetAllAuthorsForComments(ctx context.Context, tenant string, commentIds []string) ([]*utils.DbNodeAndId, error)
	GetAllSendersForFlowSenders(ctx context.Context, tenant string, flowSenderIds []string) ([]*utils.DbNodeAndId, error)
	GetUsersConnectedForContacts(ctx context.Context, tenant string, contactsIds []string) ([]*utils.DbNodeAndId, error)
	GetDistinctOrganizationOwners(ctx context.Context, tenant string) ([]*dbtype.Node, error)
	GetUsers(ctx context.Context, tenant string, ids []string) ([]*dbtype.Node, error)
	GetOwnerForContract(ctx context.Context, tenant, contractId string) (*dbtype.Node, error)
	GetOwnerForReminder(ctx context.Context, tenant, reminderId string) (*dbtype.Node, error)
}

func NewUserReadRepository

func NewUserReadRepository(driver *neo4j.DriverWithContext, database string) UserReadRepository

type UserUpdateFields

type UserUpdateFields struct {
	Name            string `json:"name"`
	FirstName       string `json:"firstName"`
	LastName        string `json:"lastName"`
	Source          string `json:"source"`
	ProfilePhotoUrl string `json:"profilePhotoUrl"`
	Timezone        string `json:"timezone"`
}

type UserWriteRepository

type UserWriteRepository interface {
	CreateUserInTx(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, userId string, data data_fields.UserFields) error
	UpdateUserInTx(ctx context.Context, tx *neo4j.ManagedTransaction, tenant, userId string, data data_fields.UserFields) error

	AddRole(ctx context.Context, userId, role string) error
	AddRoleInTx(ctx context.Context, tx neo4j.ManagedTransaction, userId, role string) error
	RemoveRole(ctx context.Context, tenant, userId, role string) error
	RegisterLogin(ctx context.Context, tenant, userId string) error
}

func NewUserWriteRepository

func NewUserWriteRepository(driver *neo4j.DriverWithContext, database string) UserWriteRepository

type WorkspaceReadRepository

type WorkspaceReadRepository interface {
	GetAllForTenant(ctx context.Context, tenant string) ([]*dbtype.Node, error)
	GetByName(ctx context.Context, tenant, name string) (*dbtype.Node, error)
}

func NewWorkspaceReadRepository

func NewWorkspaceReadRepository(driver *neo4j.DriverWithContext, database string) WorkspaceReadRepository

type WorkspaceWriteRepository

type WorkspaceWriteRepository interface {
	Merge(ctx context.Context, workspace entity.WorkspaceEntity) (*dbtype.Node, error)
}

func NewWorkspaceWriteRepository

func NewWorkspaceWriteRepository(driver *neo4j.DriverWithContext, database string) WorkspaceWriteRepository

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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