// LoadTypeFromDB return work item link type for the given name in the correct link category
// NOTE: Two link types can coexist with different categoryIDs.
LoadTypeFromDB return work item link type for the given name in the correct link category
NOTE: Two link types can coexist with different categoryIDs.
// LoadTypeFromDB return work item link type for the given name in the correct link category // NOTE : Two link types can coexist with different categoryIDs .
func (r *GormWorkItemLinkTypeRepository) LoadTypeFromDBByNameAndCategory(ctx context.Context, name string, categoryId uuid.UUID) (*WorkItemLinkType, error) {
	log.Info(ctx, map[string]interface{}{
		"wiltName":   name,
		"categoryId": categoryId.String(),
	}, "Loading work item link type by name and category")
	modelLinkType := WorkItemLinkType{}
	db := r.db.Model(&modelLinkType).Where("name=? AND link_category_id=?", name, categoryId.String()).First(&modelLinkType)
	if db.RecordNotFound() {
		log.Error(ctx, map[string]interface{}{
			"wiltName":   name,
			"categoryId": categoryId.String(),
		}, "work item link type not found")
		return nil, errors.NewNotFoundError("work item link type", name)
	}
	if db.Error != nil {
		return nil, errors.NewInternalError(db.Error.Error())
	}
	return &modelLinkType, nil
}
func ( r * GormWorkItemLinkTypeRepository ) LoadTypeFromDBByNameAndCategory ( ctx context . Context , name string , categoryId uuid . UUID ) ( * WorkItemLinkType , error ) { log . Info ( ctx , map [ string ] interface { } { " " : name , " " : categoryId . String ( ) , } , " " ) modelLinkType := WorkItemLinkType { } db := r . db . Model ( & modelLinkType ) . Where ( " " , name , categoryId . String ( ) ) . First ( & modelLinkType ) if db . RecordNotFound ( ) { log . Error ( ctx , map [ string ] interface { } { " " : name , " " : categoryId . String ( ) , } , " " ) return nil , errors . NewNotFoundError ( " " , name ) } if db . Error != nil { return nil , errors . NewInternalError ( db . Error . Error ( ) ) } return & modelLinkType , nil }
LoadTypeFromDB return work item link type for the given name in the correct link category
NOTE: Two link types can coexist with different categoryIDs.
LoadTypeFromDB return work item link type for the given name in the correct link category NOTE : Two link types can coexist with different categoryIDs .