resolvers

package
v0.0.0-...-6ba5f52 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2025 License: Apache-2.0 Imports: 50 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

ModelPlanRecentEditTables is a list of tables that are used to determine the most recent edits to a model plan.

View Source
var ModelPlanRecentEditsExcludedFields = []string{"previous_suggested_phase"}

ModelPlanRecentEditsExcludedFields is a list of fields that are excluded from the recent edits query for model plans.

Functions

func Analytics

func Analytics(ctx context.Context, store *storage.Store, logger *zap.Logger) (*models.AnalyticsSummary, error)

Analytics is the resolver for the analytics query. It returns the changes per model, changes per model by section, changes per model other data, models by status, number of followers per model, total number of models, and number of models over time.

func AnalyzeModelPlanForAnalyzedAudit

func AnalyzeModelPlanForAnalyzedAudit(
	ctx context.Context,
	store *storage.Store,
	logger *zap.Logger,
	dayToAnalyze time.Time,
	modelPlanID uuid.UUID,
) (*models.AnalyzedAudit, error)

AnalyzeModelPlanForAnalyzedAudit analyzes a model plan based on a specific day. it analyzes all desired sections and stores the result to the database

func AnalyzedAuditGetByModelPlanIDsAndDate

func AnalyzedAuditGetByModelPlanIDsAndDate(
	_ context.Context,
	store *storage.Store,
	logger *zap.Logger,

	modelPlanIDs []uuid.UUID,
	date time.Time,
) ([]*models.AnalyzedAudit, error)

AnalyzedAuditGetByModelPlanIDsAndDate returns all AnalyzedAudits for a specific date and collection of model plan ids. When possible, the data loader version of this script should be favored.

func ApplyChanges

func ApplyChanges(changes map[string]interface{}, to interface{}) error

ApplyChanges applies arbitrary changes from a map to a struct Code largely copied from GQLGen's docs on changesets https://gqlgen.com/reference/changesets/

func AuditChangeCollectionByIDAndTable

func AuditChangeCollectionByIDAndTable(logger *zap.Logger, tableName models.TableName, primaryKey uuid.UUID, store *storage.Store) ([]*models.AuditChange, error)

AuditChangeCollectionByIDAndTable returns changes based on tablename and primary key

func BaseStructPreCreate

func BaseStructPreCreate(logger *zap.Logger, bs models.IBaseStruct, principal authentication.Principal, store *storage.Store, checkAccess bool) error

BaseStructPreCreate is called before an object is created to make sure the user has permissions to do so

func BaseStructPreDelete

func BaseStructPreDelete(logger *zap.Logger, bs models.IBaseStruct, principal authentication.Principal, store *storage.Store, checkAccess bool) error

BaseStructPreDelete is called before an object is deleted to make sure the user has permissions to do so

func BaseStructPreUpdate

func BaseStructPreUpdate(logger *zap.Logger, bs models.IBaseStruct, changes map[string]interface{}, principal authentication.Principal, store *storage.Store, applyChanges bool, checkAccess bool) error

BaseStructPreUpdate applies incoming changes from to a TaskList Section, and validates it's status It modifies the base struct object bs that is passed to it.

func BaseTaskListSectionPreUpdate

func BaseTaskListSectionPreUpdate(logger *zap.Logger, tls models.IBaseTaskListSection, changes map[string]interface{}, principal authentication.Principal, store *storage.Store) error

BaseTaskListSectionPreUpdate applies incoming changes from to a TaskList Section, and validates it's status

func ConstructPhaseSuggestionEmailTemplates

func ConstructPhaseSuggestionEmailTemplates(
	logger *zap.Logger,
	emailService oddmail.EmailService,
	emailTemplateService email.TemplateService,
	modelPlan *models.ModelPlan,
	phaseSuggestion *models.PhaseSuggestion,
) (emailSubject string, emailBody string, err error)

func CreateDiscussionReply

func CreateDiscussionReply(
	ctx context.Context,
	logger *zap.Logger,
	emailService oddmail.EmailService,
	emailTemplateService email.TemplateService,
	addressBook email.AddressBook,
	input *model.DiscussionReplyCreateInput,
	principal authentication.Principal,
	store *storage.Store,
	getAccountInformation userhelpers.GetAccountInfoFunc,
) (*models.DiscussionReply, error)

CreateDiscussionReply implements resolver logic to create a Discussion reply object

func CreateMTOCommonSolutionContactMailbox

func CreateMTOCommonSolutionContactMailbox(ctx context.Context, logger *zap.Logger, principal authentication.Principal, store *storage.Store,
	emailService oddmail.EmailService, emailTemplateService email.TemplateService, addressBook email.AddressBook,
	key models.MTOCommonSolutionKey,
	mailboxTitle *string,
	mailboxAddress string,
	isTeam bool,
	role *string,
	receiveEmails bool,
	isPrimary bool,
) (*models.MTOCommonSolutionContact, error)

CreateMTOCommonSolutionContactMailbox creates a new team mailbox contact for a common solution. It inserts a new contact record with the provided mailbox title and address, not linked to a user account.

func CreateMTOCommonSolutionContactUser

func CreateMTOCommonSolutionContactUser(ctx context.Context, logger *zap.Logger, principal authentication.Principal, store *storage.Store,
	emailService oddmail.EmailService, emailTemplateService email.TemplateService, addressBook email.AddressBook,
	key models.MTOCommonSolutionKey,
	userName string,
	isTeam bool,
	role *string,
	receiveEmails bool,
	isPrimary bool,
	getAccountInformation userhelpers.GetAccountInfoFunc,
) (*models.MTOCommonSolutionContact, error)

CreateMTOCommonSolutionContactUser creates a new user contact for a common solution. It looks up the user account by username and inserts a new contact record associated with that user.

func CreateMTOCommonSolutionContractor

func CreateMTOCommonSolutionContractor(ctx context.Context, logger *zap.Logger, principal authentication.Principal, store *storage.Store,
	emailService oddmail.EmailService, emailTemplateService email.TemplateService, addressBook email.AddressBook,
	key models.MTOCommonSolutionKey,
	contractTitle *string,
	contractorName string,
) (*models.MTOCommonSolutionContractor, error)

CreateMTOCommonSolutionContractor creates a new contractor for a common solution. Accepts the solution key, optional contractor title, and contractor name. Returns the created contractor or an error.

func CreateMTOCommonSolutionSystemOwner

func CreateMTOCommonSolutionSystemOwner(ctx context.Context, logger *zap.Logger, principal authentication.Principal, store *storage.Store,
	emailService oddmail.EmailService, emailTemplateService email.TemplateService, addressBook email.AddressBook,
	key models.MTOCommonSolutionKey,
	changes map[string]interface{},
) (*models.MTOCommonSolutionSystemOwner, error)

CreateMTOCommonSolutionSystemOwner creates a new systemOwner for a common solution. Accepts the solution key, system owner type, and cmsComponent. Returns the created system owner or an error.

func CreatePlanDiscussion

func CreatePlanDiscussion(
	ctx context.Context,
	logger *zap.Logger,
	emailService oddmail.EmailService,
	emailTemplateService email.TemplateService,
	addressBook email.AddressBook,
	input *model.PlanDiscussionCreateInput,
	principal authentication.Principal,
	store *storage.Store,
	getAccountInformation userhelpers.GetAccountInfoFunc,
) (*models.PlanDiscussion, error)

CreatePlanDiscussion implements resolver logic to create a plan Discussion object. It will also save any Mentions to the tag table

func CurrentUserAccountGet

func CurrentUserAccountGet(ctx context.Context) (*authentication.UserAccount, error)

CurrentUserAccountGet Gets the account of the current user in the database

func CurrentUserLaunchDarklySettingsGet

func CurrentUserLaunchDarklySettingsGet(ctx context.Context, ldClient *ldclient.LDClient) (*model.LaunchDarklySettings, error)

CurrentUserLaunchDarklySettingsGet returns the launch darkly settings for the current user

func CurrentUserNotificationsGet

func CurrentUserNotificationsGet(ctx context.Context, np sqlutils.NamedPreparer) (*models.UserNotifications, error)

CurrentUserNotificationsGet returns the notifications for the Current User

func DailyDigestNotificationSend

func DailyDigestNotificationSend(
	ctx context.Context,
	np sqlutils.NamedPreparer,
	logger *zap.Logger,

	dateAnalyzed time.Time,
	userID uuid.UUID,
	emailService oddmail.EmailService,
	emailTemplateService email.TemplateService,
	addressBook email.AddressBook,

) error

DailyDigestNotificationSend sends a single email for a user for a given day based on their favorited models It will also call the notification package for Daily Digest Complete Activity

func DeleteDiscussionReply

func DeleteDiscussionReply(logger *zap.Logger, id uuid.UUID, principal authentication.Principal, store *storage.Store) (*models.DiscussionReply, error)

DeleteDiscussionReply implements resolver logic to Delete a Discussion reply object Deprecated: THIS IS NOT USED by the front end. If it is ever used, make sure to handle tags

func DeleteMTOCommonSolutionContact

func DeleteMTOCommonSolutionContact(ctx context.Context, logger *zap.Logger, principal authentication.Principal, store *storage.Store,
	emailService oddmail.EmailService, emailTemplateService email.TemplateService, addressBook email.AddressBook,
	id uuid.UUID,
) (*models.MTOCommonSolutionContact, error)

DeleteMTOCommonSolutionContact deletes a contact for a common solution by its ID. Returns the deleted contact or an error.

func DeleteMTOCommonSolutionContractor

func DeleteMTOCommonSolutionContractor(ctx context.Context, logger *zap.Logger, principal authentication.Principal, store *storage.Store,
	emailService oddmail.EmailService, emailTemplateService email.TemplateService, addressBook email.AddressBook,
	id uuid.UUID,
) (*models.MTOCommonSolutionContractor, error)

DeleteMTOCommonSolutionContractor deletes a contractor for a common solution by its ID. Returns the deleted contractor or an error.

func DeleteMTOCommonSolutionSystemOwner

func DeleteMTOCommonSolutionSystemOwner(ctx context.Context, logger *zap.Logger, principal authentication.Principal, store *storage.Store,
	emailService oddmail.EmailService, emailTemplateService email.TemplateService, addressBook email.AddressBook,
	id uuid.UUID,
) (*models.MTOCommonSolutionSystemOwner, error)

DeleteMTOCommonSolutionSystemOwner deletes a system owner for a common solution by its ID. Returns the deleted system owner or an error.

func DeletePlanDiscussion

func DeletePlanDiscussion(logger *zap.Logger, id uuid.UUID, principal authentication.Principal, store *storage.Store) (*models.PlanDiscussion, error)

DeletePlanDiscussion implements resolver logic to Delete a plan Discussion object Deprecated: THIS IS NOT USED by the front end. If it is ever used, make sure to handle tags

func DiscussionReplyCollectionByDiscusionIDLOADER

func DiscussionReplyCollectionByDiscusionIDLOADER(ctx context.Context, discussionID uuid.UUID) ([]*models.DiscussionReply, error)

DiscussionReplyCollectionByDiscusionIDLOADER implements resolver logic to get Discussion Reply by a model plan ID using a data loader

func DiscussionReplyGetByID

func DiscussionReplyGetByID(_ context.Context, store *storage.Store, logger *zap.Logger, discussionReplyID uuid.UUID) (*models.DiscussionReply, error)

DiscussionReplyGetByID returns a single discussion reply from the database for a given discussionReplyID

func EvaluateSuggestedStatus

func EvaluateSuggestedStatus(modelStatus models.ModelStatus, planTimeline *models.PlanTimeline) (*models.PhaseSuggestion, error)

EvaluateSuggestedStatus evaluates the suggested status for a model plan based on its current status and planTimeline A nil result indicates that no phase is suggested

func ExistingModelCollectionGet

func ExistingModelCollectionGet(logger *zap.Logger, store *storage.Store) ([]*models.ExistingModel, error)

ExistingModelCollectionGet returns all existing models

func ExistingModelGetByIDLOADER

func ExistingModelGetByIDLOADER(ctx context.Context, id int) (*models.ExistingModel, error)

ExistingModelGetByIDLOADER implements resolver logic to get Existing Model by a model plan ID using a data loader

func ExistingModelLinkGetByID

func ExistingModelLinkGetByID(logger *zap.Logger, store *storage.Store, principal authentication.Principal, id uuid.UUID) (*models.ExistingModelLink, error)

ExistingModelLinkGetByID returns an existing model link by its id

func ExistingModelLinkGetByModelPlanIDAndFieldNameLOADER

func ExistingModelLinkGetByModelPlanIDAndFieldNameLOADER(ctx context.Context, modelPlanID uuid.UUID, fieldName models.ExisitingModelLinkFieldType) ([]*models.ExistingModelLink, error)

ExistingModelLinkGetByModelPlanIDAndFieldNameLOADER implements resolver logic to get Existing Model Link by a model plan ID using a data loader

func ExistingModelLinkGetModel

func ExistingModelLinkGetModel(ctx context.Context, link *models.ExistingModelLink) (models.LinkedExistingModel, error)

ExistingModelLinkGetModel conditionally returns either an ExistingModel, or a ModelPlan that is connected in an existing model link

func ExistingModelLinksGetByModelPlanIDAndFieldNameLOADER

func ExistingModelLinksGetByModelPlanIDAndFieldNameLOADER(ctx context.Context, modelPlanID uuid.UUID, fieldName models.ExisitingModelLinkFieldType) (*models.ExistingModelLinks, error)

ExistingModelLinksGetByModelPlanIDAndFieldNameLOADER implements resolver logic to get Existing Model Link by a model plan ID using a data loader

func ExistingModelLinksNameArray

func ExistingModelLinksNameArray(ctx context.Context, modelPlanID uuid.UUID, fieldName models.ExisitingModelLinkFieldType) ([]string, error)

func ExistingModelLinksUpdate

func ExistingModelLinksUpdate(logger *zap.Logger, store *storage.Store, principal authentication.Principal, modelPlanID uuid.UUID, fieldName models.ExisitingModelLinkFieldType, existingModelIDs []int, currentModelPlanIDs []uuid.UUID) (*models.ExistingModelLinks, error)

ExistingModelLinksUpdate creates or deletes existing model links based on the list provided.

func GetCollaboratorUUIDsForModelStatusAlert

func GetCollaboratorUUIDsForModelStatusAlert(
	ctx context.Context,
	logger *zap.Logger,
	store *storage.Store,
	modelPlanID uuid.UUID,
) ([]uuid.UUID, error)

GetCollaboratorUUIDsForModelStatusAlert returns the UUIDs of all collaborators for a given model plan

func GetEchimpCRAndTdlsByModelPlanID

func GetEchimpCRAndTdlsByModelPlanID(echimpS3Client *s3.S3Client, viperConfig *viper.Viper, logger *zap.Logger, modelPlanID uuid.UUID) ([]models.EChimpCRAndTDLS, error)

GetEchimpCRAndTdlsByModelPlanID returns a union of EChimp CR and TDLs from the cache for a given model plan

func GetEmailsForModelStatusAlert

func GetEmailsForModelStatusAlert(
	ctx context.Context,
	logger *zap.Logger,
	store *storage.Store,
	modelPlanID uuid.UUID,
) ([]string, error)

GetEmailsForModelStatusAlert returns the email addresses of the model leads and collaborators with notifications on for a given model plan

func GetLeadModelPlanCount

func GetLeadModelPlanCount(ctx context.Context, store *storage.Store,
	userID uuid.UUID,
) (int, error)

GetLeadModelPlanCount returns the number of model plans where the specified user is a lead.

func GetLockableSectionLocks

func GetLockableSectionLocks(modelPlanID uuid.UUID) ([]*model.LockableSectionLockStatus, error)

GetLockableSectionLocks is a convenience relay method to call the corresponding method on a resolver implementation

func GetMTOCommonSolutionContact

func GetMTOCommonSolutionContact(ctx context.Context, logger *zap.Logger, principal authentication.Principal, store *storage.Store,
	id uuid.UUID,
) (*models.MTOCommonSolutionContact, error)

GetMTOCommonSolutionContact retrieves a contact for a common solution by its ID. Returns the contact if found, or an error if not found or on failure.

func GetMTOCommonSolutionContractor

func GetMTOCommonSolutionContractor(ctx context.Context, logger *zap.Logger, principal authentication.Principal, store *storage.Store,
	id uuid.UUID,
) (*models.MTOCommonSolutionContractor, error)

GetMTOCommonSolutionContractor retrieves a contractor for a common solution by its ID. Returns the contractor if found, or an error if not found or on failure.

func GetMTOCommonSolutionSystemOwner

func GetMTOCommonSolutionSystemOwner(ctx context.Context, logger *zap.Logger, principal authentication.Principal, store *storage.Store,
	id uuid.UUID,
) (*models.MTOCommonSolutionSystemOwner, error)

GetMTOCommonSolutionSystemOwner retrieves a system owner for a common solution by its ID. Returns the system owner if found, or an error if not found or on failure.

func GetMostRecentDiscussionRoleSelection

func GetMostRecentDiscussionRoleSelection(
	logger *zap.Logger,
	store *storage.Store,
	principal authentication.Principal,
) (*models.DiscussionRoleSelection, error)

GetMostRecentDiscussionRoleSelection implements resolver logic to get the most recent user role selection

func IsPlanCollaborator

func IsPlanCollaborator(logger *zap.Logger, principal authentication.Principal, store *storage.Store, modelPlanID uuid.UUID) (bool, error)

IsPlanCollaborator checks if a user is a collaborator on model plan is a favorite.

func IsPlanFavorited

func IsPlanFavorited(logger *zap.Logger, principal authentication.Principal, store *storage.Store, modelPlanID uuid.UUID) (bool, error)

IsPlanFavorited checks if a model plan is a favorite.

func LockLockableSection

func LockLockableSection(ps pubsub.PubSub, modelPlanID uuid.UUID, section models.LockableSection, principal authentication.Principal) (bool, error)

LockLockableSection is a convenience relay method to call the corresponding method on a resolver implementation

func MTOCategoriesGetByID

func MTOCategoriesGetByID(ctx context.Context, id *uuid.UUID, modelPlanID uuid.UUID) (*models.MTOCategories, error)

MTOCategoriesGetByID returns the subcategory and parent category information given an mto category id This function first fetches the category by the provided ID. Then, if that category is a parent category (and we have nothing else to fetch), returns that category. However, if the supplied ID points to a subcategory (i.e. it has a parent ID), then it also fetches the parent category information so both category AND subcategory are returned as part of this resolver. We are not doing a larger SQL call that would return both objects, as that would result in less maintainable code

func MTOCategoryAndSubcategoriesGetByModelPlanIDLOADER

func MTOCategoryAndSubcategoriesGetByModelPlanIDLOADER(ctx context.Context, modelPlanID uuid.UUID) ([]*models.MTOCategory, error)

MTOCategoryAndSubcategoriesGetByModelPlanIDLOADER implements resolver logic to get all MTO Categories (including subcategories) by a model plan ID using a data loader This is largely useful for testing instead of for app code, as the categories are all returned at the top level. It does not include uncategorized records, as it contextually doesn't make sense.

func MTOCategoryCreate

func MTOCategoryCreate(ctx context.Context, logger *zap.Logger, principal authentication.Principal, store *storage.Store,
	name string,
	modelPlanID uuid.UUID,
	parentID *uuid.UUID,
) (*models.MTOCategory, error)

MTOCategoryCreate uses the provided information to create a new mto category

func MTOCategoryDelete

func MTOCategoryDelete(logger *zap.Logger, principal authentication.Principal, store *storage.Store, id uuid.UUID) error

MTOCategoryDelete removes an MTOCategory or SubCategory

func MTOCategoryGetByID

func MTOCategoryGetByID(ctx context.Context, id uuid.UUID) (*models.MTOCategory, error)

func MTOCategoryGetByModelPlanIDLOADER

func MTOCategoryGetByModelPlanIDLOADER(ctx context.Context, modelPlanID uuid.UUID) ([]*models.MTOCategory, error)

func MTOCategoryRename

func MTOCategoryRename(ctx context.Context, logger *zap.Logger, principal authentication.Principal, store *storage.Store,
	id uuid.UUID,
	name string,
) (*models.MTOCategory, error)

MTOCategoryRename updates the name of MTOCategory or SubCategory

func MTOCategoryReorder

func MTOCategoryReorder(ctx context.Context, logger *zap.Logger, principal authentication.Principal, store *storage.Store,
	id uuid.UUID,
	order *int,
	parentID *uuid.UUID,
) (*models.MTOCategory, error)

MTOCategoryReorder updates the position of an MTOCategory or SubCategory

func MTOCommonMilestoneGetByKeyLOADER

func MTOCommonMilestoneGetByKeyLOADER(ctx context.Context, key models.MTOCommonMilestoneKey) (*models.MTOCommonMilestone, error)

MTOCommonMilestoneGetByKeyLOADER returns a common milestone by it's key. Currently, it doesn't provide any contextual data.

func MTOCommonMilestoneGetByModelPlanIDLOADER

func MTOCommonMilestoneGetByModelPlanIDLOADER(ctx context.Context, modelPlanID *uuid.UUID) ([]*models.MTOCommonMilestone, error)

MTOCommonMilestoneGetByModelPlanIDLOADER implements resolver logic to get all MTO common milestones by a model plan ID using a data loader The modelPlanID is optional. It is used to provide meta data about the CommonMilestone in relation to a model plan (was it added or recommended?)

func MTOCommonSolutionContactInformationGetByKeyLOADER

func MTOCommonSolutionContactInformationGetByKeyLOADER(ctx context.Context, key models.MTOCommonSolutionKey) (*models.MTOCommonSolutionContactInformation, error)

MTOCommonSolutionContactInformationGetByKeyLOADER returns an MTOCommonSolutionContactInformation by its key. This function loads all points of contact for a given common solution key. It does not provide contextual data.

func MTOCommonSolutionContractorsGetByKeyLOADER

func MTOCommonSolutionContractorsGetByKeyLOADER(ctx context.Context, key models.MTOCommonSolutionKey) ([]*models.MTOCommonSolutionContractor, error)

MTOCommonSolutionContractorsGetByKeyLOADER loads all contractors for a given MTOCommonSolutionKey using the dataloader. Returns a slice of contractors or an error.

func MTOCommonSolutionGetByCommonMilestoneKeyLOADER

func MTOCommonSolutionGetByCommonMilestoneKeyLOADER(ctx context.Context, key models.MTOCommonMilestoneKey) ([]*models.MTOCommonSolution, error)

MTOCommonSolutionGetByCommonMilestoneKeyLOADER returns all common Solutions associated with a common Milestone by it's key. Currently, it doesn't provide any contextual data.

func MTOCommonSolutionGetByIDLoader

func MTOCommonSolutionGetByIDLoader(ctx context.Context, id *uuid.UUID) (*models.MTOCommonSolution, error)

MTOCommonSolutionGetByID returns an MTO common solution according to it's id

func MTOCommonSolutionGetByKeyLOADER

func MTOCommonSolutionGetByKeyLOADER(ctx context.Context, key models.MTOCommonSolutionKey) (*models.MTOCommonSolution, error)

MTOCommonSolutionGetByKeyLOADER returns a common Solution by it's key. Currently, it doesn't provide any contextual data.

func MTOCommonSolutionGetByModelPlanIDLOADER

func MTOCommonSolutionGetByModelPlanIDLOADER(ctx context.Context, modelPlanID *uuid.UUID) ([]*models.MTOCommonSolution, error)

MTOCommonSolutionGetByModelPlanIDLOADER implements resolver logic to get all MTO common Solutions by a model plan ID using a data loader The modelPlanID is optional. It is used to provide meta data about the CommonSolution in relation to a model plan (was it added or recommended?)

func MTOCommonSolutionSystemOwnersGetByKeyLOADER

func MTOCommonSolutionSystemOwnersGetByKeyLOADER(ctx context.Context, key models.MTOCommonSolutionKey) ([]*models.MTOCommonSolutionSystemOwner, error)

MTOCommonSolutionSystemOwnersGetByKeyLOADER loads the system owner for a given MTOCommonSolutionKey using the dataloader. Returns a system owner or an error.

func MTOCreateStandardCategories

func MTOCreateStandardCategories(ctx context.Context, logger *zap.Logger, principal authentication.Principal, store *storage.Store, modelPlanID uuid.UUID) (bool, error)

MTOCreateStandardCategories attempts to create a bunch of categories (some with subcategories) that represent a "standard" set of categories that might be useful / expected in a standard MTO

TODO Refactor to do a bulk insert instead of having to loop over the standard categories struct and repeatedly call storage methods in a `tx“

func MTOInfoGetByModelPlanIDLOADER

func MTOInfoGetByModelPlanIDLOADER(ctx context.Context, modelPlanID uuid.UUID) (*models.MTOInfo, error)

MTOInfoGetByModelPlanIDLOADER implements resolver logic to get all mto info records for an modelPlanID (which is the same as the id in this case)

func MTOLastUpdatedGet

func MTOLastUpdatedGet(ctx context.Context, modelPlanID uuid.UUID) (*models.RecentModification, error)

MTOLastUpdatedGet returns the most recent update to an MTO overall.

func MTOMilestoneCreateCommon

func MTOMilestoneCreateCommon(ctx context.Context, logger *zap.Logger, principal authentication.Principal, store *storage.Store,
	emailService oddmail.EmailService,
	emailTemplateService email.TemplateService,
	addressBook email.AddressBook,
	modelPlanID uuid.UUID,
	commonMilestoneKey models.MTOCommonMilestoneKey,
	commonSolutions []models.MTOCommonSolutionKey,
) (*models.MTOMilestone, error)

MTOMilestoneCreateCommon uses the provided information to create a new Custom MTO Milestone

func MTOMilestoneCreateCustom

func MTOMilestoneCreateCustom(ctx context.Context, logger *zap.Logger, principal authentication.Principal, store *storage.Store,
	name string,
	modelPlanID uuid.UUID,
	mtoCategoryID *uuid.UUID,
) (*models.MTOMilestone, error)

MTOMilestoneCreateCustom uses the provided information to create a new Custom MTO Milestone

func MTOMilestoneDelete

func MTOMilestoneDelete(ctx context.Context, logger *zap.Logger, principal authentication.Principal, store *storage.Store, id uuid.UUID) error

MTOMilestoneDelete deletes an MTOMilestone It returns an error if the principal is invalid, the milestone doesn't exist, user doesn't have permissions to delete, or the delete call itself fails Future Enhancement - Consider returning a *models.MTOMilestone here if we want to ever access the returned data on what was deleted

func MTOMilestoneGetByIDLOADER

func MTOMilestoneGetByIDLOADER(ctx context.Context, id uuid.UUID) (*models.MTOMilestone, error)

MTOMilestoneGetByIDLOADER returns a mto milestone by it's provided ID

func MTOMilestoneGetByModelPlanIDAndCategoryIDLOADER

func MTOMilestoneGetByModelPlanIDAndCategoryIDLOADER(ctx context.Context, modelPlanID uuid.UUID, mtoCategoryID uuid.UUID) ([]*models.MTOMilestone, error)

MTOMilestoneGetByModelPlanIDAndCategoryIDLOADER implements resolver logic to get all MTO milestones by a model plan ID and MTO category ID using a data loader

func MTOMilestoneGetByModelPlanIDLOADER

func MTOMilestoneGetByModelPlanIDLOADER(ctx context.Context, modelPlanID uuid.UUID) ([]*models.MTOMilestone, error)

MTOMilestoneGetByModelPlanIDLOADER implements resolver logic to get all MTO milestones by a model plan ID using a data loader

func MTOMilestoneGetByModelPlanIDNoLinkedSolutionLoader

func MTOMilestoneGetByModelPlanIDNoLinkedSolutionLoader(
	ctx context.Context,
	modelPlanID uuid.UUID,
) ([]*models.MTOMilestone, error)

MTOMilestoneGetByModelPlanIDNoLinkedSolutionLoader returns all milestones by a model plan ID that are not linked to a solution

func MTOMilestoneGetBySolutionIDLOADER

func MTOMilestoneGetBySolutionIDLOADER(
	ctx context.Context,
	solutionID uuid.UUID,
) ([]*models.MTOMilestone, error)

func MTOMilestoneUpdate

func MTOMilestoneUpdate(
	ctx context.Context,
	logger *zap.Logger,
	principal authentication.Principal,
	store *storage.Store,
	emailService oddmail.EmailService,
	emailTemplateService email.TemplateService,
	addressBook email.AddressBook,
	id uuid.UUID,
	changes map[string]interface{},
	solutionLinks *model.MTOSolutionLinks,
) (*models.MTOMilestone, error)

MTOMilestoneUpdate updates the fields of an MTOMilestone

func MTOMilestoneUpdateLinkedSolutions

func MTOMilestoneUpdateLinkedSolutions(
	ctx context.Context,
	principal authentication.Principal,
	logger *zap.Logger,
	store *storage.Store,
	emailService oddmail.EmailService,
	emailTemplateService email.TemplateService,
	addressBook email.AddressBook,
	id uuid.UUID,
	solutionIDs []uuid.UUID,
	commonSolutionKeys []models.MTOCommonSolutionKey,
) ([]*models.MTOSolution, error)

MTOMilestoneUpdateLinkedSolutions is a convenience wrapper around MTOMilestoneUpdateLinkedSolutionsWithTX it initiates the transaction, then calls MTOMilestoneUpdateLinkedSolutionsWithTX

func MTOMilestoneUpdateLinkedSolutionsWithTX

func MTOMilestoneUpdateLinkedSolutionsWithTX(
	ctx context.Context,
	principal authentication.Principal,
	logger *zap.Logger,
	tx *sqlx.Tx,

	store *storage.Store,
	emailService oddmail.EmailService,
	emailTemplateService email.TemplateService,
	addressBook email.AddressBook,
	milestoneID uuid.UUID,
	modelPlanID uuid.UUID,
	solutionIDs []uuid.UUID,
	commonSolutionKeys []models.MTOCommonSolutionKey,
) ([]*models.MTOSolution, error)

MTOMilestoneUpdateLinkedSolutionsWithTX updates the linked solutions for a milestone, deleting ones that are not included in the list

func MTOMostRecentTranslatedAudit

func MTOMostRecentTranslatedAudit(ctx context.Context, store *storage.Store, logger *zap.Logger, principal authentication.Principal, modelPlanID uuid.UUID) (*models.TranslatedAudit, error)

MTOMostRecentTranslatedAudit returns the most recent translated audit for an MTO overall. It specifically excludes

func MTOSolutionCreateCommon

func MTOSolutionCreateCommon(
	ctx context.Context,
	logger *zap.Logger,
	principal authentication.Principal,
	store *storage.Store,
	emailService oddmail.EmailService,
	emailTemplateService email.TemplateService,
	addressBook email.AddressBook,
	modelPlanID uuid.UUID,
	commonSolutionKey models.MTOCommonSolutionKey,
	milestonesToLink []uuid.UUID,
) (*models.MTOSolution, error)

func MTOSolutionCreateCustom

func MTOSolutionCreateCustom(
	logger *zap.Logger,
	principal authentication.Principal,
	store *storage.Store,
	modelPlanID uuid.UUID,
	commonSolutionKey *models.MTOCommonSolutionKey,
	name string,
	solutionType models.MTOSolutionType,
	neededBy *time.Time,
	pocName *string,
	pocEmail *string,
) (*models.MTOSolution, error)

MTOSolutionCreateCustom uses the provided information to create a new MTOSolution

func MTOSolutionDelete

func MTOSolutionDelete(ctx context.Context, logger *zap.Logger, principal authentication.Principal, store *storage.Store, id uuid.UUID) error

MTOSolutionDelete deletes an MTOSolution It returns an error if the principal is invalid, the solution doesn't exist, user doesn't have permissions to delete, or the delete call itself fails Future Enhancement - Consider returning a *models.MTOSolution here if we want to ever access the returned data on what was deleted

func MTOSolutionGetByIDLOADER

func MTOSolutionGetByIDLOADER(
	ctx context.Context,
	id uuid.UUID,
) (*models.MTOSolution, error)

func MTOSolutionGetByMilestoneIDLOADER

func MTOSolutionGetByMilestoneIDLOADER(
	ctx context.Context,
	milestoneID uuid.UUID,
) ([]*models.MTOSolution, error)

func MTOSolutionGetByModelPlanIDLOADER

func MTOSolutionGetByModelPlanIDLOADER(
	ctx context.Context,
	modelPlanID uuid.UUID,
) ([]*models.MTOSolution, error)

MTOSolutionGetByModelPlanIDLOADER implements resolver logic to get all MTO solutions by a model plan ID using a data loader

func MTOSolutionLinkMilestonesWithTX

func MTOSolutionLinkMilestonesWithTX(
	ctx context.Context,
	principal authentication.Principal,
	logger *zap.Logger,
	tx *sqlx.Tx,
	solutionID uuid.UUID,
	milestonesToLink []uuid.UUID,
) ([]*models.MTOMilestone, error)

MTOSolutionLinkMilestonesWithTX handles linking milestones to a solution in a single transaction

func MTOSolutionUpdate

func MTOSolutionUpdate(
	ctx context.Context,
	logger *zap.Logger,
	principal authentication.Principal,
	store *storage.Store,
	id uuid.UUID,
	changes map[string]interface{},
	milestoneLinks *model.MTOMilestoneLinks,
) (*models.MTOSolution, error)

MTOSolutionUpdate updates the MTOSolution

func MTOSolutionsGetByModelPlanIDAndFilterView

func MTOSolutionsGetByModelPlanIDAndFilterView(ctx context.Context,
	milestoneID uuid.UUID,
	filterView models.ModelViewFilter) ([]*models.MTOSolution, error)

MTOSolutionsGetByModelPlanIDAndFilterView implements resolver logic to get all MTO solutions by a model plan ID and filter view

func MTOSolutionsGetByModelPlanIDAndOptionalFilterView

func MTOSolutionsGetByModelPlanIDAndOptionalFilterView(ctx context.Context,
	milestoneID uuid.UUID,
	filterView *models.ModelViewFilter,
) ([]*models.MTOSolution, error)

MTOSolutionsGetByModelPlanIDAndOptionalFilterView is a wrapper function that checks if the filterView is nil and calls the appropriate function to get MTO solutions by model plan ID.

func MTOStatusGet

func MTOStatusGet(ctx context.Context, store *storage.Store, logger *zap.Logger, principal authentication.Principal, modelPlanID uuid.UUID) (models.MTOStatus, error)

MTOStatusGet returns the overall status of an MTO

func MTOSubcategoryGetByParentIDLoader

func MTOSubcategoryGetByParentIDLoader(ctx context.Context, modelPlanID uuid.UUID, parentID uuid.UUID) ([]*models.MTOSubcategory, error)

func MTOToggleReadyForReview

func MTOToggleReadyForReview(ctx context.Context, logger *zap.Logger, principal authentication.Principal, store *storage.Store, modelPlanID uuid.UUID, isReadyForReview bool) (*models.MTOInfo, error)

func MTOTranslatedAuditsGetByModelPlanID

func MTOTranslatedAuditsGetByModelPlanID(ctx context.Context, store *storage.Store, logger *zap.Logger, principal authentication.Principal, modelPlanID uuid.UUID, limit *int, offset *int) ([]*models.TranslatedAudit, error)

MTOTranslatedAuditsGetByModelPlanID returns audits related to the mto section

func ModelBySolutionStatus

func ModelBySolutionStatus(modelPlanStatus models.ModelStatus) models.ModelBySolutionStatus

ModelBySolutionStatus converts a Model status to a ModelBySolutionStatus

func ModelPlanAnticipatedPhase

func ModelPlanAnticipatedPhase(
	ctx context.Context,
	modelStatus models.ModelStatus,
	modelPlanID uuid.UUID,
) (*models.PhaseSuggestion, error)

ModelPlanAnticipatedPhase calculates a suggested phase for a model plan based on its current status and planTimeline It uses a series of status evaluation strategies to determine the suggested phase If no phase is suggested, it returns nil

func ModelPlanCollection

func ModelPlanCollection(echimpS3Client *s3.S3Client, viperConfig *viper.Viper, logger *zap.Logger, principal authentication.Principal, store *storage.Store, filter model.ModelPlanFilter) ([]*models.ModelPlan, error)

ModelPlanCollection implements resolver logic to get a list of model plans by who's a collaborator on them (TODO)

func ModelPlanCreate

func ModelPlanCreate(
	ctx context.Context,
	logger *zap.Logger,
	emailService oddmail.EmailService,
	emailTemplateService email.TemplateService,
	addressBook email.AddressBook,
	modelName string,
	id *uuid.UUID,
	store *storage.Store,
	principal authentication.Principal,
	getAccountInformation userhelpers.GetAccountInfoFunc,
) (*models.ModelPlan, error)

ModelPlanCreate implements resolver logic to create a model plan, and send relevant notifications about it's creation It also creates a record for all the task list items at the same time. It utilizes transactions to ensure that the data can be rolled back if there is an error at any point along the way.

func ModelPlanGetByID

func ModelPlanGetByID(logger *zap.Logger, id uuid.UUID, store *storage.Store) (*models.ModelPlan, error)

ModelPlanGetByID implements resolver logic to get a model plan by its ID

func ModelPlanGetByIDLOADER

func ModelPlanGetByIDLOADER(ctx context.Context, id uuid.UUID) (*models.ModelPlan, error)

ModelPlanGetByIDLOADER implements resolver logic to get Model Plan by a model plan ID using a data loader

func ModelPlanGetSampleModel

func ModelPlanGetSampleModel(logger *zap.Logger, store *storage.Store) (*models.ModelPlan, error)

ModelPlanGetSampleModel returns the sample model plan

func ModelPlanGetTaskListStatus

func ModelPlanGetTaskListStatus(
	logger *zap.Logger,
	modelPlanID uuid.UUID,
	store *storage.Store,
) (
	models.TaskStatus,
	error,
)

func ModelPlanMostRecentTranslatedAudit

func ModelPlanMostRecentTranslatedAudit(
	ctx context.Context,
	logger *zap.Logger,
	modelPlanID uuid.UUID,
) (*models.TranslatedAudit, error)

ModelPlanMostRecentTranslatedAudit returns the most recent translated audit for a given model plan id. It looks at specific tables to include in the query.

func ModelPlanNameHistory

func ModelPlanNameHistory(logger *zap.Logger, modelPlanID uuid.UUID, sortDir models.SortDirection, store *storage.Store) ([]string, error)

ModelPlanNameHistory returns a slice of AuditChanges, with the only values returned being the model_name field

func ModelPlanOpSolutionLastModifiedDtsGetByIDLOADER

func ModelPlanOpSolutionLastModifiedDtsGetByIDLOADER(ctx context.Context, id uuid.UUID) (*time.Time, error)

ModelPlanOpSolutionLastModifiedDtsGetByIDLOADER implements resolver logic to get Model Plan Operational Solution Last Modified Dts by a model plan ID using a data loader

func ModelPlanShare

func ModelPlanShare(
	ctx context.Context,
	logger *zap.Logger,
	store *storage.Store,
	principal authentication.Principal,
	emailService oddmail.EmailService,
	emailTemplateService email.TemplateService,
	addressBook email.AddressBook,
	modelPlanID uuid.UUID,
	viewFilter *models.ModelViewFilter,
	shareSection *models.ModelShareSection,
	usernames []string,
	optionalMessage *string,
	getAccountInformation userhelpers.GetAccountInfoFunc,
) (bool, error)

ModelPlanShare implements resolver logic to share a model plan with a list of emails

func ModelPlanUpdate

func ModelPlanUpdate(logger *zap.Logger, id uuid.UUID, changes map[string]interface{}, principal authentication.Principal, store *storage.Store) (*models.ModelPlan, error)

ModelPlanUpdate implements resolver logic to update a model plan

func ModelPlansByMTOSolutionKey

func ModelPlansByMTOSolutionKey(
	logger *zap.Logger,
	np sqlutils.NamedPreparer,
	solutionKey models.MTOCommonSolutionKey,
) ([]*models.ModelPlanAndMTOCommonSolution, error)

ModelPlansByMTOSolutionKey returns a list of model plans which utilize an mto common solution

func ModelPlansByOperationalSolutionKey

func ModelPlansByOperationalSolutionKey(
	logger *zap.Logger,
	store *storage.Store,
	operationalSolutionKey models.OperationalSolutionKey,
) ([]*models.ModelPlanAndPossibleOperationalSolution, error)

func ModelPlansWithEchimpCRAndTDLS

func ModelPlansWithEchimpCRAndTDLS(echimpS3Client *s3.S3Client, viperConfig *viper.Viper, logger *zap.Logger, store *storage.Store) ([]*models.ModelPlan, error)

ModelPlansWithEchimpCRAndTDLS returns all model plans that have an echimp cr or tdl associated with it

func NDAAgreementGetByUserID

func NDAAgreementGetByUserID(logger *zap.Logger, principal authentication.Principal, store *storage.Store) (*model.NDAInfo, error)

NDAAgreementGetByUserID returns an EUA agreement by eua

func NDAAgreementUpdateOrCreate

func NDAAgreementUpdateOrCreate(logger *zap.Logger, agree bool, principal authentication.Principal, store *storage.Store) (*model.NDAInfo, error)

NDAAgreementUpdateOrCreate either writes an entry to the nda table, or updates an existing one

func NewDBConfig

func NewDBConfig() storage.DBConfig

NewDBConfig returns a DBConfig struct with values from appconfig

func OnLockLockableSectionContext

func OnLockLockableSectionContext(
	ps pubsub.PubSub,
	modelPlanID uuid.UUID,
	principal authentication.Principal,
	onDisconnect <-chan struct{},
) (<-chan *model.LockableSectionLockStatusChanged, error)

OnLockLockableSectionContext maintains a webhook monitoring changes to task list sections. Once that webhook dies it will auto-unlock any section locked by that EUAID.

func OperationalNeedCollectionGetByModelPlanID

func OperationalNeedCollectionGetByModelPlanID(logger *zap.Logger, modelPlanID uuid.UUID, store *storage.Store) ([]*models.OperationalNeed, error)

OperationalNeedCollectionGetByModelPlanID returns possible and existing OperationalNeeds associated to a model plan

func OperationalNeedCollectionGetByModelPlanIDLOADER

func OperationalNeedCollectionGetByModelPlanIDLOADER(ctx context.Context, modelPlanID uuid.UUID) ([]*models.OperationalNeed, error)

OperationalNeedCollectionGetByModelPlanIDLOADER returns possible and existing OperationalNeeds associated to a model plan

func OperationalNeedCustomUpdateByID

func OperationalNeedCustomUpdateByID(logger *zap.Logger, operationNeedID uuid.UUID, customNeedType *string, needed bool, principal authentication.Principal, store *storage.Store) (*models.OperationalNeed, error)

OperationalNeedCustomUpdateByID updates an Operational Need by it's ID. Note, we don't allow updating a need type, except customNeedTypes

func OperationalNeedGetByID

func OperationalNeedGetByID(logger *zap.Logger, id uuid.UUID, store *storage.Store) (*models.OperationalNeed, error)

OperationalNeedGetByID returns an operational Need by it's ID

func OperationalNeedInsertOrUpdateCustom

func OperationalNeedInsertOrUpdateCustom(logger *zap.Logger, modelPlanID uuid.UUID, customNeedType string, needed bool, principal authentication.Principal, store *storage.Store) (*models.OperationalNeed, error)

OperationalNeedInsertOrUpdateCustom adds or updates a Custom Operational Need

func OperationalSolutionCreate

func OperationalSolutionCreate(
	ctx context.Context,
	store *storage.Store,
	logger *zap.Logger,
	emailService oddmail.EmailService,
	emailTemplateService email.TemplateService,
	addressBook email.AddressBook,
	operationNeedID uuid.UUID,
	solutionType *models.OperationalSolutionKey,
	changes map[string]interface{},
	principal authentication.Principal,
) (*models.OperationalSolution, error)

OperationalSolutionCreate calls a DB method to create an operational solution

func OperationalSolutionGetByID

func OperationalSolutionGetByID(logger *zap.Logger, id uuid.UUID, store *storage.Store) (*models.OperationalSolution, error)

OperationalSolutionGetByID returns an operational Solution by it's ID

func OperationalSolutionGetByIDLOADER

func OperationalSolutionGetByIDLOADER(ctx context.Context, id uuid.UUID) (*models.OperationalSolution, error)

OperationalSolutionGetByIDLOADER implements resolver logic to get an Operational Solution by ID using a data loader

func OperationalSolutionSubtaskDelete

func OperationalSolutionSubtaskDelete(
	logger *zap.Logger,
	store *storage.Store,
	principal authentication.Principal,
	id uuid.UUID,
) (int, error)

OperationalSolutionSubtaskDelete implements resolver logic to delete an operational solution subtask

func OperationalSolutionSubtaskGetByID

func OperationalSolutionSubtaskGetByID(
	logger *zap.Logger,
	store *storage.Store,
	subtaskID uuid.UUID,
) (*models.OperationalSolutionSubtask, error)

OperationalSolutionSubtaskGetByID implements the resolver logic to get an operational solution subtask by ID

func OperationalSolutionSubtaskGetBySolutionIDLOADER

func OperationalSolutionSubtaskGetBySolutionIDLOADER(ctx context.Context, solutionID uuid.UUID) ([]*models.OperationalSolutionSubtask, error)

OperationalSolutionSubtaskGetBySolutionIDLOADER implements resolver logic to get Operational Solution Subtask by a model plan ID using a data loader

func OperationalSolutionUpdate

func OperationalSolutionUpdate(logger *zap.Logger, id uuid.UUID, changes map[string]interface{}, principal authentication.Principal, store *storage.Store) (*models.OperationalSolution, error)

OperationalSolutionUpdate updates an operational Solution by it's ID

func OperationalSolutionsAndPossibleGetByOPNeedIDLOADER

func OperationalSolutionsAndPossibleGetByOPNeedIDLOADER(ctx context.Context, operationalNeedID uuid.UUID, includeNotNeeded bool) ([]*models.OperationalSolution, error)

OperationalSolutionsAndPossibleGetByOPNeedIDLOADER returns operational Solutions and possible Operational Solutions based on a specific operational Need ID using a Data Loader

func PlanBasicsGetByModelPlanIDLOADER

func PlanBasicsGetByModelPlanIDLOADER(ctx context.Context, modelPlanID uuid.UUID) (*models.PlanBasics, error)

PlanBasicsGetByModelPlanIDLOADER implements resolver logic to get plan basics by a model plan ID using a data loader

func PlanBeneficiariesGetByModelPlanIDLOADER

func PlanBeneficiariesGetByModelPlanIDLOADER(ctx context.Context, modelPlanID uuid.UUID) (*models.PlanBeneficiaries, error)

PlanBeneficiariesGetByModelPlanIDLOADER implements resolver logic to get Plan Beneficiaries by a model plan ID using a data loader

func PlanBeneficiariesUpdate

func PlanBeneficiariesUpdate(logger *zap.Logger, id uuid.UUID, changes map[string]interface{}, principal authentication.Principal, store *storage.Store) (*models.PlanBeneficiaries, error)

PlanBeneficiariesUpdate updates a plan Beneficiary buisness object

func PlanCRCreate

func PlanCRCreate(logger *zap.Logger, input *model.PlanCRCreateInput, principal authentication.Principal, store *storage.Store) (*models.PlanCR, error)

PlanCRCreate creates a new plan_cr_tdl record in the database

func PlanCRDelete

func PlanCRDelete(logger *zap.Logger, id uuid.UUID, principal authentication.Principal, store *storage.Store) (*models.PlanCR, error)

PlanCRDelete deletes a plan cr_tdl record in the database

func PlanCRGet

func PlanCRGet(logger *zap.Logger, id uuid.UUID, store *storage.Store) (*models.PlanCR, error)

PlanCRGet returns a plan_cr_tdl record in the database

func PlanCRUpdate

func PlanCRUpdate(logger *zap.Logger, id uuid.UUID, changes map[string]interface{}, principal authentication.Principal, store *storage.Store) (*models.PlanCR, error)

PlanCRUpdate updates a plan_cr_tdl record in the database

func PlanCRsGetByModelPlanID

func PlanCRsGetByModelPlanID(logger *zap.Logger, modelPlanID uuid.UUID, store *storage.Store) ([]*models.PlanCR, error)

PlanCRsGetByModelPlanID returns plan_cr_tdl records related to a model plan

func PlanCollaboratorCreate

func PlanCollaboratorCreate(
	ctx context.Context,
	np sqlutils.NamedPreparer,
	store *storage.Store,
	logger *zap.Logger,
	emailService oddmail.EmailService,
	emailTemplateService email.TemplateService,
	addressBook email.AddressBook,
	input *model.PlanCollaboratorCreateInput,
	principal authentication.Principal,
	checkAccess bool,
	getAccountInformation userhelpers.GetAccountInfoFunc,
	createNotification bool,
) (*models.PlanCollaborator, *models.PlanFavorite, error)

PlanCollaboratorCreate implements resolver logic to create a plan collaborator If the email service or email template service is not provided this method will not

send the collaborator a notification email

A plan favorite is created for the collaborating user when the user is added as a collaborator The transaction object does not commit or rollback in the scope of this function

func PlanCollaboratorDelete

func PlanCollaboratorDelete(logger *zap.Logger, id uuid.UUID, principal authentication.Principal, store *storage.Store) (*models.PlanCollaborator, error)

PlanCollaboratorDelete implements resolver logic to delete a plan collaborator

func PlanCollaboratorGetByID

func PlanCollaboratorGetByID(ctx context.Context, id uuid.UUID) (*models.PlanCollaborator, error)

PlanCollaboratorGetByID implements resolver logic to fetch a plan collaborator by ID. It requires the ctx to have a DataLoader embedded.

func PlanCollaboratorGetByModelPlanIDLOADER

func PlanCollaboratorGetByModelPlanIDLOADER(ctx context.Context, modelPlanID uuid.UUID) ([]*models.PlanCollaborator, error)

PlanCollaboratorGetByModelPlanIDLOADER implements resolver logic to get Plan Collaborator by a model plan ID using a data loader

func PlanCollaboratorUpdate

func PlanCollaboratorUpdate(logger *zap.Logger, id uuid.UUID, newRoles []models.TeamRole, principal authentication.Principal, store *storage.Store) (*models.PlanCollaborator, error)

PlanCollaboratorUpdate implements resolver logic to update a plan collaborator

func PlanDataExchangeApproachGetByModelPlanIDLoader

func PlanDataExchangeApproachGetByModelPlanIDLoader(ctx context.Context, modelPlanID uuid.UUID) (*models.PlanDataExchangeApproach, error)

PlanDataExchangeApproachGetByModelPlanIDLoader calls a data loader to batch fetching a a plan data exchange object that corresponds to a model plan

func PlanDataExchangeApproachUpdate

func PlanDataExchangeApproachUpdate(
	ctx context.Context,
	logger *zap.Logger,
	id uuid.UUID,
	changes map[string]interface{},
	principal authentication.Principal,
	store *storage.Store,
	emailService oddmail.EmailService,
	emailTemplateService email.TemplateService,
	emailAddressBook email.AddressBook,
) (*models.PlanDataExchangeApproach, error)

PlanDataExchangeApproachUpdate updates a plan data exchange approach It looks to see if a user marked the section as complete, and if so it will update the status and mark the user and the date. If a user sets the section as not complete, it will clear that data, and set the status to in progress.

func PlanDiscussionGetByID

func PlanDiscussionGetByID(_ context.Context, store *storage.Store, logger *zap.Logger, discussionID uuid.UUID) (*models.PlanDiscussion, error)

PlanDiscussionGetByID returns a single discussion from the database for a given discussionID

func PlanDiscussionGetByModelPlanIDLOADER

func PlanDiscussionGetByModelPlanIDLOADER(ctx context.Context, modelPlanID uuid.UUID) ([]*models.PlanDiscussion, error)

PlanDiscussionGetByModelPlanIDLOADER implements resolver logic to get Plan Discussion by a model plan ID using a data loader

func PlanDocumentCreate

func PlanDocumentCreate(logger *zap.Logger, input *model.PlanDocumentInput, principal authentication.Principal, store *storage.Store, s3Client *s3.S3Client) (*models.PlanDocument, error)

PlanDocumentCreate implements resolver logic to upload the specified file to S3 and create a matching plan document entity in the database.

func PlanDocumentCreateLinked

func PlanDocumentCreateLinked(logger *zap.Logger, input model.PlanDocumentLinkInput, principal authentication.Principal, store *storage.Store) (*models.PlanDocument, error)

PlanDocumentCreateLinked creates a plan document which is a link to an external URL instead of an Uploaded file

func PlanDocumentDelete

func PlanDocumentDelete(logger *zap.Logger, s3Client *s3.S3Client, id uuid.UUID, principal authentication.Principal, store *storage.Store) (int, error)

PlanDocumentDelete implements resolver logic to update a plan document object

func PlanDocumentNumLinkedSolutions

func PlanDocumentNumLinkedSolutions(logger *zap.Logger, principal authentication.Principal, store *storage.Store, documentID uuid.UUID) (int, error)

PlanDocumentNumLinkedSolutions implements resolver logic to retrieve the number of linked solutions for a document by ID

func PlanDocumentRead

func PlanDocumentRead(logger *zap.Logger, store *storage.Store, s3Client *s3.S3Client, id uuid.UUID) (*models.PlanDocument, error)

PlanDocumentRead implements resolver logic to fetch a plan document object by ID

func PlanDocumentSolutionLinkRemove

func PlanDocumentSolutionLinkRemove(logger *zap.Logger, solutionID uuid.UUID, documentIDs []uuid.UUID, store *storage.Store, principal authentication.Principal) (bool, error)

PlanDocumentSolutionLinkRemove implements resolver logic to delete a plan document solution link

func PlanDocumentSolutionLinksCreate

func PlanDocumentSolutionLinksCreate(logger *zap.Logger, store *storage.Store, solutionID uuid.UUID, documentIDs []uuid.UUID, principal authentication.Principal) ([]*models.PlanDocumentSolutionLink, error)

PlanDocumentSolutionLinksCreate implements resolver logic to create a collection of new plan document solution links

func PlanDocumentSolutionLinksGetBySolutionID

func PlanDocumentSolutionLinksGetBySolutionID(logger *zap.Logger, id uuid.UUID, store *storage.Store) ([]*models.PlanDocumentSolutionLink, error)

PlanDocumentSolutionLinksGetBySolutionID implements resolver logic to get plan document solution links associated with a plan ID

func PlanDocumentsReadByModelPlanID

func PlanDocumentsReadByModelPlanID(logger *zap.Logger, id uuid.UUID, principal authentication.Principal, store *storage.Store, s3Client *s3.S3Client) ([]*models.PlanDocument, error)

PlanDocumentsReadByModelPlanID implements resolver logic to fetch a plan document object by model plan ID

func PlanDocumentsReadBySolutionID

func PlanDocumentsReadBySolutionID(
	logger *zap.Logger,
	id uuid.UUID,
	principal authentication.Principal,
	store *storage.Store,
	s3Client *s3.S3Client,
) ([]*models.PlanDocument, error)

PlanDocumentsReadBySolutionID implements resolver logic to fetch a plan document object by solution ID

func PlanFavoriteCreate

func PlanFavoriteCreate(np sqlutils.NamedPreparer, logger *zap.Logger, principal authentication.Principal, userAccountID uuid.UUID, store *storage.Store, modelPlanID uuid.UUID) (*models.PlanFavorite, error)

PlanFavoriteCreate creates a new plan favorite record in the database

func PlanFavoriteDelete

func PlanFavoriteDelete(logger *zap.Logger, principal authentication.Principal, store *storage.Store, modelPlanID uuid.UUID) (*models.PlanFavorite, error)

PlanFavoriteDelete deletes a plan favorite record in the database

func PlanFavoriteGet

func PlanFavoriteGet(logger *zap.Logger, principal authentication.Principal, store *storage.Store, modelPlandID uuid.UUID) (*models.PlanFavorite, error)

PlanFavoriteGet returns a plan favorite record

func PlanGeneralCharacteristicsGetByModelPlanIDLOADER

func PlanGeneralCharacteristicsGetByModelPlanIDLOADER(ctx context.Context, modelPlanID uuid.UUID) (*models.PlanGeneralCharacteristics, error)

PlanGeneralCharacteristicsGetByModelPlanIDLOADER implements resolver logic to get plan general characteristics by a model plan ID using a data loader

func PlanGeneralCharacteristicsGetExistingModelName

func PlanGeneralCharacteristicsGetExistingModelName(ctx context.Context, planGeneralCharacteristics *models.PlanGeneralCharacteristics) (*string, error)

func PlanOpsEvalAndLearningGetByModelPlanIDLOADER

func PlanOpsEvalAndLearningGetByModelPlanIDLOADER(ctx context.Context, modelPlanID uuid.UUID) (*models.PlanOpsEvalAndLearning, error)

PlanOpsEvalAndLearningGetByModelPlanIDLOADER implements resolver logic to get Plan Operations Evaluation And Learning by a model plan ID using a data loader

func PlanOpsEvalAndLearningUpdate

func PlanOpsEvalAndLearningUpdate(logger *zap.Logger, id uuid.UUID, changes map[string]interface{}, principal authentication.Principal, store *storage.Store) (*models.PlanOpsEvalAndLearning, error)

PlanOpsEvalAndLearningUpdate updates a PlanOpsEvalAndLearning buisness object

func PlanParticipantsAndProvidersGetByModelPlanIDLOADER

func PlanParticipantsAndProvidersGetByModelPlanIDLOADER(ctx context.Context, modelPlanID uuid.UUID) (*models.PlanParticipantsAndProviders, error)

PlanParticipantsAndProvidersGetByModelPlanIDLOADER implements resolver logic to get Plan Participants and Providers by a model plan ID using a data loader

func PlanParticipantsAndProvidersUpdate

func PlanParticipantsAndProvidersUpdate(logger *zap.Logger, id uuid.UUID, changes map[string]interface{}, principal authentication.Principal, store *storage.Store) (*models.PlanParticipantsAndProviders, error)

PlanParticipantsAndProvidersUpdate updates a plan ProvidersAndParticipants buisness object

func PlanPaymentsGetByModelPlanIDLOADER

func PlanPaymentsGetByModelPlanIDLOADER(ctx context.Context, modelPlanID uuid.UUID) (*models.PlanPayments, error)

PlanPaymentsGetByModelPlanIDLOADER implements resolver logic to get Plan Payments by a model plan ID using a data loader

func PlanPaymentsRead

func PlanPaymentsRead(
	logger *zap.Logger,
	store *storage.Store,
	id uuid.UUID,
) (*models.PlanPayments, error)

PlanPaymentsRead handles requests to find a Plan Payment by ID

func PlanPaymentsUpdate

func PlanPaymentsUpdate(
	logger *zap.Logger,
	store *storage.Store,
	id uuid.UUID,
	changes map[string]interface{},
	principal authentication.Principal,
) (*models.PlanPayments, error)

PlanPaymentsUpdate handles requests to update a Plan Payment

func PlanTDLCreate

func PlanTDLCreate(logger *zap.Logger, input *model.PlanTDLCreateInput, principal authentication.Principal, store *storage.Store) (*models.PlanTDL, error)

PlanTDLCreate creates a new plan_cr_tdl record in the database

func PlanTDLDelete

func PlanTDLDelete(logger *zap.Logger, id uuid.UUID, principal authentication.Principal, store *storage.Store) (*models.PlanTDL, error)

PlanTDLDelete deletes a plan cr_tdl record in the database

func PlanTDLGet

func PlanTDLGet(logger *zap.Logger, id uuid.UUID, store *storage.Store) (*models.PlanTDL, error)

PlanTDLGet returns a plan_cr_tdl record in the database

func PlanTDLUpdate

func PlanTDLUpdate(logger *zap.Logger, id uuid.UUID, changes map[string]interface{}, principal authentication.Principal, store *storage.Store) (*models.PlanTDL, error)

PlanTDLUpdate updates a plan_cr_tdl record in the database

func PlanTDLsGetByModelPlanID

func PlanTDLsGetByModelPlanID(logger *zap.Logger, modelPlanID uuid.UUID, store *storage.Store) ([]*models.PlanTDL, error)

PlanTDLsGetByModelPlanID returns plan_cr_tdl records related to a model plan

func PlanTimelineGetByModelPlanIDLOADER

func PlanTimelineGetByModelPlanIDLOADER(ctx context.Context, modelPlanID uuid.UUID) (*models.PlanTimeline, error)

func PossibleOperationalNeedCollectionGet

func PossibleOperationalNeedCollectionGet(logger *zap.Logger, store *storage.Store) ([]*models.PossibleOperationalNeed, error)

PossibleOperationalNeedCollectionGet returns all possible OperationalNeeds

func PossibleOperationalSolutionCollectionGetAll

func PossibleOperationalSolutionCollectionGetAll(logger *zap.Logger, store *storage.Store) ([]*models.PossibleOperationalSolution, error)

PossibleOperationalSolutionCollectionGetAll returns all possible operational Solutions linked to Operational Need Type

func PossibleOperationalSolutionCollectionGetByNeedType

func PossibleOperationalSolutionCollectionGetByNeedType(logger *zap.Logger, needType models.OperationalNeedKey, store *storage.Store) ([]*models.PossibleOperationalSolution, error)

PossibleOperationalSolutionCollectionGetByNeedType returns all possible operational Solutions linked to Operational Need Type

func PossibleOperationalSolutionContactsGetByPossibleSolutionID

func PossibleOperationalSolutionContactsGetByPossibleSolutionID(ctx context.Context, possibleSolutionID int) ([]*models.PossibleOperationalSolutionContact, error)

PossibleOperationalSolutionContactsGetByPossibleSolutionID returns all the contacts associated with a possible operational solution it uses a data loader to ensure efficient querying

func PossibleOperationalSolutionGetByID

func PossibleOperationalSolutionGetByID(logger *zap.Logger, store *storage.Store, id int) (*models.PossibleOperationalSolution, error)

PossibleOperationalSolutionGetByID returns a possible operational Solutions according to it's id

func PossibleOperationalSolutionGetByKey

func PossibleOperationalSolutionGetByKey(ctx context.Context, key models.OperationalSolutionKey) (*models.PossibleOperationalSolution, error)

PossibleOperationalSolutionGetByKey returns a possible operational Solutions according to it's operational solution key

func ReadyForClearanceRead

func ReadyForClearanceRead(
	logger *zap.Logger,
	store *storage.Store,
	modelPlanID uuid.UUID,
) (*model.PrepareForClearance, error)

ReadyForClearanceRead handles requests to read a information about a Model Plan's "Ready for Clearance" section

func ReportAProblem

func ReportAProblem(
	emailService oddmail.EmailService,
	emailTemplateService email.TemplateService,
	addressBook email.AddressBook,
	principal authentication.Principal,
	input model.ReportAProblemInput,
) (bool, error)

ReportAProblem is the resolver to send an email with a problem report

func SendDataExchangeApproachMarkedCompleteEmailNotification

func SendDataExchangeApproachMarkedCompleteEmailNotification(
	emailService oddmail.EmailService,
	templateService email.TemplateService,
	addressBook email.AddressBook,
	modelPlan *models.ModelPlan,
	userEmail string,
	markedCompletedByUserCommonName string,
	showFooter bool,
) error

func SendDataExchangeApproachMarkedCompleteEmailNotifications

func SendDataExchangeApproachMarkedCompleteEmailNotifications(
	emailService oddmail.EmailService,
	templateService email.TemplateService,
	addressBook email.AddressBook,
	receivers []*models.UserAccountAndNotificationPreferences,
	modelPlan *models.ModelPlan,
	markedCompletedByUserCommonName string,
	showFooter bool,
) error

func SendDataExchangeApproachMarkedCompleteNotification

func SendDataExchangeApproachMarkedCompleteNotification(
	ctx context.Context,
	emailService oddmail.EmailService,
	templateService email.TemplateService,
	addressBook email.AddressBook,
	actorID uuid.UUID,
	np sqlutils.NamedPreparer,
	receivers []*models.UserAccountAndNotificationPreferences,
	modelPlan *models.ModelPlan,
	approach *models.PlanDataExchangeApproach,
	markedCompletedBy uuid.UUID,
) error

func SendFeedbackEmail

func SendFeedbackEmail(
	emailService oddmail.EmailService,
	emailTemplateService email.TemplateService,
	addressBook email.AddressBook,
	principal authentication.Principal,
	input model.SendFeedbackEmailInput,
) (bool, error)

SendFeedbackEmail sends a feedback email to the mint team

func ShouldSendEmailForPhaseSuggestion

func ShouldSendEmailForPhaseSuggestion(
	currentPhaseSuggestion *models.PhaseSuggestion,
	previousSuggestedPhase *models.ModelPhase,
) bool

ShouldSendEmailForPhaseSuggestion determines if an email should be sent for a phase suggestion

func SubscribeLockableSectionLockChanges

func SubscribeLockableSectionLockChanges(
	ps pubsub.PubSub,
	modelPlanID uuid.UUID,
	principal authentication.Principal,
	onDisconnect <-chan struct{},
) (<-chan *model.LockableSectionLockStatusChanged, error)

SubscribeLockableSectionLockChanges is a convenience relay method to call the corresponding method on a resolver implementation

func TagCollectionCreate

func TagCollectionCreate(np sqlutils.NamedPreparer, logger *zap.Logger, principal authentication.Principal,
	taggedField string, taggedTable string, taggedContentID uuid.UUID, mentions []*models.HTMLMention) ([]*models.Tag, error)

TagCollectionCreate converts an array of mentions, and creates an array in the database for unique tags.

func TagCollectionGet

func TagCollectionGet(
	logger *zap.Logger,
	store *storage.Store,
	taggedTable string,
	taggedField string,
	taggedContentID uuid.UUID) ([]*models.Tag, error)

TagCollectionGet retrieves all the tags for a specific entry and table

func TaggedContentGet

func TaggedContentGet(
	logger *zap.Logger,
	store *storage.Store,
	rawContent string,
	taggedTable string,
	taggedField string,
	taggedContentID uuid.UUID) (*models.TaggedContent, error)

TaggedContentGet returns the tag content of a parent object

func TaggedEntityGet

func TaggedEntityGet(
	ctx context.Context,
	store *storage.Store,
	tagType models.TagType,
	EntityUUID *uuid.UUID,
	EntityIntID *int,
) (models.TaggedEntity, error)

TaggedEntityGet returns a Tagged Entity based on the table it refers to as well as the ID

func TranslatedAuditCollectionGetByModelPlanID

func TranslatedAuditCollectionGetByModelPlanID(ctx context.Context, store *storage.Store, logger *zap.Logger, principal authentication.Principal, modelPlanID uuid.UUID, limit *int, offset *int) ([]*models.TranslatedAudit, error)

TranslatedAuditCollectionGetByModelPlanID returns all TranslatedAudit for a given model plan id if a user has privileged access, they will see audit changes that are restricted, otherwise only unrestricted limit: this controls how many records will be returned at once. A null entry will return all records offset: how many records to skip before returning results. If null, no records will be skipped.

func TranslatedAuditCollectionGetByModelPlanIDAndTableNames

func TranslatedAuditCollectionGetByModelPlanIDAndTableNames(ctx context.Context, store *storage.Store, logger *zap.Logger, principal authentication.Principal, modelPlanID uuid.UUID,

	tablesToInclude []models.TableName, limit *int, offset *int) ([]*models.TranslatedAudit, error)

TranslatedAuditCollectionGetByModelPlanIDAndTableNames returns all TranslatedAudit for a given model plan id for the provided table names TODO: refactor this to be a data loader, since it is potentially called multiple times

func TranslatedAuditFieldCollectionGetByTranslatedAuditID

func TranslatedAuditFieldCollectionGetByTranslatedAuditID(ctx context.Context, translatedAuditID uuid.UUID) ([]*models.TranslatedAuditField, error)

TranslatedAuditFieldCollectionGetByTranslatedAuditID returns all TranslatedAuditChange for a given translated audit id

func TranslatedAuditGetMostRecentByModelPlanIDAndTableNames

func TranslatedAuditGetMostRecentByModelPlanIDAndTableNames(ctx context.Context, logger *zap.Logger, modelPlanID uuid.UUID, tablesToInclude []models.TableName, excludedFields []string) (*models.TranslatedAudit, error)

TranslatedAuditGetMostRecentByModelPlanIDAndTableNames returns the most recent TranslatedAudit for a given model plan id and table names if one doesn't exist, it will return nil. Note we specifically exclude privelleged access here so it's consistent for all users

func TryNotificationSendIncorrectModelStatus

func TryNotificationSendIncorrectModelStatus(
	ctx context.Context,
	store *storage.Store,
	logger *zap.Logger,
	emailService oddmail.EmailService,
	emailTemplateService email.TemplateService,
	addressBook email.AddressBook,
	modelPlanID uuid.UUID,
) error

func TrySendDataExchangeApproachNotifications

func TrySendDataExchangeApproachNotifications(
	ctx context.Context,
	existing *models.PlanDataExchangeApproach,
	logger *zap.Logger,
	emailService oddmail.EmailService,
	emailTemplateService email.TemplateService,
	emailAddressBook email.AddressBook,
	principal authentication.Principal,
	np sqlutils.NamedPreparer,
)

func TrySendEmailForPhaseSuggestion

func TrySendEmailForPhaseSuggestion(
	ctx context.Context,
	logger *zap.Logger,
	store *storage.Store,
	emailRecipients []string,
	emailService oddmail.EmailService,
	emailTemplateService email.TemplateService,
	addressBook *email.AddressBook,
	currentPhaseSuggestion *models.PhaseSuggestion,
	modelPlan *models.ModelPlan,
) error

TrySendEmailForPhaseSuggestion sends an email to the model plan leads if the suggested phase has changed

func UnlockAllLockableSections

func UnlockAllLockableSections(ps pubsub.PubSub, modelPlanID uuid.UUID) ([]*model.LockableSectionLockStatus, error)

UnlockAllLockableSections is a convenience relay method to call the corresponding method on a resolver implementation

func UnlockLockableSection

func UnlockLockableSection(ps pubsub.PubSub, modelPlanID uuid.UUID, section models.LockableSection, userID uuid.UUID, actionType model.ActionType) (bool, error)

UnlockLockableSection is a convenience relay method to call the corresponding method on a resolver implementation

func UpdateDiscussionReply

func UpdateDiscussionReply(logger *zap.Logger, id uuid.UUID, changes map[string]interface{}, principal authentication.Principal, store *storage.Store) (*models.DiscussionReply, error)

UpdateDiscussionReply implements resolver logic to update a Discussion reply object Deprecated: THIS IS NOT USED by the front end. If it is ever used, make sure to handle tags

func UpdateMTOCommonSolutionContact

func UpdateMTOCommonSolutionContact(ctx context.Context, logger *zap.Logger, principal authentication.Principal, store *storage.Store,
	emailService oddmail.EmailService, emailTemplateService email.TemplateService, addressBook email.AddressBook,
	id uuid.UUID,
	changes map[string]interface{},
) (*models.MTOCommonSolutionContact, error)

UpdateMTOCommonSolutionContact updates an existing user or mailbox contact for a common solution. Only role, isPrimary, and receiveEmails fields can be changed. Returns the updated contact.

func UpdateMTOCommonSolutionContractor

func UpdateMTOCommonSolutionContractor(ctx context.Context, logger *zap.Logger, principal authentication.Principal, store *storage.Store,
	emailService oddmail.EmailService, emailTemplateService email.TemplateService, addressBook email.AddressBook,
	id uuid.UUID,
	changes map[string]interface{},
) (*models.MTOCommonSolutionContractor, error)

UpdateMTOCommonSolutionContractor updates an existing contractor for a common solution. Accepts the contractor ID and a map of changes. Returns the updated contractor or an error.

func UpdateMTOCommonSolutionSystemOwner

func UpdateMTOCommonSolutionSystemOwner(ctx context.Context, logger *zap.Logger, principal authentication.Principal, store *storage.Store,
	emailService oddmail.EmailService, emailTemplateService email.TemplateService, addressBook email.AddressBook,
	id uuid.UUID,
	changes map[string]interface{},
) (*models.MTOCommonSolutionSystemOwner, error)

UpdateMTOCommonSolutionSystemOwner updates an existing system owner for a common solution. Accepts the system owner ID and a map of changes. Returns the updated system owner or an error.

func UpdatePlanBasics

func UpdatePlanBasics(
	ctx context.Context,
	logger *zap.Logger,
	id uuid.UUID,
	changes map[string]interface{},
	principal authentication.Principal,
	store *storage.Store,
) (*models.PlanBasics, error)

UpdatePlanBasics implements resolver logic to update a plan basics object

func UpdatePlanDiscussion

func UpdatePlanDiscussion(logger *zap.Logger, id uuid.UUID, changes map[string]interface{}, principal authentication.Principal, store *storage.Store) (*models.PlanDiscussion, error)

UpdatePlanDiscussion implements resolver logic to update a plan Discussion object Deprecated: THIS IS NOT USED by the front end. If it is ever used, make sure to handle tags

func UpdatePlanGeneralCharacteristics

func UpdatePlanGeneralCharacteristics(logger *zap.Logger, id uuid.UUID, changes map[string]interface{}, principal authentication.Principal, store *storage.Store) (*models.PlanGeneralCharacteristics, error)

UpdatePlanGeneralCharacteristics implements resolver logic to update a plan general characteristics object

func UpdatePlanTimeline

func UpdatePlanTimeline(
	ctx context.Context,
	logger *zap.Logger,
	id uuid.UUID,
	changes map[string]interface{},
	principal authentication.Principal,
	store *storage.Store,
	emailService oddmail.EmailService,
	emailTemplateService email.TemplateService,
	addressBook email.AddressBook,
) (*models.PlanTimeline, error)

func UpdateTaggedHTMLMentionsAndRawContent

func UpdateTaggedHTMLMentionsAndRawContent(ctx context.Context, store *storage.Store, tHTML *models.TaggedHTML, getAccountInformation userhelpers.GetAccountInfoFunc) error

UpdateTaggedHTMLMentionsAndRawContent updates the tagged html with the correct entity ids, and updates the RAW HTMl with the new representation of the mentions Both the raw content as well as the the individual mentions are updated as a result of this method The databaseID will be updated every time regardless of it was set in the html tag.

func UserAccountGetByIDLOADER

func UserAccountGetByIDLOADER(ctx context.Context, id uuid.UUID) (*authentication.UserAccount, error)

UserAccountGetByIDLOADER returns a user account by it's internal ID, utilizing a data loader

func UserAccountGetByUsername

func UserAccountGetByUsername(logger *zap.Logger, store *storage.Store, userName string) (*authentication.UserAccount, error)

UserAccountGetByUsername returns a user account by it's userName

func UserAccountsGetByIDs

func UserAccountsGetByIDs(logger *zap.Logger, store *storage.Store, ids []uuid.UUID) ([]*authentication.UserAccount, error)

UserAccountsGetByIDs returns a list of user account by it's internal ID

func UserNotificationPreferencesGetByUserID

func UserNotificationPreferencesGetByUserID(ctx context.Context, userID uuid.UUID) (*models.UserNotificationPreferences, error)

UserNotificationPreferencesGetByUserID returns a user notification preferences object based on a userID

func UserNotificationPreferencesUpdate

func UserNotificationPreferencesUpdate(ctx context.Context, logger *zap.Logger, principal authentication.Principal, store *storage.Store, changes map[string]interface{}) (*models.UserNotificationPreferences, error)

UserNotificationPreferencesUpdate updates a user notification preferences object for a user Notice: The specific UserNotificationPreference is inferred from the principal object. It will only update the notification preference for the current user.

func UserViewCustomizationGetByUserID

func UserViewCustomizationGetByUserID(
	logger *zap.Logger,
	store *storage.Store,
	principal authentication.Principal,
) (*models.UserViewCustomization, error)

UserViewCustomizationGetByUserID retrieves a user view customization by user ID (using the ID from the passed in authentication.Principal object)

func UserViewCustomizationUpdate

func UserViewCustomizationUpdate(
	logger *zap.Logger,
	store *storage.Store,
	principal authentication.Principal,
	changes map[string]interface{},
) (*models.UserViewCustomization, error)

UserViewCustomizationUpdate handles updating a user view customization with a map of changes

Types

type ActiveStrategy

type ActiveStrategy struct{}

ActiveStrategy is a strategy for evaluating the active status of a model plan

func (*ActiveStrategy) Evaluate

func (s *ActiveStrategy) Evaluate(
	modelPlanStatus models.ModelStatus,
	planTimeline *models.PlanTimeline,
) *models.PhaseSuggestion

Evaluate returns the models.ModelStatusActive status if the model plan status is not Active and the performance period start date has passed

type AnnounceStrategy

type AnnounceStrategy struct{}

AnnounceStrategy is a strategy for evaluating the announcement status of a model plan

func (*AnnounceStrategy) Evaluate

func (s *AnnounceStrategy) Evaluate(
	modelPlanStatus models.ModelStatus,
	planTimeline *models.PlanTimeline,
) *models.PhaseSuggestion

Evaluate returns the models.ModelStatusAnnounced status if the model plan status is not Announced and the announcement date has passed

type ClearanceEndStrategy

type ClearanceEndStrategy struct{}

ClearanceEndStrategy is a strategy for evaluating the clearance end status of a model plan

func (*ClearanceEndStrategy) Evaluate

func (s *ClearanceEndStrategy) Evaluate(
	modelPlanStatus models.ModelStatus,
	planTimeline *models.PlanTimeline,
) *models.PhaseSuggestion

Evaluate returns the models.ModelStatusCleared status if the model plan status is not Cleared and the clearance end date has passed

type ClearanceStartStrategy

type ClearanceStartStrategy struct{}

ClearanceStartStrategy is a strategy for evaluating the clearance start status of a model plan

func (*ClearanceStartStrategy) Evaluate

func (s *ClearanceStartStrategy) Evaluate(
	modelPlanStatus models.ModelStatus,
	planTimeline *models.PlanTimeline,
) *models.PhaseSuggestion

Evaluate returns the chronologically earliest clearance status (models.ModelStatusInternalCmmiClearance) if the model plan status is not "Plan Complete" and the clearance start date has passed

type EndedStrategy

type EndedStrategy struct{}

EndedStrategy is a strategy for evaluating the ended status of a model plan

func (*EndedStrategy) Evaluate

func (s *EndedStrategy) Evaluate(
	modelPlanStatus models.ModelStatus,
	planTimeline *models.PlanTimeline,
) *models.PhaseSuggestion

Evaluate returns the models.ModelStatusEnded status if the model plan status is not already "Ended" and the performance period end date has passed

type ICIPCompleteStrategy

type ICIPCompleteStrategy struct{}

ICIPCompleteStrategy is a strategy for evaluating the ICIP complete status of a model plan

func (*ICIPCompleteStrategy) Evaluate

func (s *ICIPCompleteStrategy) Evaluate(
	modelPlanStatus models.ModelStatus,
	planTimeline *models.PlanTimeline,
) *models.PhaseSuggestion

Evaluate returns the models.ModelStatusIcipComplete status if the model plan status is not "ICIP complete" and the ICIP complete date has passed

type LockableSectionLocks

type LockableSectionLocks interface {
	GetLockableSectionLocks(modelPlanID uuid.UUID) ([]*model.LockableSectionLockStatus, error)
	SubscribeLockableSectionLockChanges(ps pubsub.PubSub, modelPlanID uuid.UUID, principal string, onDisconnect <-chan struct{}) (<-chan *model.LockableSectionLockStatusChanged, error)
	LockLockableSection(ps pubsub.PubSub, modelPlanID uuid.UUID, section string, principal string) (bool, error)
	UnlockLockableSection(ps pubsub.PubSub, modelPlanID uuid.UUID, section string, principal string) (bool, error)
	UnlockAllLockableSections(ps pubsub.PubSub, modelPlanID uuid.UUID) []model.LockableSectionLockStatus
}

LockableSectionLocks defines an interface to implement or mock

type LockableSectionLocksResolverImplementation

type LockableSectionLocksResolverImplementation struct {
}

LockableSectionLocksResolverImplementation is an implementation of the LockableSectionLocks interface

func NewLockableSectionLocksResolverImplementation

func NewLockableSectionLocksResolverImplementation() *LockableSectionLocksResolverImplementation

NewLockableSectionLocksResolverImplementation is a constructor to create an instance of LockableSectionLocksResolverImplementation

func (LockableSectionLocksResolverImplementation) GetLockableSectionLocks

func (p LockableSectionLocksResolverImplementation) GetLockableSectionLocks(modelPlanID uuid.UUID) ([]*model.LockableSectionLockStatus, error)

GetLockableSectionLocks returns the list of locked task list sections. Any sections not included should be considered as unlocked.

func (LockableSectionLocksResolverImplementation) LockLockableSection

func (p LockableSectionLocksResolverImplementation) LockLockableSection(ps pubsub.PubSub, modelPlanID uuid.UUID, section models.LockableSection, principal authentication.Principal) (bool, error)

LockLockableSection will lock the provided task list section on the provided model

func (LockableSectionLocksResolverImplementation) SubscribeLockableSectionLockChanges

func (p LockableSectionLocksResolverImplementation) SubscribeLockableSectionLockChanges(ps pubsub.PubSub, modelPlanID uuid.UUID, subscriber *subscribers.LockableSectionLockChangedSubscriber, onDisconnect <-chan struct{}) (<-chan *model.LockableSectionLockStatusChanged, error)

SubscribeLockableSectionLockChanges creates a Subscriber and registers it for the pubsubevents.LockableSectionLocksChanged event

func (LockableSectionLocksResolverImplementation) UnlockAllLockableSections

func (p LockableSectionLocksResolverImplementation) UnlockAllLockableSections(ps pubsub.PubSub, modelPlanID uuid.UUID) ([]*model.LockableSectionLockStatus, error)

UnlockAllLockableSections will unlock all task list sections on the provided model

func (LockableSectionLocksResolverImplementation) UnlockLockableSection

func (p LockableSectionLocksResolverImplementation) UnlockLockableSection(ps pubsub.PubSub, modelPlanID uuid.UUID, section models.LockableSection, userID uuid.UUID, actionType model.ActionType) (bool, error)

UnlockLockableSection will unlock the provided task list section on the provided model

This method will fail if the provided principal is not the person who locked the task list section

type PlanTimelineDateProcessor

type PlanTimelineDateProcessor struct {
	FieldDataMap map[string]datePlanTimelineFieldData
	// contains filtered or unexported fields
}

PlanTimelineDateProcessor is a struct that processes date changes

func NewPlanTimelineDateProcessor

func NewPlanTimelineDateProcessor(changes map[string]interface{}, existing *models.PlanTimeline) (*PlanTimelineDateProcessor, error)

NewPlanTimelineDateProcessor is a constructor for PlanTimelineDateProcessor

func (*PlanTimelineDateProcessor) ExtractPlanTimelineChangedDates

func (dp *PlanTimelineDateProcessor) ExtractPlanTimelineChangedDates() (map[string]email.DateChange, error)

ExtractPlanTimelineChangedDates extracts the changed dates from the PlanTimelineDateProcessor

type Resolver

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

Resolver is a resolver.

func NewResolver

func NewResolver(
	store *storage.Store,
	service ResolverService,
	s3Client *s3.S3Client,
	echimpS3Client *s3.S3Client,
	emailService oddmail.EmailService,
	emailTemplateService email.TemplateService,
	addressBook email.AddressBook,
	ldClient *ldclient.LDClient,
	pubsub pubsub.PubSub,
	viperConfig *viper.Viper,
) *Resolver

NewResolver constructs a resolver

func (*Resolver) Activity

func (r *Resolver) Activity() generated.ActivityResolver

Activity returns generated.ActivityResolver implementation.

func (*Resolver) AddedAsCollaboratorMeta

func (r *Resolver) AddedAsCollaboratorMeta() generated.AddedAsCollaboratorMetaResolver

AddedAsCollaboratorMeta returns generated.AddedAsCollaboratorMetaResolver implementation.

func (*Resolver) AnalyzedModelLeadInfo

func (r *Resolver) AnalyzedModelLeadInfo() generated.AnalyzedModelLeadInfoResolver

AnalyzedModelLeadInfo returns generated.AnalyzedModelLeadInfoResolver implementation.

func (*Resolver) AuditChange

func (r *Resolver) AuditChange() generated.AuditChangeResolver

AuditChange returns generated.AuditChangeResolver implementation.

func (*Resolver) CurrentUser

func (r *Resolver) CurrentUser() generated.CurrentUserResolver

CurrentUser returns generated.CurrentUserResolver implementation.

func (*Resolver) DailyDigestCompleteActivityMeta

func (r *Resolver) DailyDigestCompleteActivityMeta() generated.DailyDigestCompleteActivityMetaResolver

DailyDigestCompleteActivityMeta returns generated.DailyDigestCompleteActivityMetaResolver implementation.

func (*Resolver) DatesChangedActivityMeta

func (r *Resolver) DatesChangedActivityMeta() generated.DatesChangedActivityMetaResolver

DatesChangedActivityMeta returns generated.DatesChangedActivityMetaResolver implementation.

func (*Resolver) DiscussionReply

func (r *Resolver) DiscussionReply() generated.DiscussionReplyResolver

DiscussionReply returns generated.DiscussionReplyResolver implementation.

func (r *Resolver) ExistingModelLink() generated.ExistingModelLinkResolver

ExistingModelLink returns generated.ExistingModelLinkResolver implementation.

func (r *Resolver) ExistingModelLinks() generated.ExistingModelLinksResolver

ExistingModelLinks returns generated.ExistingModelLinksResolver implementation.

func (*Resolver) IncorrectModelStatusActivityMeta

func (r *Resolver) IncorrectModelStatusActivityMeta() generated.IncorrectModelStatusActivityMetaResolver

IncorrectModelStatusActivityMeta returns generated.IncorrectModelStatusActivityMetaResolver implementation.

func (*Resolver) MTOCategory

func (r *Resolver) MTOCategory() generated.MTOCategoryResolver

MTOCategory returns generated.MTOCategoryResolver implementation.

func (*Resolver) MTOCommonMilestone

func (r *Resolver) MTOCommonMilestone() generated.MTOCommonMilestoneResolver

MTOCommonMilestone returns generated.MTOCommonMilestoneResolver implementation.

func (*Resolver) MTOCommonSolution

func (r *Resolver) MTOCommonSolution() generated.MTOCommonSolutionResolver

MTOCommonSolution returns generated.MTOCommonSolutionResolver implementation.

func (*Resolver) MTOInfo

func (r *Resolver) MTOInfo() generated.MTOInfoResolver

MTOInfo returns generated.MTOInfoResolver implementation.

func (*Resolver) MTOMilestone

func (r *Resolver) MTOMilestone() generated.MTOMilestoneResolver

MTOMilestone returns generated.MTOMilestoneResolver implementation.

func (*Resolver) MTOSolution

func (r *Resolver) MTOSolution() generated.MTOSolutionResolver

MTOSolution returns generated.MTOSolutionResolver implementation.

func (*Resolver) MTOSubcategory

func (r *Resolver) MTOSubcategory() generated.MTOSubcategoryResolver

MTOSubcategory returns generated.MTOSubcategoryResolver implementation.

func (*Resolver) ModelPlan

func (r *Resolver) ModelPlan() generated.ModelPlanResolver

ModelPlan returns generated.ModelPlanResolver implementation.

func (*Resolver) ModelPlanAndMTOCommonSolution

func (r *Resolver) ModelPlanAndMTOCommonSolution() generated.ModelPlanAndMTOCommonSolutionResolver

ModelPlanAndMTOCommonSolution returns generated.ModelPlanAndMTOCommonSolutionResolver implementation.

func (*Resolver) ModelPlanSharedActivityMeta

func (r *Resolver) ModelPlanSharedActivityMeta() generated.ModelPlanSharedActivityMetaResolver

ModelPlanSharedActivityMeta returns generated.ModelPlanSharedActivityMetaResolver implementation.

func (*Resolver) ModelsToOperationMatrix

func (r *Resolver) ModelsToOperationMatrix() generated.ModelsToOperationMatrixResolver

ModelsToOperationMatrix returns generated.ModelsToOperationMatrixResolver implementation.

func (*Resolver) Mutation

func (r *Resolver) Mutation() generated.MutationResolver

Mutation returns generated.MutationResolver implementation.

func (*Resolver) NewDiscussionRepliedActivityMeta

func (r *Resolver) NewDiscussionRepliedActivityMeta() generated.NewDiscussionRepliedActivityMetaResolver

NewDiscussionRepliedActivityMeta returns generated.NewDiscussionRepliedActivityMetaResolver implementation.

func (*Resolver) NewModelPlanActivityMeta

func (r *Resolver) NewModelPlanActivityMeta() generated.NewModelPlanActivityMetaResolver

NewModelPlanActivityMeta returns generated.NewModelPlanActivityMetaResolver implementation.

func (*Resolver) PlanBasics

func (r *Resolver) PlanBasics() generated.PlanBasicsResolver

PlanBasics returns generated.PlanBasicsResolver implementation.

func (*Resolver) PlanBeneficiaries

func (r *Resolver) PlanBeneficiaries() generated.PlanBeneficiariesResolver

PlanBeneficiaries returns generated.PlanBeneficiariesResolver implementation.

func (*Resolver) PlanCollaborator

func (r *Resolver) PlanCollaborator() generated.PlanCollaboratorResolver

PlanCollaborator returns generated.PlanCollaboratorResolver implementation.

func (*Resolver) PlanDataExchangeApproach

func (r *Resolver) PlanDataExchangeApproach() generated.PlanDataExchangeApproachResolver

PlanDataExchangeApproach returns generated.PlanDataExchangeApproachResolver implementation.

func (*Resolver) PlanDataExchangeApproachMarkedCompleteActivityMeta

func (r *Resolver) PlanDataExchangeApproachMarkedCompleteActivityMeta() generated.PlanDataExchangeApproachMarkedCompleteActivityMetaResolver

PlanDataExchangeApproachMarkedCompleteActivityMeta returns generated.PlanDataExchangeApproachMarkedCompleteActivityMetaResolver implementation.

func (*Resolver) PlanDiscussion

func (r *Resolver) PlanDiscussion() generated.PlanDiscussionResolver

PlanDiscussion returns generated.PlanDiscussionResolver implementation.

func (*Resolver) PlanDocument

func (r *Resolver) PlanDocument() generated.PlanDocumentResolver

PlanDocument returns generated.PlanDocumentResolver implementation.

func (*Resolver) PlanGeneralCharacteristics

func (r *Resolver) PlanGeneralCharacteristics() generated.PlanGeneralCharacteristicsResolver

PlanGeneralCharacteristics returns generated.PlanGeneralCharacteristicsResolver implementation.

func (*Resolver) PlanOpsEvalAndLearning

func (r *Resolver) PlanOpsEvalAndLearning() generated.PlanOpsEvalAndLearningResolver

PlanOpsEvalAndLearning returns generated.PlanOpsEvalAndLearningResolver implementation.

func (*Resolver) PlanParticipantsAndProviders

func (r *Resolver) PlanParticipantsAndProviders() generated.PlanParticipantsAndProvidersResolver

PlanParticipantsAndProviders returns generated.PlanParticipantsAndProvidersResolver implementation.

func (*Resolver) PlanPayments

func (r *Resolver) PlanPayments() generated.PlanPaymentsResolver

PlanPayments returns generated.PlanPaymentsResolver implementation.

func (*Resolver) PlanTimeline

func (r *Resolver) PlanTimeline() generated.PlanTimelineResolver

PlanTimeline returns generated.PlanTimelineResolver implementation.

func (*Resolver) PossibleOperationalSolution

func (r *Resolver) PossibleOperationalSolution() generated.PossibleOperationalSolutionResolver

PossibleOperationalSolution returns generated.PossibleOperationalSolutionResolver implementation.

func (*Resolver) Query

func (r *Resolver) Query() generated.QueryResolver

Query returns generated.QueryResolver implementation.

func (*Resolver) Subscription

func (r *Resolver) Subscription() generated.SubscriptionResolver

Subscription returns generated.SubscriptionResolver implementation.

func (*Resolver) Tag

func (r *Resolver) Tag() generated.TagResolver

Tag returns generated.TagResolver implementation.

func (*Resolver) TaggedContent

func (r *Resolver) TaggedContent() generated.TaggedContentResolver

TaggedContent returns generated.TaggedContentResolver implementation.

func (*Resolver) TaggedInDiscussionReplyActivityMeta

func (r *Resolver) TaggedInDiscussionReplyActivityMeta() generated.TaggedInDiscussionReplyActivityMetaResolver

TaggedInDiscussionReplyActivityMeta returns generated.TaggedInDiscussionReplyActivityMetaResolver implementation.

func (*Resolver) TaggedInPlanDiscussionActivityMeta

func (r *Resolver) TaggedInPlanDiscussionActivityMeta() generated.TaggedInPlanDiscussionActivityMetaResolver

TaggedInPlanDiscussionActivityMeta returns generated.TaggedInPlanDiscussionActivityMetaResolver implementation.

func (*Resolver) TranslatedAudit

func (r *Resolver) TranslatedAudit() generated.TranslatedAuditResolver

TranslatedAudit returns generated.TranslatedAuditResolver implementation.

func (*Resolver) TranslatedAuditField

func (r *Resolver) TranslatedAuditField() generated.TranslatedAuditFieldResolver

TranslatedAuditField returns generated.TranslatedAuditFieldResolver implementation.

func (*Resolver) TranslationFieldWithOptionsAndChildren

func (r *Resolver) TranslationFieldWithOptionsAndChildren() generated.TranslationFieldWithOptionsAndChildrenResolver

TranslationFieldWithOptionsAndChildren returns generated.TranslationFieldWithOptionsAndChildrenResolver implementation.

func (*Resolver) TranslationFieldWithParentAndChildren

func (r *Resolver) TranslationFieldWithParentAndChildren() generated.TranslationFieldWithParentAndChildrenResolver

TranslationFieldWithParentAndChildren returns generated.TranslationFieldWithParentAndChildrenResolver implementation.

func (*Resolver) UserNotification

func (r *Resolver) UserNotification() generated.UserNotificationResolver

UserNotification returns generated.UserNotificationResolver implementation.

func (*Resolver) UserNotificationPreferences

func (r *Resolver) UserNotificationPreferences() generated.UserNotificationPreferencesResolver

UserNotificationPreferences returns generated.UserNotificationPreferencesResolver implementation.

func (*Resolver) UserViewCustomization

func (r *Resolver) UserViewCustomization() generated.UserViewCustomizationResolver

UserViewCustomization returns generated.UserViewCustomizationResolver implementation.

type ResolverService

type ResolverService struct {
	FetchUserInfo func(context.Context, string) (*models.UserInfo, error)
	SearchByName  func(context.Context, string) ([]*models.UserInfo, error)
}

ResolverService holds service methods for use in resolvers

type StatusEvaluationStrategy

type StatusEvaluationStrategy interface {
	Evaluate(
		modelPlanStatus models.ModelStatus,
		planTimeline *models.PlanTimeline,
	) *models.PhaseSuggestion
}

StatusEvaluationStrategy is an interface for evaluating the status of a model plan

func GetAllStatusEvaluationStrategies

func GetAllStatusEvaluationStrategies() []StatusEvaluationStrategy

GetAllStatusEvaluationStrategies returns all status evaluation strategies. Strategies are typically evaluated in order they are returned, so it is important to sort them in reverse chronological order so that the suggested status is the most chronologically advanced possible suggestion.

type TestConfigs

type TestConfigs struct {
	DBConfig       storage.DBConfig
	LDClient       *ld.LDClient
	Logger         *zap.Logger
	UserInfo       *models.UserInfo
	Store          *storage.Store
	S3Client       *s3.S3Client
	EChimpS3Client *s3.S3Client
	PubSub         *pubsub.ServicePubSub
	Principal      *authentication.ApplicationPrincipal
	Context        context.Context
	OktaClient     oktaapi.Client
	// contains filtered or unexported fields
}

TestConfigs is a struct that contains all the dependencies needed to run a test

func GetDefaultTestConfigs

func GetDefaultTestConfigs() *TestConfigs

GetDefaultTestConfigs returns a TestConfigs struct with all the dependencies needed to run a test Note, it does not return the principal as this needs to be updated for every test. This should only be called from setup tests!

func (*TestConfigs) GetDefaults

func (tc *TestConfigs) GetDefaults()

GetDefaults sets the dependencies for the TestConfigs struct The principal needs to be set before every test as the user account is removed between tests

Source Files

Jump to

Keyboard shortcuts

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