models

package
v1.0.45 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Choice added in v0.1.8

type Choice struct {
	// ID is the primary key.
	ID int `json:"id" gorm:"primary_key" form:"id" query:"id" params:"id" validate:"required"`
	// Ref is the choice reference.
	Ref QuestionRef `json:"ref"`
	// Title is the choice title.
	Title string `json:"title"`
	// Description is the choice description.
	Description string `json:"description"`
	// QuestionID is the question ID.
	QuestionID int `json:"question_id"`
	// CreatedAt ...
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt ...
	UpdatedAt time.Time `json:"updated_at"`
	// DeletedAt ...
	DeletedAt gorm.DeletedAt `json:"deleted_at" gore:"index"`
}

Choice is a model for a choice.

type Design added in v0.1.9

type Design struct {
	// ID is the primary key
	ID uuid.UUID `json:"id" gorm:"type:uuid;primary_key;default:gen_random_uuid()" params:"id"`
	// Title of the design
	Title string `json:"title" form:"title" validate:"required,min=3,max=255"`
	// Body of the design in markdown, HTML, or plain text
	Body string `form:"body" gorm:"type:text"`
	// Tags are the tags associated with the environment
	Tags []Tag `json:"tags" gorm:"many2many:design_tags;"`
	// Reactions are the reactions associated with the design
	Reactions []Reaction `json:"reactions" gorm:"polymorphicType:ReactableType;polymorphicId:ReactableID;polymorphicValue:design"`
	// AuthorID is the foreign key to the author
	AuthorID uuid.UUID `json:"author_id"`
	// Author is the author
	Author adapters.GothUser `json:"author" gorm:"foreignKey:AuthorID;references:ID"`
	// Workable is the workable
	Workable *Workable `json:"workable" gorm:"polymorphic:Workable;polymorphic_value:design"`
	// Comments are the comments associated with the design
	Comments []DesignComment `json:"comments"`
	// CreatedAt ...
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt ...
	UpdatedAt time.Time `json:"updated_at"`
	// DeletedAt ...
	DeletedAt gorm.DeletedAt `json:"deleted_at" gore:"index"`
}

Design ...

func (*Design) GetReactionsByValue added in v0.1.24

func (d *Design) GetReactionsByValue() map[string][]Reaction

GetReactionsByValue ...

type DesignComment added in v0.1.9

type DesignComment struct {
	// ID is the primary key
	ID uuid.UUID `json:"id" gorm:"type:uuid;primary_key;default:gen_random_uuid()" params:"id"`
	// DesignID is the foreign key to the design
	DesignID uuid.UUID `json:"design_id" gorm:"type:uuid;index" params:"id"`
	// Design is the design
	Design Design `json:"design" gorm:"foreignKey:DesignID;references:ID" validate:"-"`
	// Comment is the comment
	Comment string `json:"comment" form:"comment" gorm:"type:text" validate:"required,min=3"`
	// AuthorID is the foreign key to the author
	AuthorID uuid.UUID `json:"author_id"`
	// Author is the author
	Author adapters.GothUser `json:"author" gorm:"foreignKey:AuthorID;references:ID"`
	// ParentID is the foreign key to the parent comment
	ParentID *uuid.UUID `json:"parent_id" gorm:"type:uuid;index" params:"parent_id"`
	// Parent is the parent comment
	Parent *DesignComment `json:"parent" gorm:"foreignKey:ParentID;references:ID"`
	// Reactions are the reactions associated with the design comment
	Reactions []Reaction `json:"reactions" gorm:"polymorphicType:ReactableType;polymorphicId:ReactableID;polymorphicValue:design_comment"`
	// CreatedAt ...
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt ...
	UpdatedAt time.Time `json:"updated_at"`
	// DeletedAt ...
	DeletedAt gorm.DeletedAt `json:"deleted_at" gore:"index"`
}

DesignComment ...

func (*DesignComment) GetReactionsByValue added in v0.1.24

func (d *DesignComment) GetReactionsByValue() map[string][]Reaction

GetReactionsByValue ...

type DesignCommentRevision added in v0.1.9

type DesignCommentRevision struct {
	// ID is the primary key
	ID uuid.UUID `json:"id" gorm:"type:uuid;primary_key;default:gen_random_uuid()" params:"id"`
	// DesignCommentID is the foreign key to the design comment
	DesignCommentID uuid.UUID `json:"design_comment_id" gorm:"type:uuid;index" params:"design_comment_id"`
	// DesignComment is the design comment
	DesignComment DesignComment `json:"design_comment" gorm:"foreignKey:DesignCommentID;references:ID"`
	// Comment is the comment
	Comment string `json:"comment" form:"comment" gorm:"type:text" validate:"required,min=3"`
	// CreatedAt ...
	CreatedAt time.Time `json:"created_at"`
}

DesignCommentRevision ...

type DesignRevision added in v0.1.9

type DesignRevision struct {
	// ID is the primary key
	ID uuid.UUID `json:"id" gorm:"type:uuid;primary_key;default:gen_random_uuid()" params:"id"`
	// DesignID is the foreign key to the design
	DesignID uuid.UUID `json:"design_id" gorm:"type:uuid;index" params:"design_id"`
	// Design is the design
	Design Design `json:"design" gorm:"foreignKey:DesignID;references:ID"`
	// Title of the design revision
	Title string `json:"title" form:"title" validate:"required,min=3,max=1024"`
	// Reactions are the reactions associated with the design
	Reactions []Reaction `json:"reactions" gorm:"polymorphic:Reactable;"`
	// Body of the design in markdown, HTML, or plain text
	Body string `gorm:"type:text"`
	// CreatedAt ...
	CreatedAt time.Time `json:"created_at"`
}

DesignRevision ...

type Environment added in v0.1.8

type Environment struct {
	// ID is the primary key
	ID uuid.UUID `json:"id" gorm:"type:uuid;primary_key;default:gen_random_uuid()" params:"id"`
	// Name of the environment
	Name string `json:"name" form:"name" validate:"required,min=3,max=255"`
	// Description of the environment
	Description string `json:"description" form:"description" validate:"max=1024"`
	// Tags are the tags associated with the environment
	Tags []Tag `json:"tags" gorm:"many2many:environment_tags;"`
	// CreatedAt ...
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt ...
	UpdatedAt time.Time `json:"updated_at"`
	// DeletedAt ...
	DeletedAt gorm.DeletedAt `json:"deleted_at" gore:"index"`
}

Environment ...

type Lens added in v0.1.8

type Lens struct {
	// ID is the primary key.
	ID uuid.UUID `json:"id" gorm:"type:uuid;primary_key;default:gen_random_uuid()"`
	// Version is the lens version.
	Version int `json:"version" gorm:"uniqueIndex:idx_lens_name_version_team"`
	// Name is the lens name.
	Name string `json:"name" gorm:"many2many:taggables;uniqueIndex:idx_lens_name_version_team"`
	// Description is the lens description.
	Description string `json:"description"`
	// Pillars are the lens pillars.
	Pillars []Pillar `json:"pillars"`
	// IsDraft is the lens draft status.
	IsDraft bool `json:"is_draft"`
	// Tags are the tags associated with the lens.
	Tags []Tag `json:"tags" gorm:"many2many:lens_tags;"`
	// CreatedAt ...
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt ...
	UpdatedAt time.Time `json:"updated_at"`
	// DeletedAt ...
	DeletedAt gorm.DeletedAt `json:"deleted_at" gore:"index"`
}

Lens is a model for a lens.

func (*Lens) GetPillars added in v0.1.8

func (l *Lens) GetPillars() []*Pillar

GetPillars ...

func (*Lens) GetQuestions added in v0.1.27

func (l *Lens) GetQuestions() []Question

GetQuestions ...

func (*Lens) TotalPillars added in v1.0.38

func (l *Lens) TotalPillars() int

TotalPillars ...

func (*Lens) TotalQuestions added in v1.0.38

func (l *Lens) TotalQuestions() int

TotalQuestions ...

func (*Lens) UnmarshalJSON added in v0.1.8

func (l *Lens) UnmarshalJSON(data []byte) error

UnmarshalJSON ...

type Ownable added in v0.1.19

type Ownable struct {
	// ID is the primary key of the workable
	ID int `json:"id" gorm:"primary_key;type:bigint;auto_increment;not null"`
	// OwnableID  is the foreign key of the ownable
	OwnableID uuid.UUID `json:"ownable_id" gorm:"type:uuid;not null"`
	// OwnableType is the type of the ownable
	OwnableType OwnableType `json:"ownable_type" gorm:"type:varchar(255);not null"`
	// OwnerID is the foreign key of the owner
	OwnerID uuid.UUID `json:"owner_id" gorm:"type:uuid;not null"`
	// OwnerType is the type of the owner
	OwnerType OwnerType `json:"owner_type" gorm:"type:varchar(255);not null"`
}

Ownable is the interface for the ownable

type OwnableType added in v0.1.19

type OwnableType string

OwnableType ...

var OwnableTypeTemplate OwnableType = "template"

OwnableTypeTemplate is the template ownable type

type OwnerType added in v0.1.19

type OwnerType string

OwnerType ...

var (
	// OwnerTypeUser is the user owner type
	OwnerTypeUser OwnerType = "user"
	// OwnerTypeTeam is the team owner type
	OwnerTypeTeam OwnerType = "team"
)

type Pillar added in v0.1.8

type Pillar struct {
	// ID is the primary key.
	ID int `json:"id" gorm:"primary_key"`
	// Name is the lens pillar name.
	Name string `json:"name"`
	// Description is the lens pillar description.
	Description string `json:"description"`
	// Questions are the lens pillar questions.
	Questions []Question `json:"questions"`
	// Resources are the lens pillar resources.
	Resources []Resource `json:"resources" gorm:"many2many:pillar_resources;"`
	// LensID is the lens ID.
	LensID uuid.UUID `json:"lens_id"`
	// CreatedAt ...
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt ...
	UpdatedAt time.Time `json:"updated_at"`
	// DeletedAt ...
	DeletedAt gorm.DeletedAt `json:"deleted_at" gore:"index"`
}

Pillar is a model for a pillar.

func (*Pillar) GetQuestions added in v0.1.8

func (p *Pillar) GetQuestions() []*Question

GetQuestions ...

type Profile

type Profile struct {
	// ID ...
	ID uuid.UUID `json:"id" gorm:"type:uuid;primary_key;default:gen_random_uuid()" query:"id" params:"id"`
	// Name of the profile.
	Name string `json:"name" form:"name" validate:"required,min=3,max=100"`
	// Description of the profile.
	Description string `json:"description" form:"description" validate:"required,min=3,max=1024"`
	// Answers are the possible answers for the question.
	Answers []ProfileQuestionAnswer `json:"answers" form:"answers" gorm:"many2many:profiles_answers;"`
	// Tags ...
	Tags []Tag `json:"tags" gorm:"many2many:profile_tags;"`
	// CreatedAt ...
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt ...
	UpdatedAt time.Time `json:"updated_at"`
	// DeletedAt ...
	DeletedAt gorm.DeletedAt `json:"deleted_at"`
}

Profile represents a business profile.

func (*Profile) GetAnswers added in v0.1.8

func (p *Profile) GetAnswers() []*ProfileQuestionAnswer

GetAnswers returns the answers of the profile.

func (*Profile) IsChoosen added in v0.1.8

func (p *Profile) IsChoosen(id int) bool

IsChoosen returns true if the question is answered.

type ProfileQuestion

type ProfileQuestion struct {
	// ID is the identifier of the question.
	ID int `json:"id" gorm:"primary_key"`
	// Title is the title of the question.
	Title string `json:"title" form:"title" validate:"required,min=3,max=100"`
	// Description is the description of the question.
	Description string `json:"description" form:"description" validate:"required,min=3,max=1024"`
	// MultipleChoice is a flag to indicate if the question is multiple choice.
	MulipleChoice bool `json:"multiple_choice" form:"multiple_choice" validate:"required"`
	// Choices are the possible choices for the question.
	Choices []ProfileQuestionChoice `json:"choices" form:"choices"`
	// CreatedAt ...
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt ...
	UpdatedAt time.Time `json:"updated_at"`
	// DeletedAt ...
	DeletedAt gorm.DeletedAt `json:"deleted_at"`
}

Question represents a business profile question.

func (*ProfileQuestion) GetChoices added in v0.1.8

func (q *ProfileQuestion) GetChoices() []*ProfileQuestionChoice

GetChoices returns the choices of the question.

type ProfileQuestionAnswer

type ProfileQuestionAnswer struct {
	// ID is the identifier of the answer.
	ID int `json:"id" gorm:"primary_key" form:"id"`
	// Choice is the choice of the answer.
	Choice ProfileQuestionChoice `json:"choice" gorm:"foreignkey:ChoiceID;"`
	// ChoiceID is the identifier of the choice.
	ChoiceID int `json:"choice_id"`
	// CreatedAt ...
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt ...
	UpdatedAt time.Time `json:"updated_at"`
	// DeletedAt ...
	DeletedAt gorm.DeletedAt `json:"deleted_at"`
}

ProfileQuestionAnswer represents a business profile question answer.

type ProfileQuestionChoice added in v0.1.8

type ProfileQuestionChoice struct {
	// ID is the identifier of the choice.
	ID int `json:"id" gorm:"primary_key"`
	// Ref is the reference of the choice.
	Ref QuestionRef `json:"ref"`
	// Title is the title of the choice.
	Title string `json:"title"`
	// Description is the description of the choice.
	Description string `json:"description"`
	// ProfileQuestion is the question of the choice.
	ProfileQuestion ProfileQuestion `json:"profile_question" gorm:"foreignkey:ProfileQuestionID;"`
	// ProfileQuestionID is the identifier of the question.
	ProfileQuestionID int `json:"profile_question_id"`
	// CreatedAt ...
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt ...
	UpdatedAt time.Time `json:"updated_at"`
	// DeletedAt ...
	DeletedAt gorm.DeletedAt `json:"deleted_at"`
}

ProfileQuestionChoice is a model for a choice.

type Question added in v0.1.8

type Question struct {
	// ID is the primary key.
	ID int `json:"id" gorm:"primary_key" params:"question" query:"question"`
	// Ref is the question reference.
	Ref string `json:"ref"`
	// Title is the question title.
	Title string `json:"title"`
	// Description is the question description.
	Description string `json:"description"`
	// Resources are the question resources.
	Resources []Resource `json:"resources" gorm:"many2many:question_resources;"`
	// Choices are the question choices.
	Choices []Choice `json:"choices"`
	// Risks are the question risks.
	Risks []Risk `json:"risks"`
	// PillarID is the pillar ID.
	PillarID int `json:"pillar_id"`
	// CreatedAt ...
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt ...
	UpdatedAt time.Time `json:"updated_at"`
	// DeletedAt ...
	DeletedAt gorm.DeletedAt `json:"deleted_at" gore:"index"`
}

Question is a model for a question.

type QuestionRef added in v0.1.8

type QuestionRef string

QuestionRef is a question reference.

const (
	// NoneOfTheseQuestionRef is a question reference for none of these.
	NoneOfTheseQuestionRef QuestionRef = "none_of_these"
)

func (QuestionRef) String added in v0.1.8

func (q QuestionRef) String() string

String is a string representation of a question reference.

type ReactableType added in v0.1.9

type ReactableType string

ReactableType ...

const (
	// ReactableTypeDesign ...
	ReactableTypeDesign ReactableType = "design"
	// ReactableTypeDesignComment ...
	ReactableTypeDesignComment ReactableType = "design_comment"
)

type Reaction added in v0.1.9

type Reaction struct {
	// ID is the primary key.
	ID int `json:"id" gorm:"type:bigint;primaryKey;unique;autoIncrement"`
	// ReactableID is the ID of the reactable
	ReactableID uuid.UUID `json:"reactable_id" unique_index:"idx_reactable_id_reactable_type_reactor_id"`
	// ReactableType is the type of the taggable
	ReactableType ReactableType `json:"reactable_type" unique_index:"idx_reactable_id_reactable_type_reactor_id"`
	// Value is the value of the reaction
	Value string `json:"value"`
	// ReactorID is the ID of the reactor
	ReactorID uuid.UUID `json:"reactor_id" unique_index:"idx_reactable_id_reactable_type_reactor_id"`
	// Reactor is the reactor
	Reactor adapters.GothUser `json:"reactor" gorm:"foreignKey:ReactorID;references:ID"`
	// CreatedAt ...
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt ...
	UpdatedAt time.Time `json:"updated_at"`
	// DeletedAt ...
	DeletedAt gorm.DeletedAt `json:"deleted_at"`
}

Reaction ...

type Resource added in v0.1.8

type Resource struct {
	// ID is the primary key.
	ID int `json:"id" gorm:"primary_key"`
	// URL is the URL of the resource.
	URL string `json:"url"`
	// Description is the description of the resource.
	Description string `json:"description"`
	// CreatedAt ...
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt ...
	UpdatedAt time.Time `json:"updated_at"`
	// DeletedAt ...
	DeletedAt gorm.DeletedAt `json:"deleted_at" gore:"index"`
}

Resource is a model for a resource.

type Risk added in v0.1.8

type Risk struct {
	// ID is the primary key.
	ID int `json:"id" gorm:"primary_key"`
	// Ref is the risk reference.
	Ref string `json:"ref"`
	// Title is the risk title.
	Risk string `json:"risk"`
	// Condition is the risk condition.
	Condition string `json:"condition"`
	// QuestionID is the question ID.
	QuestionID int `json:"question_id"`
	// CreatedAt ...
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt ...
	UpdatedAt time.Time `json:"updated_at"`
	// DeletedAt ...
	DeletedAt gorm.DeletedAt `json:"deleted_at" gore:"index"`
}

Risk is a model for a risk.

type Tag added in v0.1.8

type Tag struct {
	// ID ...
	ID uuid.UUID `json:"id" gorm:"type:uuid;primary_key;default:gen_random_uuid()"`
	// Name is the tag name.
	Name string `json:"name" gorm:"uniqueIndex:idx_name_value"`
	// Value is the tag value.
	Value string `json:"value" gorm:"uniqueIndex:idx_name_value"`
	// CreatedAt ...
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt ...
	UpdatedAt time.Time `json:"updated_at"`
	// DeletedAt ...
	DeletedAt gorm.DeletedAt `json:"deleted_at"`
}

Tag ...

type Template added in v0.1.19

type Template struct {
	// ID is the primary key
	ID uuid.UUID `json:"id" gorm:"type:uuid;primary_key;default:gen_random_uuid()" params:"id"`
	// Name of the template
	Name string `json:"name" form:"name" validate:"required,min=3,max=1024"`
	// Description of the template
	Description string `json:"description" form:"description" gorm:"type:text" validate:"required,min=3"`
	// Body of the template in markdown, HTML, or plain text
	Body string `json:"body" gorm:"type:text"`
	// CreatedAt ...
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt ...
	UpdatedAt time.Time `json:"updated_at"`
	// DeletedAt ...
	DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
}

Template ...

func NewTemplate added in v0.1.19

func NewTemplate() *Template

NewTemplate ...

type Workable added in v0.1.16

type Workable struct {
	// ID is the primary key of the workable
	ID int `json:"id" gorm:"primary_key;type:bigint;auto_increment;not null"`
	// WorkableID is the foreign key of the workable
	WorkableID uuid.UUID `json:"workable_id" gorm:"type:uuid;not null"`
	// WorkableType is the type of the workable
	WorkableType WorkableType `json:"workable_type" gorm:"type:varchar(255);not null"`
	// WorkflowTransitionID is the foreign key of the workflow transition
	WorkflowTransitionID int `json:"workflow_transition_id" gorm:"type:bigint"`
	// WorkflowTransition is the workflow transition of the workable
	WorkflowTransition WorkflowTransition `json:"workflow_transition" gorm:"foreignKey:WorkflowTransitionID;references:ID"`
}

Workable is model that can be used with a workflow

type WorkableType added in v0.1.16

type WorkableType string

WorkableType is the type of the workable

const (
	// WorkableTypeDesign is the design workable type
	WorkableTypeDesign WorkableType = "design"
)

type Workflow added in v0.1.16

type Workflow struct {
	// ID ...
	ID uuid.UUID `json:"id" gorm:"type:uuid;primary_key;default:gen_random_uuid()"`
	// Name is the name of the workflow
	Name string `json:"name" gorm:"type:varchar(255);unique_index"`
	// Description is the description of the workflow
	Description string `json:"description" gorm:"type:text"`
	// States is the list of states in the workflow
	States []WorkflowState `json:"states" gorm:"foreignKey:WorkflowID;references:ID"`
	// CreatedAt is the created at field
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt is the updated at field
	UpdatedAt time.Time `json:"updated_at"`
	// DeletedAt is the soft delete field
	DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
}

Workflow a workflow that can be used to manage the state of a model

func (Workflow) GetStates added in v0.1.24

func (w Workflow) GetStates() []WorkflowState

GetStates returns the states of the workflow

type WorkflowState added in v0.1.16

type WorkflowState struct {
	// ID is the primary key of the workflow status
	ID int `json:"id" gorm:"primary_key;type:bigint;auto_increment;not null"`
	// WorkflowID is the foreign key of the workflow
	WorkflowID uuid.UUID `json:"workflow_id" gorm:"type:uuid;idx_workflow_state"`
	// Name is the name of the workflow status
	Name string `json:"name" gorm:"type:varchar(255);unique_index:idx_workflow_state"`
	// Description is the description of the workflow status
	Description string `json:"description" gorm:"type:text"`
	// Order is the order of the state in the workflow
	Order int `json:"order" gorm:"type:int"`
	// CreatedAt is the created at field
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt is the updated at field
	UpdatedAt time.Time `json:"updated_at"`
	// DeletedAt is the soft delete field
	DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
}

WorkflowState is the model for the workflow_state table

type WorkflowTransition added in v0.1.16

type WorkflowTransition struct {
	// ID is the primary key of the workflow transition
	ID int `json:"id" gorm:"primary_key;type:bigint;auto_increment;not null"`
	// WorkflowID is the foreign key of the workflow
	WorkflowID uuid.UUID `json:"workflow_id" gorm:"type:uuid;not null"`
	// Workflow is the workflow of the transition
	Workflow Workflow `json:"workflow" gorm:"foreignKey:WorkflowID;references:ID"`
	// CurrentStateID is the foreign key of the current state
	CurrentStateID int `json:"current_state_id" gorm:"type:bigint;not null"`
	// CurrentState is the current state of the transition
	CurrentState WorkflowState `json:"current_state" gorm:"foreignKey:CurrentStateID;references:ID"`
	// CreatedAt is the created at field
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt is the updated at field
	UpdatedAt time.Time `json:"updated_at"`
	// DeletedAt is the soft delete field
	DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
}

WorkflowTransition is the model for the workflow_transition table

type Workload added in v0.1.8

type Workload struct {
	// ID ...
	ID uuid.UUID `json:"id" gorm:"type:uuid;primary_key;default:gen_random_uuid()"`
	// Name adds a name to the workload.
	Name string `json:"name" form:"name" validate:"required,min=1,max=255"`
	// Description adds a description to the workload.
	Description string `json:"description" form:"description" validate:"required,min=3,max=1024"`
	// ProfileID is the foreign key for the profile.
	ProfileID uuid.UUID `json:"profile_id" form:"profile_id" validate:"required,uuid"`
	Profile   Profile   `json:"profile" validate:"-"`
	// Lenses are the attached lenses
	Lenses []*Lens `json:"lenses" gorm:"many2many:workload_lenses;"`
	// EnvironmentID is the foreign key for the environment.
	EnvironmentID uuid.UUID   `json:"environment_id" form:"environment_id" validate:"required,uuid"`
	Environment   Environment `json:"environment" validate:"-"`
	// Answers are the attached answers
	Answers []*WorkloadLensQuestionAnswer `json:"answers" gorm:"foreignKey:WorkloadID;" form:"answers"`
	// Tags are the attached tags
	Tags []Tag `json:"tags" gorm:"many2many:workload_tags;"`
	// ReviewOwner is the owner of the review.
	ReviewOwner string `json:"review_owner" form:"review_owner" validate:"required,email"`
	// CreatedAt ...
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt ...
	UpdatedAt time.Time `json:"updated_at"`
	// DeletedAt ...
	DeletedAt gorm.DeletedAt `json:"deleted_at" gore:"index"`
}

Workload ...

func (*Workload) TotalAnswers added in v1.0.38

func (w *Workload) TotalAnswers() int

TotalAnswers ...

func (*Workload) TotalHighRisks added in v1.0.38

func (w *Workload) TotalHighRisks() int

TotalHighRisks ...

func (*Workload) TotalLenses added in v1.0.38

func (w *Workload) TotalLenses() int

TotalLenses ...

func (*Workload) TotalMediumRisks added in v1.0.38

func (w *Workload) TotalMediumRisks() int

TotalMediumRisks ...

func (*Workload) TotalQuestions added in v1.0.38

func (w *Workload) TotalQuestions() int

TotalQuestions ...

type WorkloadLensQuestionAnswer added in v0.1.8

type WorkloadLensQuestionAnswer struct {
	// ID is the primary key.
	ID int `json:"id" gorm:"primary_key"`
	// DoesNotApply is a flag to indicate if the question does not apply.
	DoesNotApply bool `json:"does_not_apply" form:"does_not_apply"`
	// DoesNotApplyReason is the reason the question does not apply.
	DoesNotApplyReason string `json:"does_not_apply_reason" form:"does_not_apply_reason" validate:"max=1024"`
	// Notes are additional notes.
	Notes string `json:"notes" form:"notes" validate:"max=2048"`
	// QuestionID is the foreign key for the question.
	QuestionID int `` /* 129-byte string literal not displayed */
	// Question is the question.
	Question Question `json:"question"`
	// LensID is the foreign key for the lens.
	LensID uuid.UUID `json:"lens_id" gorm:"uniqueIndex:idx_workload_lens_question_answer;" params:"lens" form:"lens_id" validate:"required,uuid"`
	// Lens is the lens.
	Lens Lens `json:"lens"`
	// WorkloadID is the foreign key for the workload.
	WorkloadID uuid.UUID `` /* 134-byte string literal not displayed */
	// Workload is the workload.
	Workload Workload `json:"workload" validate:"-"`
	// Choices are the selected choices.
	Choices []Choice `json:"choices" gorm:"many2many:workload_lens_question_answer_choices;" form:"choices"`
	// RiskID is the foreign key for the risk.
	RiskID *int `json:"risk_id" form:"risk_id" validate:"required"`
	// Risk is the risk associated with the answer.
	Risk *Risk `json:"risk" form:"risk"`
	// CreatedAt ...
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt ...
	UpdatedAt time.Time `json:"updated_at"`
	// DeletedAt ...
	DeletedAt gorm.DeletedAt `json:"deleted_at" gore:"index"`
}

WorkloadLensQuestionAnswer represents a business profile question answer.

func (*WorkloadLensQuestionAnswer) IsChecked added in v0.1.8

func (a *WorkloadLensQuestionAnswer) IsChecked(choiceID int) bool

IsChecked ...

Jump to

Keyboard shortcuts

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