service

package
v0.0.0-...-50482f6 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: Apache-2.0 Imports: 61 Imported by: 31

Documentation

Index

Constants

View Source
const CalComHeader = "x-cal-signature-256"

Variables

This section is empty.

Functions

func HTMLToPlainText

func HTMLToPlainText(html string) (string, error)

func SignatureCheck

func SignatureCheck(hSignature string, body []byte, personalIntegrationRepository postgresRepository.PersonalIntegrationRepository, tenant, email, integration string) error

Types

type ApiCacheOrganization

type ApiCacheOrganization struct {
	Organization    *neo4jEntity.OrganizationEntity
	Contacts        []*string
	SocialMedia     []*string
	Tags            []*string
	Subsidiaries    []*string
	ParentCompanies []*string
	Owner           *string
}

type ApiCacheService

type ApiCacheService interface {
	GetApiCache(ctx context.Context, tenant string, page, limit int) ([]*ApiCacheOrganization, error)
	GetPatchesForApiCache(ctx context.Context, tenant string) ([]*ApiCacheOrganization, error)
}

func NewApiCacheService

func NewApiCacheService(repositories *neo4jRepository.Repositories, services *Services) ApiCacheService

type AttachmentService

type AttachmentService interface {
	GetById(ctx context.Context, id string) (*neo4jentity.AttachmentEntity, error)
	GetFor(ctx context.Context, entityType model.EntityType, relation *model.EntityRelation, ids []string) (*neo4jentity.AttachmentEntities, error)

	Create(ctx context.Context, record *neo4jentity.AttachmentEntity) (*neo4jentity.AttachmentEntity, error)
}

func NewAttachmentService

func NewAttachmentService(services *Services) AttachmentService

type AzureService

type AzureService interface {
	ReadEmailsFromAzureAd(ctx context.Context, importState *postgresEntity.UserEmailImportState) ([]*postgresEntity.EmailRawData, string, error)

	SendEmail(ctx context.Context, tenant string, request dto.MailRequest) (*parsemail.Email, error)
}

func NewAzureService

func NewAzureService(cfg *config.AzureOAuthConfig, repositories *postgresRepository.Repositories, services *Services) AzureService

type CommonService

type CommonService interface {
}

func NewCommonService

func NewCommonService(services *Services) CommonService

type ContractService

type ContractService interface {
	GetById(ctx context.Context, id string) (*neo4jentity.ContractEntity, error)
}

func NewContractService

func NewContractService(log logger.Logger, services *Services) ContractService

type CreateDraftRequest

type CreateDraftRequest struct {
	Message MailRequest `json:"message"`
}

type CurrencyService

type CurrencyService interface {
	GetRate(ctx context.Context, fromCurrency, toCurrency string) (float64, error)
}

func NewCurrencyService

func NewCurrencyService(repositories *postgresRepository.Repositories) CurrencyService

type DomainService

type DomainService interface {
	ExtractDomainFromOrganizationWebsite(ctx context.Context, websiteUrl string) string
	IsKnownCompanyHostingUrl(ctx context.Context, website string) bool
}

func NewDomainService

func NewDomainService(log logger.Logger, services *Services, cache *caches.Cache) DomainService

type DraftResponse

type DraftResponse struct {
	Id string `json:"id"`
}

type EmailService

type EmailService interface {
	Merge(c context.Context, input neo4jentity.EmailEntity, linkWith *LinkWith) (*string, error)
}

func NewEmailService

func NewEmailService(services *Services) EmailService

type EmailingService

type EmailingService interface {
	GenerateEmailSpyPixelUrl(ctx context.Context, tenant, publicUrl, uniqueMessageId, campaign, recipientId string, trackOpens bool) (url string, mid string, err error)
	GenerateEmailLinkUrl(ctx context.Context, tenant, publicUrl, redirectUrl, uniqueMessageId, campaign, recipientId string, trackClicks bool) (url string, mid string, lid string, err error)
	GenerateEmailUnsubscribeUrl(ctx context.Context, tenant, publicUrl, unsubscribeUrl, uniqueMessageId, campaign, recipientId string) (url string, mid string, err error)
}

func NewEmailingService

func NewEmailingService(log logger.Logger, services *Services) EmailingService

type ExternalSystemService

type ExternalSystemService interface {
	MergeExternalSystem(ctx context.Context, tenant, externalSystem string) error
}

func NewExternalSystemService

func NewExternalSystemService(log logger.Logger, services *Services) ExternalSystemService

type FlowExecutionService

type FlowExecutionService interface {
	GetFlowActionExecutions(ctx context.Context, flowId, contactId string) ([]*entity.FlowActionExecutionEntity, error)

	ScheduleFlow(ctx context.Context, tx *neo4j.ManagedTransaction, flowId, contactId string) error
}

func NewFlowExecutionService

func NewFlowExecutionService(services *Services) FlowExecutionService

type FlowService

type FlowService interface {
	FlowGetList(ctx context.Context) (*neo4jentity.FlowEntities, error)
	FlowGetById(ctx context.Context, id string) (*neo4jentity.FlowEntity, error)
	FlowGetByActionId(ctx context.Context, flowActionId string) (*neo4jentity.FlowEntity, error)
	FlowGetByContactId(ctx context.Context, flowContactId string) (*neo4jentity.FlowEntity, error)
	FlowsGetListWithContact(ctx context.Context, contactIds []string) (*neo4jentity.FlowEntities, error)
	FlowMerge(ctx context.Context, entity *neo4jentity.FlowEntity) (*neo4jentity.FlowEntity, error)
	FlowChangeStatus(ctx context.Context, id string, status neo4jentity.FlowStatus) (*neo4jentity.FlowEntity, error)

	FlowActionGetStart(ctx context.Context, flowId string) (*neo4jentity.FlowActionEntity, error)
	FlowActionGetNext(ctx context.Context, actionId string) ([]*neo4jentity.FlowActionEntity, error)
	FlowActionGetList(ctx context.Context, flowIds []string) (*neo4jentity.FlowActionEntities, error)
	FlowActionGetById(ctx context.Context, id string) (*neo4jentity.FlowActionEntity, error)

	FlowContactGetList(ctx context.Context, flowIds []string) (*neo4jentity.FlowContactEntities, error)
	FlowContactGetById(ctx context.Context, id string) (*neo4jentity.FlowContactEntity, error)
	FlowContactGetByContactId(ctx context.Context, flowId, contactId string) (*neo4jentity.FlowContactEntity, error)
	FlowContactAdd(ctx context.Context, flowId, contactId string) (*neo4jentity.FlowContactEntity, error)
	FlowContactDelete(ctx context.Context, flowContactId string) error

	FlowActionSenderGetList(ctx context.Context, actionIds []string) (*neo4jentity.FlowActionSenderEntities, error)
	FlowActionSenderGetById(ctx context.Context, id string) (*neo4jentity.FlowActionSenderEntity, error)
	FlowActionSenderMerge(ctx context.Context, flowActionId string, input *neo4jentity.FlowActionSenderEntity) (*neo4jentity.FlowActionSenderEntity, error)
	FlowActionSenderDelete(ctx context.Context, flowActionSenderId string) error
}

func NewFlowService

func NewFlowService(services *Services) FlowService

type GoogleService

type GoogleService interface {
	ServiceAccountCredentialsExistsForTenant(ctx context.Context, tenant string) (bool, error)

	GetGmailService(ctx context.Context, username, tenant string) (*gmail.Service, error)

	GetGmailServiceWithServiceAccount(ctx context.Context, username string, tenant string) (*gmail.Service, error)
	GetGCalServiceWithServiceAccount(ctx context.Context, username string, tenant string) (*calendar.Service, error)

	GetGmailServiceWithOauthToken(ctx context.Context, tokenEntity postgresEntity.OAuthTokenEntity) (*gmail.Service, error)
	GetGCalServiceWithOauthToken(ctx context.Context, tokenEntity postgresEntity.OAuthTokenEntity) (*calendar.Service, error)

	ReadEmails(ctx context.Context, batchSize int64, importState *postgresEntity.UserEmailImportState) ([]*postgresEntity.EmailRawData, string, error)

	SendEmail(ctx context.Context, tenant string, request dto.MailRequest) (*parsemail.Email, error)
}

func NewGoogleService

func NewGoogleService(cfg *config.GoogleOAuthConfig, postgresRepositories *postgresRepository.Repositories, services *Services) GoogleService

type GraphTraversalIterative

type GraphTraversalIterative struct {
	// contains filtered or unexported fields
}

type Integration

type Integration string
const (
	CALCOM Integration = "calcom"
)

type InteractionEventCreateData

type InteractionEventCreateData struct {
	InteractionEventEntity *neo4jentity.InteractionEventEntity
	SessionIdentifier      *string
	MeetingIdentifier      *string
	RepliesTo              *string
	SentBy                 []InteractionEventParticipantData
	SentTo                 []InteractionEventParticipantData
	SentCc                 []InteractionEventParticipantData
	SentBcc                []InteractionEventParticipantData
	ExternalSystem         *neo4jentity.ExternalSystemEntity
	Source                 neo4jentity.DataSource
	SourceOfTruth          neo4jentity.DataSource
}

type InteractionEventParticipantData

type InteractionEventParticipantData struct {
	Email       *string
	PhoneNumber *string
	ContactId   *string
	UserId      *string
}

type InteractionEventService

type InteractionEventService interface {
	GetById(ctx context.Context, id string) (*neo4jentity.InteractionEventEntity, error)
	GetInteractionEventsForInteractionSessions(ctx context.Context, ids []string, loadContent bool) (*neo4jentity.InteractionEventEntities, error)
	GetInteractionEventsForMeetings(ctx context.Context, ids []string, loadContent bool) (*neo4jentity.InteractionEventEntities, error)
	GetInteractionEventsForIssues(ctx context.Context, issueIds []string, loadContent bool) (*neo4jentity.InteractionEventEntities, error)
	GetSentByParticipantsForInteractionEvents(ctx context.Context, ids []string) (*neo4jentity.InteractionEventParticipants, error)
	GetSentToParticipantsForInteractionEvents(ctx context.Context, ids []string) (*neo4jentity.InteractionEventParticipants, error)
	GetReplyToInteractionsEventForInteractionEvents(ctx context.Context, ids []string, loadContent bool) (*neo4jentity.InteractionEventEntities, error)

	Create(ctx context.Context, data *InteractionEventCreateData) (*string, error)
	CreateInTx(ctx context.Context, tx neo4j.ManagedTransaction, data *InteractionEventCreateData) (*string, error)
}

func NewInteractionEventService

func NewInteractionEventService(services *Services) InteractionEventService

type InteractionSessionService

type InteractionSessionService interface {
	GetById(ctx context.Context, id string) (*neo4jentity.InteractionSessionEntity, error)
	GetAttendedByParticipantsForInteractionSessions(ctx context.Context, ids []string) (*neo4jentity.InteractionSessionParticipants, error)
	GetInteractionSessionsForInteractionEvents(ctx context.Context, ids []string) (*neo4jentity.InteractionSessionEntities, error)

	Create(ctx context.Context, data *neo4jentity.InteractionSessionEntity) (*string, error)
	CreateInTx(ctx context.Context, tx neo4j.ManagedTransaction, data *neo4jentity.InteractionSessionEntity) (*string, error)
}

func NewInteractionSessionService

func NewInteractionSessionService(services *Services) InteractionSessionService

type InvoiceService

type InvoiceService interface {
	GenerateNewRandomInvoiceNumber() string

	GetById(ctx context.Context, invoiceId string) (*neo4jentity.InvoiceEntity, error)
	GetByIdAcrossAllTenants(ctx context.Context, invoiceId string) (*neo4jentity.InvoiceEntity, string, error)
	GetByNumber(ctx context.Context, number string) (*neo4jentity.InvoiceEntity, error)
	GetInvoiceLinesForInvoices(ctx context.Context, invoiceIds []string) (*neo4jentity.InvoiceLineEntities, error)
	GetInvoicesForContracts(ctx context.Context, contractIds []string) (*neo4jentity.InvoiceEntities, error)
	SimulateInvoice(ctx context.Context, invoiceData *SimulateInvoiceRequestData) ([]*SimulateInvoiceResponseData, error)
	NextInvoiceDryRun(ctx context.Context, contractId, appSource string) (string, error)
	PayInvoice(ctx context.Context, invoiceId, appSource string) error
	VoidInvoice(ctx context.Context, invoiceId, appSource string) error

	FillCycleInvoice(ctx context.Context, invoiceEntity *neo4jentity.InvoiceEntity, sliEntities neo4jentity.ServiceLineItemEntities) (*neo4jentity.InvoiceEntity, []*invoicepb.InvoiceLine, error)
	FillOffCyclePrepaidInvoice(ctx context.Context, invoiceEntity *neo4jentity.InvoiceEntity, sliEntities neo4jentity.ServiceLineItemEntities) (*neo4jentity.InvoiceEntity, []*invoicepb.InvoiceLine, error)
}

func NewInvoiceService

func NewInvoiceService(services *Services) InvoiceService

type JobRoleService

type JobRoleService interface {
	GetAllForContact(ctx context.Context, contactId string) (*neo4jentity.JobRoleEntities, error)
	GetAllForContacts(ctx context.Context, contactIds []string) (*neo4jentity.JobRoleEntities, error)
	GetAllForOrganization(ctx context.Context, organizationId string) (*neo4jentity.JobRoleEntities, error)
	GetAllForOrganizations(ctx context.Context, organizationIds []string) (*neo4jentity.JobRoleEntities, error)
	DeleteJobRole(ctx context.Context, contactId, roleId string) (bool, error)
	CreateJobRole(ctx context.Context, contactId string, organizationId *string, entity *neo4jentity.JobRoleEntity) (*neo4jentity.JobRoleEntity, error)
	UpdateJobRole(ctx context.Context, contactId string, organizationId *string, entity *neo4jentity.JobRoleEntity) (*neo4jentity.JobRoleEntity, error)
	GetAllForUsers(ctx context.Context, userIds []string) (*neo4jentity.JobRoleEntities, error)
}

func NewJobRoleService

func NewJobRoleService(services *Services) JobRoleService

type LinkWith

type LinkWith struct {
	Type         model.EntityType
	Id           string
	Relationship string
}

type MailRequest

type MailRequest struct {
	Subject string `json:"subject"`
	Body    struct {
		ContentType string `json:"contentType"`
		Content     string `json:"content"`
	} `json:"body"`
	From struct {
		EmailAddress struct {
			Address string `json:"address"`
		} `json:"emailAddress"`
	} `json:"from"`
	ToRecipients  []Recipient `json:"toRecipients"`
	CcRecipients  []Recipient `json:"ccRecipients,omitempty"`
	BccRecipients []Recipient `json:"bccRecipients,omitempty"`
}

type MailService

type MailService interface {
	SaveMail(ctx context.Context, request dto.MailRequest, email *parsemail.Email, tenant, user, customerOSInternalIdentifier string) (*string, error)
	SendMail(ctx context.Context, request dto.MailRequest, username *string) (*parsemail.Email, error)
}

func NewMailService

func NewMailService(services *Services) MailService

type MicrosoftRawEmailResponse

type MicrosoftRawEmailResponse struct {
	Id                      string    `json:"id"`
	SentDateTime            time.Time `json:"sentDateTime"`
	InternetMessageId       string    `json:"internetMessageId"`
	Subject                 string    `json:"subject"`
	ConversationId          string    `json:"conversationId"`
	ConversationIndex       string    `json:"conversationIndex"`
	InferenceClassification string    `json:"inferenceClassification"`
	Body                    struct {
		ContentType string `json:"contentType"`
		Content     string `json:"content"`
	} `json:"body"`
	Sender struct {
		EmailAddress struct {
			Name    string `json:"name"`
			Address string `json:"address"`
		} `json:"emailAddress"`
	} `json:"sender"`
	From struct {
		EmailAddress struct {
			Name    string `json:"name"`
			Address string `json:"address"`
		} `json:"emailAddress"`
	} `json:"from"`
	ToRecipients []struct {
		EmailAddress struct {
			Name    string `json:"name"`
			Address string `json:"address"`
		} `json:"emailAddress"`
	} `json:"toRecipients"`
	CcRecipients []struct {
		EmailAddress struct {
			Name    string `json:"name"`
			Address string `json:"address"`
		} `json:"emailAddress"`
	} `json:"ccRecipients"`
	BccRecipients []struct {
		EmailAddress struct {
			Name    string `json:"name"`
			Address string `json:"address"`
		} `json:"emailAddress"`
	} `json:"bccRecipients"`
	ReplyTo []interface{} `json:"replyTo"`
}

type MicrosoftRawEmailsResponse

type MicrosoftRawEmailsResponse struct {
	OdataNextLink string                      `json:"@odata.nextLink"`
	Value         []MicrosoftRawEmailResponse `json:"value"`
}

type OpenSrsService

type OpenSrsService interface {
	Reply(ctx context.Context, tenant string, request dto.MailRequest) (*parsemail.Email, error)
}

func NewOpenSRSService

func NewOpenSRSService(services *Services) OpenSrsService

type Recipient

type Recipient struct {
	EmailAddress struct {
		Address string `json:"address"`
	} `json:"emailAddress"`
}

type RefreshTokenResponse

type RefreshTokenResponse struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	ExpiresIn    int    `json:"expires_in"`
	Scope        string `json:"scope"`
}

type ReplyRequest

type ReplyRequest struct {
	Message MailRequest `json:"message"`
	Comment string      `json:"comment"`
}

type SendDraftRequest

type SendDraftRequest struct {
	SaveToSentItems bool `json:"saveToSentItems"`
}

type ServiceLineItemService

type ServiceLineItemService interface {
	GetById(ctx context.Context, id string) (*neo4jentity.ServiceLineItemEntity, error)
	GetServiceLineItemsByParentId(ctx context.Context, sliParentId string) (*neo4jentity.ServiceLineItemEntities, error)
	GetServiceLineItemsForContract(ctx context.Context, contractId string) (*neo4jentity.ServiceLineItemEntities, error)
	GetServiceLineItemsForContracts(ctx context.Context, contractIds []string) (*neo4jentity.ServiceLineItemEntities, error)
	GetServiceLineItemsForInvoiceLines(ctx context.Context, invoiceLineIds []string) (*neo4jentity.ServiceLineItemEntities, error)
}

func NewServiceLineItemService

func NewServiceLineItemService(log logger.Logger, services *Services) ServiceLineItemService

type Services

type Services struct {
	PostgresRepositories *postgresRepository.Repositories
	Neo4jRepositories    *neo4jRepository.Repositories

	GrpcClients *grpc_client.Clients

	AttachmentService         AttachmentService
	ContractService           ContractService
	CommonService             CommonService
	CurrencyService           CurrencyService
	EmailService              EmailService
	EmailingService           EmailingService
	ExternalSystemService     ExternalSystemService
	FlowService               FlowService
	FlowExecutionService      FlowExecutionService
	JobRoleService            JobRoleService
	InvoiceService            InvoiceService
	InteractionSessionService InteractionSessionService
	InteractionEventService   InteractionEventService
	SlackChannelService       SlackChannelService
	ServiceLineItemService    ServiceLineItemService
	TenantService             TenantService
	UserService               UserService
	WorkflowService           WorkflowService
	WorkspaceService          WorkspaceService
	SocialService             SocialService
	DomainService             DomainService

	GoogleService  GoogleService
	AzureService   AzureService
	OpenSrsService OpenSrsService
	MailService    MailService

	ApiCacheService ApiCacheService
}

func InitServices

func InitServices(globalConfig *config.GlobalConfig, db *gorm.DB, driver *neo4j.DriverWithContext, neo4jDatabase string, grpcClients *grpc_client.Clients) *Services

type SimulateInvoiceLine

type SimulateInvoiceLine struct {
	Key               string
	ServiceLineItemID string
	ParentID          string
	Name              string
	Price             float64
	Quantity          int64
	Amount            float64
	TotalAmount       float64
}

type SimulateInvoiceRequestData

type SimulateInvoiceRequestData struct {
	ContractId   string
	ServiceLines []SimulateInvoiceRequestServiceLineData
}

type SimulateInvoiceRequestServiceLineData

type SimulateInvoiceRequestServiceLineData struct {
	Key               string
	ServiceLineItemID string
	ParentID          string
	Description       string
	Comments          string
	BillingCycle      enum.BilledType
	Price             float64
	Quantity          int64
	ServiceStarted    time.Time
	ServiceEnded      *time.Time
	TaxRate           *float64
	Canceled          bool
}

type SimulateInvoiceResponseData

type SimulateInvoiceResponseData struct {
	Invoice *neo4jentity.InvoiceEntity
	Lines   []*neo4jentity.InvoiceLineEntity
}

type SimulateInvoices

type SimulateInvoices struct {
	ContractId         string
	IssueDate          time.Time
	DueDate            time.Time
	InvoicePeriodStart time.Time
	InvoicePeriodEnd   time.Time
	InvoiceNumber      string
	InvoiceLines       []*SimulateInvoiceLine
}

type SlackChannelService

type SlackChannelService interface {
	GetSlackChannels(ctx context.Context, tenant string) ([]*postgresEntity.SlackChannel, error)
	GetPaginatedSlackChannels(ctx context.Context, tenant string, page, limit int) ([]*postgresEntity.SlackChannel, int64, error)

	StoreSlackChannel(ctx context.Context, tenant, source, channelId, channelName string, organizationId *string) error
}

func NewSlackChannelService

func NewSlackChannelService(repositories *postgresRepository.Repositories) SlackChannelService

type SocialService

type SocialService interface {
	Update(ctx context.Context, tenant string, entity neo4jentity.SocialEntity) (*neo4jentity.SocialEntity, error)
	GetAllForEntities(ctx context.Context, tenant string, linkedEntityType neo4jenum.EntityType, linkedEntityIds []string) (*neo4jentity.SocialEntities, error)
	Remove(ctx context.Context, tenant string, socialId string) error
}

func NewSocialService

func NewSocialService(log logger.Logger, services *Services) SocialService

type TenantService

type TenantService interface {
	GetAllTenants(ctx context.Context) ([]*neo4jentity.TenantEntity, error)
	GetTenantForWorkspace(ctx context.Context, workspaceEntity neo4jentity.WorkspaceEntity) (*neo4jentity.TenantEntity, error)
	GetTenantForUserEmail(ctx context.Context, email string) (*neo4jentity.TenantEntity, error)
	GetTenantSettings(ctx context.Context) (*neo4jentity.TenantSettingsEntity, error)
	GetTenantBillingProfiles(ctx context.Context) (*neo4jentity.TenantBillingProfileEntities, error)
	GetTenantBillingProfile(ctx context.Context, id string) (*neo4jentity.TenantBillingProfileEntity, error)
	GetDefaultTenantBillingProfile(ctx context.Context) (*neo4jentity.TenantBillingProfileEntity, error)

	Merge(ctx context.Context, tenantEntity neo4jentity.TenantEntity) (*neo4jentity.TenantEntity, error)

	HardDelete(ctx context.Context, tenant string) error
}

func NewTenantService

func NewTenantService(log logger.Logger, services *Services) TenantService

type UserCreateData

type UserCreateData struct {
	UserInput   neo4jentity.UserEntity
	EmailInput  neo4jentity.EmailEntity
	PlayerInput neo4jentity.PlayerEntity
}

type UserService

type UserService interface {
	GetAllUsersForTenant(ctx context.Context, tenant string) ([]*neo4jentity.UserEntity, error)

	Create(ctx context.Context, input UserCreateData) (*string, error)
}

func NewUserService

func NewUserService(service *Services) UserService

type WorkflowService

type WorkflowService interface {
	ExecuteWorkflow(ctx context.Context, tenant string, workflowId uint64) error
}

func NewWorkflowService

func NewWorkflowService(services *Services) WorkflowService

type WorkspaceService

type WorkspaceService interface {
	MergeToTenant(ctx context.Context, workspaceEntity neo4jentity.WorkspaceEntity, tenant string) (bool, error)
}

func NewWorkspaceService

func NewWorkspaceService(services *Services) WorkspaceService

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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