Documentation ¶
Index ¶
- Variables
- func BasicDelete(collection IsCollection, id bson.ObjectId) (bson.ObjectId, error)
- func GetEntitiesIds(entities []Entity) []bson.ObjectId
- func UniqIDs(ids []bson.ObjectId) []bson.ObjectId
- type BulkImportUsageIndicatorsResults
- type DocktorURL
- type Entity
- type EntityRepo
- func (r *EntityRepo) Delete(id bson.ObjectId) (bson.ObjectId, error)
- func (r *EntityRepo) Exists(name string) (bool, error)
- func (r *EntityRepo) FindAll() ([]Entity, error)
- func (r *EntityRepo) FindAllByIDBson(ids []bson.ObjectId) ([]Entity, error)
- func (r *EntityRepo) FindByID(id string) (Entity, error)
- func (r *EntityRepo) FindByIDBson(id bson.ObjectId) (Entity, error)
- func (r *EntityRepo) Save(entity Entity) (Entity, error)
- type EntityType
- type ErrorMsg
- type FunctionalService
- type FunctionalServiceRepo
- func (r *FunctionalServiceRepo) Delete(id bson.ObjectId) (bson.ObjectId, error)
- func (r *FunctionalServiceRepo) Exists(name, pkg string) (bool, error)
- func (r *FunctionalServiceRepo) FindAll() ([]FunctionalService, error)
- func (r *FunctionalServiceRepo) FindByID(id string) (FunctionalService, error)
- func (r *FunctionalServiceRepo) FindByIDBson(id bson.ObjectId) (FunctionalService, error)
- func (r *FunctionalServiceRepo) FindFunctionalServicesDeployByServices(services []string) ([]FunctionalService, error)
- func (r *FunctionalServiceRepo) Save(functionalService FunctionalService) (FunctionalService, error)
- type IndicatorInError
- type IsCollection
- type IsCollectionWithIndexes
- type IsDocument
- type Language
- type LanguageRepo
- type Languages
- type Matrix
- type MatrixLine
- type Project
- type ProjectRepo
- func (r *ProjectRepo) Delete(id bson.ObjectId) (bson.ObjectId, error)
- func (r *ProjectRepo) FindAll() ([]Project, error)
- func (r *ProjectRepo) FindByEntities(ids []bson.ObjectId) ([]Project, error)
- func (r *ProjectRepo) FindByID(id string) (Project, error)
- func (r *ProjectRepo) FindByIDBson(id bson.ObjectId) (Project, error)
- func (r *ProjectRepo) FindByName(name string) (Project, error)
- func (r *ProjectRepo) FindByProjectManagerOrDeputy(id bson.ObjectId) ([]Project, error)
- func (r *ProjectRepo) FindForUser(user User) (Projects, error)
- func (r *ProjectRepo) FindModifiableForUser(user User) (Projects, error)
- func (r *ProjectRepo) FindWithDocktorGroupURL() ([]Project, error)
- func (r *ProjectRepo) RemoveEntity(id string) error
- func (r *ProjectRepo) Save(project Project) (Project, error)
- func (r *ProjectRepo) UpdateDocktorGroupURL(id bson.ObjectId, docktorGroupURL, docktorGroupName string) error
- type Projects
- type Role
- type TechnicalData
- type Technology
- type TechnologyRepo
- type Translation
- type Translations
- type UsageIndicator
- type UsageIndicatorRepo
- func (r *UsageIndicatorRepo) BulkImport(usageIndicators []UsageIndicator) (BulkImportUsageIndicatorsResults, error)
- func (r *UsageIndicatorRepo) CreateIndexes() error
- func (r *UsageIndicatorRepo) FindAll() ([]UsageIndicator, error)
- func (r *UsageIndicatorRepo) FindAllFromGroup(docktorGroup string) ([]UsageIndicator, error)
- type User
- type UserRepo
- func (s *UserRepo) Delete(id bson.ObjectId) (bson.ObjectId, error)
- func (s *UserRepo) FindAll() ([]User, error)
- func (s *UserRepo) FindByID(id string) (User, error)
- func (s *UserRepo) FindByIDBson(id *bson.ObjectId) (User, error)
- func (s *UserRepo) FindByUsername(username string) (User, error)
- func (s *UserRepo) FindRIWithEntity(entitiesIDs []bson.ObjectId) ([]User, error)
- func (s *UserRepo) RemoveEntity(id bson.ObjectId) error
- func (s *UserRepo) Save(user User) (User, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrDatabaseNotInitialized occurs when the database is not initialized and no request can be executed ErrDatabaseNotInitialized = errors.New("Database is not initialized") // ErrInvalidUserID occurs when the user id is not a valid objectID Hex ErrInvalidUserID = errors.New("Invalid User ID") // ErrInvalidEntityID occurs when the entity id is not a valid objectID Hex ErrInvalidEntityID = errors.New("Invalid Entity ID") )
var Deployed = map[int]string{
-1: "no",
0: "yes",
}
Deployed maps the progress codes to their string representation
var Priority = map[int]string{
-1: "N/A",
0: "P0",
1: "P1",
2: "P2",
}
Priority maps the progress codes to their string representation
var Progress = map[int]string{
-1: "N/A",
0: "0%",
1: "20%",
2: "40%",
3: "60%",
4: "80%",
5: "100%",
}
Progress maps the progress codes to their string representation
Functions ¶
func BasicDelete ¶
BasicDelete is a basic delete of a collection document
func GetEntitiesIds ¶
GetEntitiesIds get ids of a slice of entities
Types ¶
type BulkImportUsageIndicatorsResults ¶
type BulkImportUsageIndicatorsResults struct { All int `json:"all"` // Number of usage indicators to import Imported int `json:"imported"` // Number of usage indicators actually imported (inserted or updated) InError int `json:"inError"` // Number of usage indicators not imported because an error happened Errors []IndicatorInError `json:"errors"` // Occurred errors and its details }
BulkImportUsageIndicatorsResults is the result of a bulk import of usage indicators
type DocktorURL ¶
type DocktorURL struct { DocktorGroupName string `bson:"docktorGroupName" json:"docktorGroupName"` DocktorGroupURL string `bson:"docktorGroupURL" json:"docktorGroupURL"` }
DocktorURL represents the url of the Docktor project linked to the DAD project
type Entity ¶
type Entity struct { ID bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"` Name string `bson:"name" json:"name"` Type EntityType `bson:"type" json:"type"` }
Entity represents an Sopra Steria entity
type EntityRepo ¶
type EntityRepo struct {
// contains filtered or unexported fields
}
EntityRepo wraps all requests to database for accessing entities
func NewEntityRepo ¶
func NewEntityRepo(database *mgo.Database) EntityRepo
NewEntityRepo creates a new entites repo from database This EntityRepo is wrapping all requests with database
func (*EntityRepo) Exists ¶
func (r *EntityRepo) Exists(name string) (bool, error)
Exists checks if an entity (name) already exists
func (*EntityRepo) FindAll ¶
func (r *EntityRepo) FindAll() ([]Entity, error)
FindAll get all entities from the database
func (*EntityRepo) FindAllByIDBson ¶
func (r *EntityRepo) FindAllByIDBson(ids []bson.ObjectId) ([]Entity, error)
FindAllByIDBson gets all the entities existing with ids
func (*EntityRepo) FindByID ¶
func (r *EntityRepo) FindByID(id string) (Entity, error)
FindByID get the entity by its id (string version)
func (*EntityRepo) FindByIDBson ¶
func (r *EntityRepo) FindByIDBson(id bson.ObjectId) (Entity, error)
FindByIDBson get the entity by its id (as a bson object)
type EntityType ¶
type EntityType string
EntityType identifies the type of the entity
const ( // BusinessUnitType is the type of entity for business units BusinessUnitType EntityType = "businessUnit" // ServiceCenterType is the type of entity for services centers ServiceCenterType EntityType = "serviceCenter" )
type ErrorMsg ¶
type ErrorMsg struct {
Message string `json:"message"`
}
ErrorMsg is a json formated error
type FunctionalService ¶
type FunctionalService struct { ID bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"` Name string `bson:"name" json:"name"` Translations Translations `bson:"translations" json:"translations"` Package string `bson:"package" json:"package"` Position int `bson:"position" json:"position"` Services []string `bson:"services" json:"services"` DeclarativeDeployment bool `bson:"declarativeDeployement" json:"declarativeDeployement"` }
FunctionalService represents the service
type FunctionalServiceRepo ¶
type FunctionalServiceRepo struct {
// contains filtered or unexported fields
}
FunctionalServiceRepo wraps all requests to database for accessing functional services
func NewFunctionalServiceRepo ¶
func NewFunctionalServiceRepo(database *mgo.Database) FunctionalServiceRepo
NewFunctionalServiceRepo creates a new entites repo from database This FunctionalServiceRepo is wrapping all requests with database
func (*FunctionalServiceRepo) Exists ¶
func (r *FunctionalServiceRepo) Exists(name, pkg string) (bool, error)
Exists checks if a functional service (name and package) already exists
func (*FunctionalServiceRepo) FindAll ¶
func (r *FunctionalServiceRepo) FindAll() ([]FunctionalService, error)
FindAll get all functional services from the database
func (*FunctionalServiceRepo) FindByID ¶
func (r *FunctionalServiceRepo) FindByID(id string) (FunctionalService, error)
FindByID get the functional service by its id (string version)
func (*FunctionalServiceRepo) FindByIDBson ¶
func (r *FunctionalServiceRepo) FindByIDBson(id bson.ObjectId) (FunctionalService, error)
FindByIDBson get the functional service by its id (as a bson object)
func (*FunctionalServiceRepo) FindFunctionalServicesDeployByServices ¶
func (r *FunctionalServiceRepo) FindFunctionalServicesDeployByServices(services []string) ([]FunctionalService, error)
FindFunctionalServicesDeployByServices find all functional services associated to
func (*FunctionalServiceRepo) Save ¶
func (r *FunctionalServiceRepo) Save(functionalService FunctionalService) (FunctionalService, error)
Save updates or create the functional service in database
type IndicatorInError ¶
type IndicatorInError struct { Indicator UsageIndicator `json:"indicator"` Message string `json:"message"` Index int `json:"index"` // Index of usage indicator in error, in original slice }
IndicatorInError represents an indicator that could not be imported because an error occurred
type IsCollection ¶
type IsCollection interface {
// contains filtered or unexported methods
}
IsCollection is an interface representing a collection accessing mongod documents
type IsCollectionWithIndexes ¶
type IsCollectionWithIndexes interface { IsCollection CreateIndexes() error }
IsCollectionWithIndexes is an interface representing a collection which needs indexes to be created
type IsDocument ¶
IsDocument is an interface representing a data being in a collection in Mongo
type Language ¶
type Language struct { ID bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"` LanguageCode string `bson:"languagecode" json:"languagecode"` }
Language object which contain the language code (as id)
type LanguageRepo ¶
type LanguageRepo struct {
// contains filtered or unexported fields
}
LanguageRepo wraps all requests to database for accessing languages
func NewLanguageRepo ¶
func NewLanguageRepo(database *mgo.Database) LanguageRepo
NewLanguageRepo creates a new languages repo from database This LanguageRepo is wrapping languages with database
func (*LanguageRepo) Exists ¶
func (r *LanguageRepo) Exists(languagecode string) (bool, error)
Exists checks if a language (languagecode) already exists
func (*LanguageRepo) FindAll ¶
func (r *LanguageRepo) FindAll() (Languages, error)
FindAll get all languages from the database
type MatrixLine ¶
type MatrixLine struct { Service bson.ObjectId `bson:"service" json:"service"` Deployed string `bson:"deployed,omitempty" json:"deployed,omitempty"` Progress int `bson:"progress" json:"progress"` Goal int `bson:"goal" json:"goal"` Priority string `bson:"priority,omitempty" json:"priority,omitempty"` DueDate *time.Time `bson:"dueDate,omitempty" json:"dueDate,omitempty"` Comment string `bson:"comment" json:"comment"` }
MatrixLine represents information of a depending on the functional service
type Project ¶
type Project struct { ID bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"` Name string `bson:"name" json:"name"` Description string `bson:"description" json:"description"` Domain []string `bson:"domain" json:"domain"` Client string `bson:"client" json:"client"` ProjectManager string `bson:"projectManager" json:"projectManager"` Deputies []string `bson:"deputies" json:"deputies"` BusinessUnit string `bson:"businessUnit" json:"businessUnit"` ServiceCenter []string `bson:"serviceCenter" json:"serviceCenter"` DocktorURL `bson:"docktorURL" json:""` // json is an empty string because we want to flatten the object to avoid client-side null-checks TechnicalData `bson:"technicalData" json:""` // json is an empty string because we want to flatten the object to avoid client-side null-checks Matrix Matrix `bson:"matrix" json:"matrix"` Created time.Time `bson:"created" json:"created"` Updated time.Time `bson:"updated" json:"updated"` }
Project represents a Sopra Steria project
type ProjectRepo ¶
type ProjectRepo struct {
// contains filtered or unexported fields
}
ProjectRepo wraps all requests to database for accessing entities
func NewProjectRepo ¶
func NewProjectRepo(database *mgo.Database) ProjectRepo
NewProjectRepo creates a new projects repo from database This ProjectRepo is wrapping all requests with database
func (*ProjectRepo) FindAll ¶
func (r *ProjectRepo) FindAll() ([]Project, error)
FindAll get all projects from the database
func (*ProjectRepo) FindByEntities ¶
func (r *ProjectRepo) FindByEntities(ids []bson.ObjectId) ([]Project, error)
FindByEntities get all projects with a matching businessUnit or serviceCenter
func (*ProjectRepo) FindByID ¶
func (r *ProjectRepo) FindByID(id string) (Project, error)
FindByID get the project by its id (string version)
func (*ProjectRepo) FindByIDBson ¶
func (r *ProjectRepo) FindByIDBson(id bson.ObjectId) (Project, error)
FindByIDBson get the project by its id (as a bson object)
func (*ProjectRepo) FindByName ¶
func (r *ProjectRepo) FindByName(name string) (Project, error)
FindByName find a project by its name (case insensitive)
func (*ProjectRepo) FindByProjectManagerOrDeputy ¶
func (r *ProjectRepo) FindByProjectManagerOrDeputy(id bson.ObjectId) ([]Project, error)
FindByProjectManagerOrDeputy get all projects with a specific project manager or deputy
func (*ProjectRepo) FindForUser ¶
func (r *ProjectRepo) FindForUser(user User) (Projects, error)
FindForUser returns the projects associated to a user, handling their rights
func (*ProjectRepo) FindModifiableForUser ¶
func (r *ProjectRepo) FindModifiableForUser(user User) (Projects, error)
FindModifiableForUser returns the projects associated to a user, but only projects which are modifiable by him
func (*ProjectRepo) FindWithDocktorGroupURL ¶
func (r *ProjectRepo) FindWithDocktorGroupURL() ([]Project, error)
FindWithDocktorGroupURL returns the projects with a no empty docktor group url
func (*ProjectRepo) RemoveEntity ¶
func (r *ProjectRepo) RemoveEntity(id string) error
RemoveEntity removes an entity (businessUnit or serviceCenter) from a project This is used for cascade deletions
func (*ProjectRepo) Save ¶
func (r *ProjectRepo) Save(project Project) (Project, error)
Save updates or create the functional service in database
func (*ProjectRepo) UpdateDocktorGroupURL ¶
func (r *ProjectRepo) UpdateDocktorGroupURL(id bson.ObjectId, docktorGroupURL, docktorGroupName string) error
UpdateDocktorGroupURL updates Docktor Group URL to project in database
type Role ¶
type Role string
Role identifies global rights of connected user
const ( // AdminRole is an administrator role who can do anything AdminRole Role = "admin" // RIRole is a role who can see projects by entities RIRole Role = "ri" // PMRole is a role who can see projects PMRole Role = "pm" // DeputyRole is a substitute role of the PMRole with the same rights DeputyRole Role = "deputy" )
func DefaultRole ¶
func DefaultRole() Role
DefaultRole return the default role of user when he registers
type TechnicalData ¶
type TechnicalData struct { Technologies []string `bson:"technologies" json:"technologies"` Mode string `bson:"mode" json:"mode"` DeliverablesInVersionControl bool `bson:"deliverables" json:"deliverables"` SpecificationsInVersionControl bool `bson:"specifications" json:"specifications"` SourceCodeInVersionControl bool `bson:"sourceCode" json:"sourceCode"` VersionControlSystem string `bson:"versionControlSystem" json:"versionControlSystem"` IsCDKApplicable bool `bson:"isCDKApplicable" json:"isCDKApplicable"` Explanation string `bson:"explanation" json:"explanation"` }
TechnicalData contains the technical data of a project
type Technology ¶
type Technology struct { ID bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"` Name string `bson:"name" json:"name"` }
Technology represents a technology (ie. programming language, software suite, etc.)
type TechnologyRepo ¶
type TechnologyRepo struct {
// contains filtered or unexported fields
}
TechnologyRepo wraps all requests to database for accessing technologies
func NewTechnologyRepo ¶
func NewTechnologyRepo(database *mgo.Database) TechnologyRepo
NewTechnologyRepo creates a new technologies repo from database This TechnologyRepo is wrapping all requests with database
func (*TechnologyRepo) Exists ¶
func (r *TechnologyRepo) Exists(name string) (bool, error)
Exists checks if a technology (name) already exists
func (*TechnologyRepo) FindAll ¶
func (r *TechnologyRepo) FindAll() ([]Technology, error)
FindAll get all technologies from the database
func (*TechnologyRepo) Save ¶
func (r *TechnologyRepo) Save(technology Technology) (Technology, error)
Save updates or creates the technology in database
type Translation ¶
type Translation struct { LanguageCode string `bson:"languagecode" json:"languagecode"` Translation string `bson:"translation" json:"translation"` }
Translation object contain the language code (as id) and the translation
type UsageIndicator ¶
type UsageIndicator struct { ID bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"` // Name of the Docktor Group, owner of the service instance which generated this indicator DocktorGroup string `bson:"docktorGroup" json:"docktorGroup,omitempty"` // Name of the service generating the indicator. e.g. jenkins Service string `bson:"service,omitempty" json:"service,omitempty"` // Name of the instance of service generating the indicator. e.g. GROUP1-jenkins ServiceInstanceName string `bson:"serviceInstance" json:"serviceInstance,omitempty"` // Indicator status of the service instance. e.g. active, inactive, undetermined... Status string `bson:"status,omitempty" json:"status,omitempty"` // Date when the indicator was last updated Updated time.Time `bson:"updated,omitempty" json:"updated,omitempty"` }
UsageIndicator represents a Sopra Steria entity
type UsageIndicatorRepo ¶
type UsageIndicatorRepo struct {
// contains filtered or unexported fields
}
UsageIndicatorRepo wraps all requests to database for accessing usage indicators
func NewUsageIndicatorRepo ¶
func NewUsageIndicatorRepo(database *mgo.Database) UsageIndicatorRepo
NewUsageIndicatorRepo creates a new usage indicators repo from database This UsageIndicatorRepo is wrapping all requests with database
func (*UsageIndicatorRepo) BulkImport ¶
func (r *UsageIndicatorRepo) BulkImport(usageIndicators []UsageIndicator) (BulkImportUsageIndicatorsResults, error)
BulkImport imports a list of indicators usages It updates existing indicators (with given service and Docktor group name), or create new ones.
func (*UsageIndicatorRepo) CreateIndexes ¶
func (r *UsageIndicatorRepo) CreateIndexes() error
CreateIndexes creates Index
func (*UsageIndicatorRepo) FindAll ¶
func (r *UsageIndicatorRepo) FindAll() ([]UsageIndicator, error)
FindAll get all usage indicators from the database
func (*UsageIndicatorRepo) FindAllFromGroup ¶
func (r *UsageIndicatorRepo) FindAllFromGroup(docktorGroup string) ([]UsageIndicator, error)
FindAllFromGroup get all usage indicators with a given Docktor group
type User ¶
type User struct { ID bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"` FirstName string `bson:"firstName" json:"firstName"` LastName string `bson:"lastName" json:"lastName"` DisplayName string `bson:"displayName" json:"displayName"` Username string `bson:"username" json:"username"` Email string `bson:"email" json:"email"` Role Role `bson:"role" json:"role"` Created time.Time `bson:"created" json:"created"` Updated time.Time `bson:"updated" json:"updated"` Entities []bson.ObjectId `bson:"entities" json:"entities"` }
User model
func (User) HasValidRole ¶
HasValidRole checks the user has a known role
func (User) IsAdmin ¶
IsAdmin checks that the user is an admin, meaning he can do anything on the application.
func (User) IsPMOrDeputy ¶
IsPMOrDeputy checks that the user is a PM or a Deputy
type UserRepo ¶
type UserRepo struct {
// contains filtered or unexported fields
}
UserRepo wraps all requests to database for accessing users
func NewUserRepo ¶
func NewUserRepo(database *mgo.Database) UserRepo
NewUserRepo creates a new user repo from database This UserRepo is wrapping all requests with database
func (*UserRepo) FindByIDBson ¶
FindByIDBson get the user by its id (as a bson object)
func (*UserRepo) FindByUsername ¶
FindByUsername finds the user with given username
func (*UserRepo) FindRIWithEntity ¶
FindRIWithEntity finds RI whose matching with serviceCenter and/or businessUnit IDs
func (*UserRepo) RemoveEntity ¶
RemoveEntity removes an entity from a user This is used for cascade deletions