fb

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2021 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFirebaseRepository

func NewFirebaseRepository(
	firestoreClient FirestoreClientExtension,
	firebaseClient FirebaseClientExtension,
) repository.OnboardingRepository

NewFirebaseRepository initializes a Firebase repository

Types

type CreateCommand

type CreateCommand struct {
	CollectionName string
	Data           interface{}
}

CreateCommand represent payload required to perform a create operation in the database

type DeleteCommand

type DeleteCommand struct {
	CollectionName string
	ID             string
}

DeleteCommand represent payload required to perform a delete operation in the database

type FirebaseClientExtension

type FirebaseClientExtension interface {
	GetUserByPhoneNumber(ctx context.Context, phone string) (*auth.UserRecord, error)
	CreateUser(ctx context.Context, user *auth.UserToCreate) (*auth.UserRecord, error)
	DeleteUser(ctx context.Context, uid string) error
}

FirebaseClientExtension represents the methods we need from firebase `auth.Client`

func NewFirebaseClientExtensionImpl

func NewFirebaseClientExtensionImpl() FirebaseClientExtension

NewFirebaseClientExtensionImpl initializes a new FirebaseClient extension

type FirebaseClientExtensionImpl

type FirebaseClientExtensionImpl struct{}

FirebaseClientExtensionImpl ...

func (*FirebaseClientExtensionImpl) CreateUser

CreateUser ...

func (*FirebaseClientExtensionImpl) DeleteUser

func (f *FirebaseClientExtensionImpl) DeleteUser(ctx context.Context, uid string) error

DeleteUser ...

func (*FirebaseClientExtensionImpl) GetUserByPhoneNumber

func (f *FirebaseClientExtensionImpl) GetUserByPhoneNumber(ctx context.Context, phone string) (*auth.UserRecord, error)

GetUserByPhoneNumber ...

type FirestoreClientExtension

type FirestoreClientExtension interface {
	GetAll(ctx context.Context, query *GetAllQuery) ([]*firestore.DocumentSnapshot, error)
	Create(ctx context.Context, command *CreateCommand) (*firestore.DocumentRef, error)
	Update(ctx context.Context, command *UpdateCommand) error
	Delete(ctx context.Context, command *DeleteCommand) error
	Get(ctx context.Context, query *GetSingleQuery) (*firestore.DocumentSnapshot, error)
}

FirestoreClientExtension represents the methods we need from firebase `firestore.Client`

type FirestoreClientExtensionImpl

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

FirestoreClientExtensionImpl ...

func NewFirestoreClientExtension

func NewFirestoreClientExtension(fc *firestore.Client) *FirestoreClientExtensionImpl

NewFirestoreClientExtension initializes a new FirestoreClient extension

func (*FirestoreClientExtensionImpl) Create

Create persists data to a firestore collection

func (*FirestoreClientExtensionImpl) Delete

Delete deletes data to a firestore collection

func (*FirestoreClientExtensionImpl) Get

Get retrieves data to a firestore collection

func (*FirestoreClientExtensionImpl) GetAll

GetAll retrieve a value from the store

func (*FirestoreClientExtensionImpl) Update

Update updates data to a firestore collection

type GetAllQuery

type GetAllQuery struct {
	CollectionName string
	FieldName      string
	Value          interface{}
	Operator       string
}

GetAllQuery represent payload required to perform a request in the database

type GetSingleQuery

type GetSingleQuery struct {
	CollectionName string
	Value          string
}

GetSingleQuery represent payload required to get a single item from the database

type Repository

type Repository struct {
	FirestoreClient FirestoreClientExtension
	FirebaseClient  FirebaseClientExtension
}

Repository accesses and updates an item that is stored on Firebase

func (*Repository) ActivateSupplierProfile

func (fr *Repository) ActivateSupplierProfile(
	ctx context.Context,
	profileID string,
	supplier profileutils.Supplier,
) (*profileutils.Supplier, error)

ActivateSupplierProfile sets the active attribute of supplier profile to true

func (*Repository) AddAITSessionDetails

func (fr *Repository) AddAITSessionDetails(
	ctx context.Context,
	input *dto.SessionDetails,
) (*domain.USSDLeadDetails, error)

AddAITSessionDetails saves diallers session details in the database

func (*Repository) AddNHIFDetails

func (fr *Repository) AddNHIFDetails(
	ctx context.Context,
	input dto.NHIFDetailsInput,
	profileID string,
) (*domain.NHIFDetails, error)

AddNHIFDetails persists a user's NHIF details

func (*Repository) AddPartnerType

func (fr *Repository) AddPartnerType(
	ctx context.Context,
	profileID string,
	name *string,
	partnerType *profileutils.PartnerType,
) (bool, error)

AddPartnerType updates the suppier profile with the provided name and partner type.

func (*Repository) AddSupplierAccountType

func (fr *Repository) AddSupplierAccountType(
	ctx context.Context,
	profileID string,
	accountType profileutils.AccountType,
) (*profileutils.Supplier, error)

AddSupplierAccountType update the supplier profile with the correct account type

func (*Repository) AddUserAsExperimentParticipant

func (fr *Repository) AddUserAsExperimentParticipant(
	ctx context.Context,
	profile *profileutils.UserProfile,
) (bool, error)

AddUserAsExperimentParticipant adds the provided user profile as an experiment participant if does not already exist. this method is idempotent.

func (*Repository) CheckIfAdmin

func (fr *Repository) CheckIfAdmin(profile *profileutils.UserProfile) bool

CheckIfAdmin checks if a user has admin permissions

func (*Repository) CheckIfAdminProfileExists added in v0.0.23

func (fr *Repository) CheckIfAdminProfileExists(ctx context.Context, profileID string) (bool, error)

CheckIfAdminProfileExists return true if admin profile with profile ID provide exists, otherwise false

func (*Repository) CheckIfAgentProfileExists added in v0.0.23

func (fr *Repository) CheckIfAgentProfileExists(ctx context.Context, profileID string) (bool, error)

CheckIfAgentProfileExists return true if agent profile with profile ID provide exists, otherwise false

func (*Repository) CheckIfEmailExists

func (fr *Repository) CheckIfEmailExists(ctx context.Context, email string) (bool, error)

CheckIfEmailExists checks in both PRIMARY EMAIL and SECONDARY EMAIL for the existence of the argument email

func (*Repository) CheckIfExperimentParticipant

func (fr *Repository) CheckIfExperimentParticipant(
	ctx context.Context,
	profileID string,
) (bool, error)

CheckIfExperimentParticipant check if a user has subscribed to be an experiment participant

func (*Repository) CheckIfPhoneNumberExists

func (fr *Repository) CheckIfPhoneNumberExists(
	ctx context.Context,
	phoneNumber string,
) (bool, error)

CheckIfPhoneNumberExists checks both PRIMARY PHONE NUMBERs and SECONDARY PHONE NUMBERs for the existence of the argument phoneNumber.

func (*Repository) CheckIfRoleNameExists

func (fr *Repository) CheckIfRoleNameExists(ctx context.Context, name string) (bool, error)

CheckIfRoleNameExists checks if a role with a similar name exists Ensures unique name for each role during creation

func (*Repository) CheckIfUserHasPermission added in v0.0.2

func (fr *Repository) CheckIfUserHasPermission(
	ctx context.Context,
	UID string,
	requiredPermission profileutils.Permission,
) (bool, error)

CheckIfUserHasPermission checks if a user has the required permission

func (*Repository) CheckIfUsernameExists

func (fr *Repository) CheckIfUsernameExists(ctx context.Context, userName string) (bool, error)

CheckIfUsernameExists checks if the provided username exists. If true, it means its has already been associated with another user

func (*Repository) CreateAdminProfile added in v0.0.23

func (fr *Repository) CreateAdminProfile(ctx context.Context, adminProfile domain.AdminProfile) error

CreateAdminProfile creates an admin profile related to user profile

func (*Repository) CreateAgentProfile added in v0.0.23

func (fr *Repository) CreateAgentProfile(ctx context.Context, agentProfile domain.AgentProfile) error

CreateAgentProfile creates an agent profile related to user profile

func (*Repository) CreateDetailedSupplierProfile

func (fr *Repository) CreateDetailedSupplierProfile(
	ctx context.Context,
	profileID string,
	supplier profileutils.Supplier,
) (*profileutils.Supplier, error)

CreateDetailedSupplierProfile create a new supplier profile that is pre-filled using the provided profile ID

func (*Repository) CreateDetailedUserProfile

func (fr *Repository) CreateDetailedUserProfile(
	ctx context.Context,
	phoneNumber string,
	profile profileutils.UserProfile,
) (*profileutils.UserProfile, error)

CreateDetailedUserProfile creates a new user profile that is pre-filled using the provided phone number

func (*Repository) CreateEmptyCustomerProfile

func (fr *Repository) CreateEmptyCustomerProfile(
	ctx context.Context,
	profileID string,
) (*profileutils.Customer, error)

CreateEmptyCustomerProfile creates an empty customer profile

func (*Repository) CreateEmptySupplierProfile

func (fr *Repository) CreateEmptySupplierProfile(
	ctx context.Context,
	profileID string,
) (*profileutils.Supplier, error)

CreateEmptySupplierProfile creates an empty supplier profile

func (*Repository) CreateRole

func (fr *Repository) CreateRole(
	ctx context.Context,
	profileID string,
	input dto.RoleInput,
) (*profileutils.Role, error)

CreateRole creates a new role and persists it to the database

func (*Repository) CreateUserProfile

func (fr *Repository) CreateUserProfile(
	ctx context.Context,
	phoneNumber, uid string,
) (*profileutils.UserProfile, error)

CreateUserProfile creates a user profile of using the provided phone number and uid

func (*Repository) DeleteRole added in v0.0.2

func (fr *Repository) DeleteRole(
	ctx context.Context,
	roleID string,
) (bool, error)

DeleteRole removes a role permanently from the database

func (Repository) ExchangeRefreshTokenForIDToken

func (fr Repository) ExchangeRefreshTokenForIDToken(
	ctx context.Context,
	refreshToken string,
) (*profileutils.AuthCredentialResponse, error)

ExchangeRefreshTokenForIDToken takes a custom Firebase refresh token and tries to fetch an ID token and returns auth credentials if successful Otherwise, an error is returned

func (*Repository) FetchAdminUsers

func (fr *Repository) FetchAdminUsers(ctx context.Context) ([]*profileutils.UserProfile, error)

FetchAdminUsers fetches all admins

func (*Repository) FetchKYCProcessingRequestByID

func (fr *Repository) FetchKYCProcessingRequestByID(
	ctx context.Context,
	id string,
) (*domain.KYCRequest, error)

FetchKYCProcessingRequestByID retrieves a specific kyc processing request

func (*Repository) FetchKYCProcessingRequests

func (fr *Repository) FetchKYCProcessingRequests(
	ctx context.Context,
) ([]*domain.KYCRequest, error)

FetchKYCProcessingRequests retrieves all unprocessed kycs for admins

func (*Repository) GenerateAuthCredentials

func (fr *Repository) GenerateAuthCredentials(
	ctx context.Context,
	phone string,
	profile *profileutils.UserProfile,
) (*profileutils.AuthCredentialResponse, error)

GenerateAuthCredentials gets a Firebase user by phone and creates their tokens

func (*Repository) GenerateAuthCredentialsForAnonymousUser

func (fr *Repository) GenerateAuthCredentialsForAnonymousUser(
	ctx context.Context,
) (*profileutils.AuthCredentialResponse, error)

GenerateAuthCredentialsForAnonymousUser generates auth credentials for the anonymous user. This method is here since we don't want to delegate sign-in of anonymous users to the frontend. This is an effort the over reliance on firebase and lettin us handle all the heavy lifting

func (*Repository) GetAITDetails

func (fr *Repository) GetAITDetails(
	ctx context.Context,
	phoneNumber string,
) (*domain.USSDLeadDetails, error)

GetAITDetails retrieves session details from the database

func (*Repository) GetAITSessionDetails

func (fr *Repository) GetAITSessionDetails(
	ctx context.Context,
	sessionID string,
) (*domain.USSDLeadDetails, error)

GetAITSessionDetails gets Africa's Talking session details

func (Repository) GetAdminProfileCollectionName added in v0.0.23

func (fr Repository) GetAdminProfileCollectionName() string

GetAdminProfileCollectionName ...

func (Repository) GetAgentProfileCollectionName added in v0.0.23

func (fr Repository) GetAgentProfileCollectionName() string

GetAgentProfileCollectionName ...

func (*Repository) GetAllRoles added in v0.0.2

func (fr *Repository) GetAllRoles(ctx context.Context) (*[]profileutils.Role, error)

GetAllRoles returns a list of all created roles

func (Repository) GetCommunicationsSettingsCollectionName

func (fr Repository) GetCommunicationsSettingsCollectionName() string

GetCommunicationsSettingsCollectionName ...

func (Repository) GetCoverLinkingEventsCollectionName

func (fr Repository) GetCoverLinkingEventsCollectionName() string

GetCoverLinkingEventsCollectionName ...

func (*Repository) GetCustomerOrSupplierProfileByProfileID

func (fr *Repository) GetCustomerOrSupplierProfileByProfileID(
	ctx context.Context,
	flavour feedlib.Flavour,
	profileID string,
) (*profileutils.Customer, *profileutils.Supplier, error)

GetCustomerOrSupplierProfileByProfileID returns either a customer or supplier profile given the flavour and the profile ID that has been provided

func (*Repository) GetCustomerProfileByID

func (fr *Repository) GetCustomerProfileByID(
	ctx context.Context,
	id string,
) (*profileutils.Customer, error)

GetCustomerProfileByID fetch the customer profile by profile id.

func (*Repository) GetCustomerProfileByProfileID

func (fr *Repository) GetCustomerProfileByProfileID(
	ctx context.Context,
	profileID string,
) (*profileutils.Customer, error)

GetCustomerProfileByProfileID fetches customer profile by given ID

func (Repository) GetCustomerProfileCollectionName

func (fr Repository) GetCustomerProfileCollectionName() string

GetCustomerProfileCollectionName ...

func (*Repository) GetExperimentParticipantCollectionName

func (fr *Repository) GetExperimentParticipantCollectionName() string

GetExperimentParticipantCollectionName fetches the collection where experiment participant will be saved

func (Repository) GetKCYProcessCollectionName

func (fr Repository) GetKCYProcessCollectionName() string

GetKCYProcessCollectionName fetches collection where kyc processing request will be saved

func (Repository) GetMarketingDataCollectionName

func (fr Repository) GetMarketingDataCollectionName() string

GetMarketingDataCollectionName ...

func (*Repository) GetNHIFDetailsByProfileID

func (fr *Repository) GetNHIFDetailsByProfileID(
	ctx context.Context,
	profileID string,
) (*domain.NHIFDetails, error)

GetNHIFDetailsByProfileID fetches a user's NHIF details given their profile ID

func (Repository) GetNHIFDetailsCollectionName

func (fr Repository) GetNHIFDetailsCollectionName() string

GetNHIFDetailsCollectionName ...

func (*Repository) GetOrCreatePhoneNumberUser

func (fr *Repository) GetOrCreatePhoneNumberUser(
	ctx context.Context,
	phone string,
) (*dto.CreatedUserResponse, error)

GetOrCreatePhoneNumberUser retrieves or creates an phone number user account in Firebase Authentication

func (*Repository) GetPINByProfileID

func (fr *Repository) GetPINByProfileID(
	ctx context.Context,
	profileID string,
) (*domain.PIN, error)

GetPINByProfileID gets a user's PIN by their profile ID

func (Repository) GetPINsCollectionName

func (fr Repository) GetPINsCollectionName() string

GetPINsCollectionName returns a well suffixed PINs collection name

func (Repository) GetProfileNudgesCollectionName

func (fr Repository) GetProfileNudgesCollectionName() string

GetProfileNudgesCollectionName return the storage location of profile nudges

func (*Repository) GetRoleByID

func (fr *Repository) GetRoleByID(ctx context.Context, roleID string) (*profileutils.Role, error)

GetRoleByID gets role with matching id

func (*Repository) GetRoleByName added in v0.0.2

func (fr *Repository) GetRoleByName(ctx context.Context, roleName string) (*profileutils.Role, error)

GetRoleByName retrieves a role using it's name

func (*Repository) GetRolesByIDs

func (fr *Repository) GetRolesByIDs(
	ctx context.Context,
	roleIDs []string,
) (*[]profileutils.Role, error)

GetRolesByIDs gets all roles matching provided roleIDs if specified otherwise all roles

func (Repository) GetRolesCollectionName

func (fr Repository) GetRolesCollectionName() string

GetRolesCollectionName ...

func (Repository) GetRolesRevocationCollectionName added in v0.0.2

func (fr Repository) GetRolesRevocationCollectionName() string

GetRolesRevocationCollectionName ...

func (Repository) GetSMSCollectionName

func (fr Repository) GetSMSCollectionName() string

GetSMSCollectionName gets the collection name from firestore

func (*Repository) GetSupplierProfileByID

func (fr *Repository) GetSupplierProfileByID(
	ctx context.Context,
	id string,
) (*profileutils.Supplier, error)

GetSupplierProfileByID fetches supplier profile by given ID

func (*Repository) GetSupplierProfileByProfileID

func (fr *Repository) GetSupplierProfileByProfileID(
	ctx context.Context,
	profileID string,
) (*profileutils.Supplier, error)

GetSupplierProfileByProfileID fetch the supplier profile by profile id. since this same supplierProfile can be used for updating, a companion snapshot record is returned as well

func (Repository) GetSupplierProfileCollectionName

func (fr Repository) GetSupplierProfileCollectionName() string

GetSupplierProfileCollectionName ...

func (Repository) GetSurveyCollectionName

func (fr Repository) GetSurveyCollectionName() string

GetSurveyCollectionName returns a well suffixed PINs collection name

func (Repository) GetUSSDDataCollectionName

func (fr Repository) GetUSSDDataCollectionName() string

GetUSSDDataCollectionName gets the collection from firestore

func (Repository) GetUSSDEventsCollectionName

func (fr Repository) GetUSSDEventsCollectionName() string

GetUSSDEventsCollectionName ...

func (*Repository) GetUserCommunicationsSettings

func (fr *Repository) GetUserCommunicationsSettings(
	ctx context.Context,
	profileID string,
) (*profileutils.UserCommunicationsSetting, error)

GetUserCommunicationsSettings fetches the communication settings of a specific user.

func (*Repository) GetUserProfileByID

func (fr *Repository) GetUserProfileByID(
	ctx context.Context,
	id string,
	suspended bool,
) (*profileutils.UserProfile, error)

GetUserProfileByID retrieves a user profile by ID

func (*Repository) GetUserProfileByPhoneNumber

func (fr *Repository) GetUserProfileByPhoneNumber(
	ctx context.Context,
	phoneNumber string,
	suspended bool,
) (*profileutils.UserProfile, error)

GetUserProfileByPhoneNumber fetches a user profile by phone number. This method traverses both PRIMARY PHONE numbers and SECONDARY PHONE numbers.

func (*Repository) GetUserProfileByPhoneOrEmail added in v0.0.2

func (fr *Repository) GetUserProfileByPhoneOrEmail(ctx context.Context, payload *dto.RetrieveUserProfileInput) (*profileutils.UserProfile, error)

GetUserProfileByPhoneOrEmail retrieves user profile by email adddress

func (*Repository) GetUserProfileByPrimaryPhoneNumber

func (fr *Repository) GetUserProfileByPrimaryPhoneNumber(
	ctx context.Context,
	phoneNumber string,
	suspended bool,
) (*profileutils.UserProfile, error)

GetUserProfileByPrimaryPhoneNumber fetches a user profile by primary phone number

func (*Repository) GetUserProfileByUID

func (fr *Repository) GetUserProfileByUID(
	ctx context.Context,
	uid string,
	suspended bool,
) (*profileutils.UserProfile, error)

GetUserProfileByUID retrieves the user profile by UID

func (Repository) GetUserProfileCollectionName

func (fr Repository) GetUserProfileCollectionName() string

GetUserProfileCollectionName ...

func (*Repository) GetUserProfilesByRoleID added in v0.0.2

func (fr *Repository) GetUserProfilesByRoleID(ctx context.Context, roleID string) ([]*profileutils.UserProfile, error)

GetUserProfilesByRoleID returns a list of user profiles with the role ID i.e users assigned a particular role

func (*Repository) HardResetSecondaryEmailAddress

func (fr *Repository) HardResetSecondaryEmailAddress(
	ctx context.Context,
	profile *profileutils.UserProfile,
	newSecondaryEmails []string,
) error

HardResetSecondaryEmailAddress does a hard reset of user secondary email addresses. This should be called when retiring specific secondary email addresses and passing in the new secondary email address as an argument.

func (*Repository) HardResetSecondaryPhoneNumbers

func (fr *Repository) HardResetSecondaryPhoneNumbers(
	ctx context.Context,
	profile *profileutils.UserProfile,
	newSecondaryPhoneNumbers []string,
) error

HardResetSecondaryPhoneNumbers does a hard reset of user secondary phone numbers. This should be called when retiring specific secondary phone number and passing in the new secondary phone numbers as an argument.

func (*Repository) ListUserProfiles

func (fr *Repository) ListUserProfiles(
	ctx context.Context,
	role profileutils.RoleType,
) ([]*profileutils.UserProfile, error)

ListUserProfiles fetches all users with the specified role from the database

func (*Repository) PersistIncomingSMSData

func (fr *Repository) PersistIncomingSMSData(
	ctx context.Context,
	input *dto.AfricasTalkingMessage,
) error

PersistIncomingSMSData persists SMS data

func (*Repository) PurgeUserByPhoneNumber

func (fr *Repository) PurgeUserByPhoneNumber(ctx context.Context, phone string) error

PurgeUserByPhoneNumber removes the record of a user given a phone number.

func (*Repository) RecordPostVisitSurvey

func (fr *Repository) RecordPostVisitSurvey(
	ctx context.Context,
	input dto.PostVisitSurveyInput,
	UID string,
) error

RecordPostVisitSurvey records an end of visit survey

func (*Repository) RemoveKYCProcessingRequest

func (fr *Repository) RemoveKYCProcessingRequest(
	ctx context.Context,
	supplierProfileID string,
) error

RemoveKYCProcessingRequest removes the supplier's kyc processing request

func (*Repository) RemoveUserAsExperimentParticipant

func (fr *Repository) RemoveUserAsExperimentParticipant(
	ctx context.Context,
	profile *profileutils.UserProfile,
) (bool, error)

RemoveUserAsExperimentParticipant removes the provide user profile as an experiment participant. This methold does not check for existence before deletion since non-existence is relatively equivalent to a removal

func (*Repository) SaveCoverAutolinkingEvents

func (fr *Repository) SaveCoverAutolinkingEvents(
	ctx context.Context,
	input *dto.CoverLinkingEvent,
) (*dto.CoverLinkingEvent, error)

SaveCoverAutolinkingEvents saves cover linking events into the database

func (*Repository) SavePIN

func (fr *Repository) SavePIN(ctx context.Context, pin *domain.PIN) (bool, error)

SavePIN persist the data of the newly created PIN to a datastore

func (*Repository) SaveRoleRevocation added in v0.0.2

func (fr *Repository) SaveRoleRevocation(ctx context.Context, userID string, revocation dto.RoleRevocationInput) error

SaveRoleRevocation records a log for a role revocation

userId is the ID of the user removing a role from a user

func (*Repository) SaveUSSDEvent

func (fr *Repository) SaveUSSDEvent(
	ctx context.Context,
	input *dto.USSDEvent,
) (*dto.USSDEvent, error)

SaveUSSDEvent saves the USSD event that has taken place while interacting with the USSD

func (*Repository) SetUserCommunicationsSettings

func (fr *Repository) SetUserCommunicationsSettings(
	ctx context.Context,
	profileID string,
	allowWhatsApp *bool,
	allowTextSms *bool,
	allowPush *bool,
	allowEmail *bool,
) (*profileutils.UserCommunicationsSetting, error)

SetUserCommunicationsSettings sets communication settings for a specific user

func (*Repository) StageKYCProcessingRequest

func (fr *Repository) StageKYCProcessingRequest(
	ctx context.Context,
	data *domain.KYCRequest,
) error

StageKYCProcessingRequest stages the request which will be retrieved later for admins

func (*Repository) StageProfileNudge

func (fr *Repository) StageProfileNudge(
	ctx context.Context,
	nudge *feedlib.Nudge,
) error

StageProfileNudge stages nudges published from this service.

func (*Repository) UpdateAITSessionDetails

func (fr *Repository) UpdateAITSessionDetails(
	ctx context.Context,
	phoneNumber string,
	contactLead *domain.USSDLeadDetails,
) error

UpdateAITSessionDetails updates session details using phone number

func (*Repository) UpdateAddresses

func (fr *Repository) UpdateAddresses(
	ctx context.Context,
	id string,
	address profileutils.Address,
	addressType enumutils.AddressType,
) error

UpdateAddresses persists a user's home or work address information to the database

func (*Repository) UpdateBioData

func (fr *Repository) UpdateBioData(
	ctx context.Context,
	id string,
	data profileutils.BioData,
) error

UpdateBioData updates the biodate of the profile that matches the id

func (*Repository) UpdateCovers

func (fr *Repository) UpdateCovers(
	ctx context.Context,
	id string,
	covers []profileutils.Cover,
) error

UpdateCovers updates the covers attribute of the profile that matches the id

func (*Repository) UpdateCustomerProfile

func (fr *Repository) UpdateCustomerProfile(
	ctx context.Context,
	profileID string,
	cus profileutils.Customer,
) (*profileutils.Customer, error)

UpdateCustomerProfile does a generic update of the customer profile to add the data received from the ERP.

func (*Repository) UpdateFavNavActions

func (fr *Repository) UpdateFavNavActions(
	ctx context.Context,
	id string,
	favActions []string,
) error

UpdateFavNavActions update the permissions of the user profile

func (*Repository) UpdateKYCProcessingRequest

func (fr *Repository) UpdateKYCProcessingRequest(
	ctx context.Context,
	kycRequest *domain.KYCRequest,
) error

UpdateKYCProcessingRequest update the supplier profile

func (*Repository) UpdatePIN

func (fr *Repository) UpdatePIN(ctx context.Context, id string, pin *domain.PIN) (bool, error)

UpdatePIN persist the data of the updated PIN to a datastore

func (*Repository) UpdatePermissions

func (fr *Repository) UpdatePermissions(
	ctx context.Context,
	id string,
	perms []profileutils.PermissionType,
) error

UpdatePermissions update the permissions of the user profile

func (*Repository) UpdatePhotoUploadID

func (fr *Repository) UpdatePhotoUploadID(ctx context.Context, id string, uploadID string) error

UpdatePhotoUploadID updates the photoUploadID attribute of the profile that matches the id

func (*Repository) UpdatePrimaryEmailAddress

func (fr *Repository) UpdatePrimaryEmailAddress(
	ctx context.Context,
	id string,
	emailAddress string,
) error

UpdatePrimaryEmailAddress the primary email addresses of the profile that matches the id this method should be called after asserting the emailAddress is unique and not associated with another userProfile

func (*Repository) UpdatePrimaryPhoneNumber

func (fr *Repository) UpdatePrimaryPhoneNumber(
	ctx context.Context,
	id string,
	phoneNumber string,
) error

UpdatePrimaryPhoneNumber append a new primary phone number to the user profile this method should be called after asserting the phone number is unique and not associated with another userProfile

func (*Repository) UpdatePushTokens

func (fr *Repository) UpdatePushTokens(ctx context.Context, id string, pushTokens []string) error

UpdatePushTokens updates the pushTokens attribute of the profile that matches the id. This function does a hard reset instead of prior matching

func (*Repository) UpdateRole

func (fr *Repository) UpdateRole(ctx context.Context, id string, role profileutils.RoleType) error

UpdateRole update the permissions of the user profile

func (*Repository) UpdateRoleDetails

func (fr *Repository) UpdateRoleDetails(
	ctx context.Context,
	profileID string,
	role profileutils.Role,
) (*profileutils.Role, error)

UpdateRoleDetails updates the details of a role

func (*Repository) UpdateSecondaryEmailAddresses

func (fr *Repository) UpdateSecondaryEmailAddresses(
	ctx context.Context,
	id string,
	uniqueEmailAddresses []string,
) error

UpdateSecondaryEmailAddresses the secondary email addresses of the profile that matches the id this method should be called after asserting the emailAddresses as unique and not associated with another userProfile

func (*Repository) UpdateSecondaryPhoneNumbers

func (fr *Repository) UpdateSecondaryPhoneNumbers(
	ctx context.Context,
	id string,
	phoneNumbers []string,
) error

UpdateSecondaryPhoneNumbers updates the secondary phone numbers of the profile that matches the id this method should be called after asserting the phone numbers are unique and not associated with another userProfile

func (*Repository) UpdateSessionLevel

func (fr *Repository) UpdateSessionLevel(
	ctx context.Context,
	sessionID string,
	level int,
) (*domain.USSDLeadDetails, error)

UpdateSessionLevel updates user interaction level whike they interact with USSD

func (*Repository) UpdateSessionPIN

func (fr *Repository) UpdateSessionPIN(
	ctx context.Context,
	sessionID string,
	pin string,
) (*domain.USSDLeadDetails, error)

UpdateSessionPIN updates current user's session PIN when signing up or changing PIN

func (*Repository) UpdateSupplierProfile

func (fr *Repository) UpdateSupplierProfile(
	ctx context.Context,
	profileID string,
	data *profileutils.Supplier,
) error

UpdateSupplierProfile does a generic update of supplier profile.

func (*Repository) UpdateSuspended

func (fr *Repository) UpdateSuspended(ctx context.Context, id string, status bool) error

UpdateSuspended updates the suspend attribute of the profile that matches the id

func (*Repository) UpdateUserName

func (fr *Repository) UpdateUserName(ctx context.Context, id string, userName string) error

UpdateUserName updates the username of a profile that matches the id this method should be called after asserting the username is unique and not associated with another userProfile

func (*Repository) UpdateUserProfileEmail added in v0.0.2

func (fr *Repository) UpdateUserProfileEmail(
	ctx context.Context,
	phone string,
	email string,
) error

UpdateUserProfileEmail updates user profile's email

func (Repository) UpdateUserRoleIDs added in v0.0.2

func (fr Repository) UpdateUserRoleIDs(ctx context.Context, id string, roleIDs []string) error

UpdateUserRoleIDs updates the roles for a user

func (*Repository) UpdateVerifiedIdentifiers

func (fr *Repository) UpdateVerifiedIdentifiers(
	ctx context.Context,
	id string,
	identifiers []profileutils.VerifiedIdentifier,
) error

UpdateVerifiedIdentifiers adds a UID to a user profile during login if it does not exist

func (*Repository) UpdateVerifiedUIDS

func (fr *Repository) UpdateVerifiedUIDS(ctx context.Context, id string, uids []string) error

UpdateVerifiedUIDS adds a UID to a user profile during login if it does not exist

type UpdateCommand

type UpdateCommand struct {
	CollectionName string
	Data           interface{}
	ID             string
}

UpdateCommand represent payload required to perform an update operaion in the database

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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