add variable and method comments

This commit is contained in:
Mike Mason
2023-07-17 19:02:55 +00:00
parent 2681b3d064
commit bc87fa7726
35 changed files with 157 additions and 16 deletions

View File

@@ -11,6 +11,7 @@ import (
const projectEvent = "metalproject"
// buildProjectRelationships compiles all relations into a relationships object to be processed by the processors.
func (s *service) buildProjectRelationships(project *models.ProjectDetails) (Relationships, error) {
relations := Relationships{
Resource: project,
@@ -39,6 +40,7 @@ func (s *service) buildProjectRelationships(project *models.ProjectDetails) (Rel
return relations, nil
}
// IsProjectID checks if the provided id has the metal project prefix.
func (s *service) IsProjectID(id gidx.PrefixedID) bool {
if idType, ok := s.idPrefixMap[id.Prefix()]; ok {
return idType == TypeProject
@@ -47,6 +49,7 @@ func (s *service) IsProjectID(id gidx.PrefixedID) bool {
return false
}
// TouchProject initializes a sync for the provided project id for relationships and memberships.
func (s *service) TouchProject(ctx context.Context, id gidx.PrefixedID) error {
logger := s.logger.With("project.id", id.String())
@@ -77,6 +80,7 @@ func (s *service) TouchProject(ctx context.Context, id gidx.PrefixedID) error {
return nil
}
// DeleteProject deletes the provided project id.
func (s *service) DeleteProject(ctx context.Context, id gidx.PrefixedID) error {
err := s.publisher.PublishChange(ctx, projectEvent, events.ChangeMessage{
SubjectID: id,