entities

package
v0.0.0-...-a5db094 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProjectName = "projectName"
	SortField   = "sortField"
	Ascending   = "sortAscending"
	CreatedByMe = "createdByMe"
	Page        = "page"
	Limit       = "limit"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIStatus

type APIStatus struct {
	Status string `json:"status"`
}

APIStatus defines structure for APIroute status

type ApiToken

type ApiToken struct {
	UserID    string `bson:"user_id" json:"user_id"`
	Name      string `bson:"name" json:"name"`
	Token     string `bson:"token" json:"token"`
	ExpiresAt int64  `bson:"expires_at" json:"expires_at"`
	CreatedAt int64  `bson:"created_at" json:"created_at"`
}

ApiToken struct for storing API tokens

type ApiTokenInput

type ApiTokenInput struct {
	UserID              string `json:"user_id"`
	Name                string `json:"name"`
	DaysUntilExpiration int    `json:"days_until_expiration"`
}

ApiTokenInput struct for storing ApiTokenInput

type Audit

type Audit struct {
	UpdatedAt int64              `bson:"updated_at" json:"updatedAt"`
	CreatedAt int64              `bson:"created_at" json:"createdAt"`
	CreatedBy UserDetailResponse `bson:"created_by" json:"createdBy"`
	UpdatedBy UserDetailResponse `bson:"updated_by" json:"updatedBy"`
	IsRemoved bool               `bson:"is_removed" json:"isRemoved"`
}

type CreateProjectInput

type CreateProjectInput struct {
	ProjectName string    `bson:"project_name" json:"projectName"`
	UserID      string    `bson:"user_id" json:"userID"`
	Description *string   `bson:"description" json:"description"`
	Tags        []*string `bson:"tags" json:"tags"`
}

type DeleteApiTokenInput

type DeleteApiTokenInput struct {
	Token  string `json:"token"`
	UserID string `json:"userID"`
}

DeleteApiTokenInput struct for storing DeleteApiTokenInput

type DeleteProjectInput

type DeleteProjectInput struct {
	ProjectID string `json:"projectID"`
}

type Invitation

type Invitation string

Invitation defines the type of the invitation that is sent by the Owner of the project to other users

const (
	// PendingInvitation is the state when the Invitation is sent but not accepted
	PendingInvitation Invitation = "Pending"

	// AcceptedInvitation is the state when the Invitation is accepted
	AcceptedInvitation Invitation = "Accepted"

	// DeclinedInvitation is the state when the Invitation is rejected/declined
	DeclinedInvitation Invitation = "Declined"

	// ExitedProject is the state when the user has exited the project
	ExitedProject Invitation = "Exited"
)

type ListInvitationResponse

type ListInvitationResponse struct {
	ProjectID      string     `json:"projectID"`
	ProjectName    string     `json:"projectName"`
	ProjectOwner   Member     `json:"projectOwner"`
	InvitationRole MemberRole `json:"invitationRole"`
}

type ListProjectInputFilter

type ListProjectInputFilter struct {
	ProjectName     *string `json:"projectName"`
	CreatedByMe     *bool   `json:"createdByMe"`
	InvitedByOthers *bool   `json:"invitedByOthers"`
}

type ListProjectRequest

type ListProjectRequest struct {
	UserID     string                  `json:"userID"`
	Sort       *SortInput              `json:"sort,omitempty"`
	Filter     *ListProjectInputFilter `json:"filter,omitempty"`
	Pagination *Pagination             `json:"pagination,omitempty"`
}

type ListProjectResponse

type ListProjectResponse struct {
	Projects              []*Project `json:"projects"`
	TotalNumberOfProjects *int64     `json:"totalNumberOfProjects"`
}

type Member

type Member struct {
	UserID        string     `bson:"user_id" json:"userID"`
	Username      string     `bson:"username" json:"username"`
	Email         string     `bson:"email" json:"email"`
	Name          string     `bson:"name" json:"name"`
	Role          MemberRole `bson:"role" json:"role"`
	Invitation    Invitation `bson:"invitation" json:"invitation"`
	JoinedAt      int64      `bson:"joined_at" json:"joinedAt"`
	DeactivatedAt *int64     `bson:"deactivated_at,omitempty" json:"deactivatedAt,omitempty"`
}

Member contains the required fields to be stored in the database for a member

func (*Member) GetMemberOutput

func (member *Member) GetMemberOutput() *Member

GetMemberOutput takes a Member struct as input and returns the graphQL model equivalent

type MemberInput

type MemberInput struct {
	ProjectID string      `json:"projectID"`
	UserID    string      `json:"userID"`
	Role      *MemberRole `json:"role"`
}

type MemberRole

type MemberRole string

MemberRole defines the project role a member has in the project

const (
	RoleOwner    MemberRole = "Owner"
	RoleExecutor MemberRole = "Executor"
	RoleViewer   MemberRole = "Viewer"
)

type MemberStat

type MemberStat struct {
	Owner *[]Owner `bson:"owner" json:"owner"`
	Total int      `bson:"total" json:"total"`
}

type Members

type Members struct {
	Members []*Member `bson:"members" json:"members"`
}

type Owner

type Owner struct {
	UserID        string     `bson:"user_id" json:"userID"`
	Username      string     `bson:"username" json:"username"`
	Invitation    Invitation `bson:"invitation" json:"invitation"`
	JoinedAt      int64      `bson:"joined_at" json:"joinedAt"`
	DeactivatedAt *int64     `bson:"deactivated_at,omitempty" json:"deactivatedAt,omitempty"`
}

type Pagination

type Pagination struct {
	Page  int `json:"page"`
	Limit int `json:"limit"`
}

type Project

type Project struct {
	Audit       `bson:",inline"`
	ID          string    `bson:"_id" json:"projectID"`
	Name        string    `bson:"name" json:"name"`
	Members     []*Member `bson:"members" json:"members"`
	State       *string   `bson:"state" json:"state"`
	Tags        []*string `bson:"tags" json:"tags"`
	Description *string   `bson:"description" json:"description"`
}

Project contains the required fields to be stored in the database for a project

func (*Project) GetMemberOutput

func (project *Project) GetMemberOutput() []*Member

GetMemberOutput takes a Project struct as input and returns the graphQL model equivalent for a members of the project

func (*Project) GetProjectOutput

func (project *Project) GetProjectOutput() *Project

GetProjectOutput takes a Project struct as input and returns the graphQL model equivalent

type ProjectInput

type ProjectInput struct {
	ProjectID   string `bson:"project_id" json:"projectID"`
	ProjectName string `bson:"project_name" json:"projectName"`
}

type ProjectSortingField

type ProjectSortingField string
const (
	ProjectSortingFieldName ProjectSortingField = "NAME"
	ProjectSortingFieldTime ProjectSortingField = "TIME"
)

type ProjectStats

type ProjectStats struct {
	Name      string      `bson:"name" json:"name"`
	ProjectID string      `bson:"_id" json:"projectID"`
	Members   *MemberStat `bson:"memberStat" json:"members"`
}

type ResourceDetails

type ResourceDetails struct {
	Name        string   `bson:"name" json:"name"`
	Description string   `bson:"description" json:"description"`
	Tags        []string `bson:"tags" json:"tags"`
}

type RevokedToken

type RevokedToken struct {
	Token     string `bson:"token"`
	ExpiresAt int64  `bson:"expires_at"`
	CreatedAt int64  `bson:"created_at"`
}

RevokedToken struct for storing revoked tokens

type Role

type Role string

Role states the role of the user in the portal

const (
	// RoleAdmin gives the admin permissions to a user
	RoleAdmin Role = "admin"

	//RoleUser gives the normal user permissions to a user
	RoleUser Role = "user"
)

type SortInput

type SortInput struct {
	Field     *ProjectSortingField `json:"field"`
	Ascending *bool                `json:"ascending"`
}

type State

type State string
const (
	Accepted    State = "accepted"
	NotAccepted State = "not_accepted"
	All         State = "all"
)

type UpdateUserState

type UpdateUserState struct {
	Username     string `json:"username"`
	IsDeactivate *bool  `json:"isDeactivate"`
}

UpdateUserState defines structure to deactivate or reactivate user

type User

type User struct {
	Audit          `bson:",inline"`
	ID             string `bson:"_id,omitempty" json:"userID"`
	Username       string `bson:"username,omitempty" json:"username"`
	Password       string `bson:"password,omitempty" json:"password,omitempty"`
	Salt           string `bson:"salt" json:"salt"`
	Email          string `bson:"email,omitempty" json:"email,omitempty"`
	Name           string `bson:"name,omitempty" json:"name,omitempty"`
	Role           Role   `bson:"role,omitempty" json:"role"`
	DeactivatedAt  *int64 `bson:"deactivated_at,omitempty" json:"deactivatedAt,omitempty"`
	IsInitialLogin bool   `bson:"is_initial_login" json:"isInitialLogin"`
}

User contains the user information

func (*User) IsEmailValid

func (user *User) IsEmailValid(email string) bool

IsEmailValid validates the email

func (*User) SanitizedUser

func (user *User) SanitizedUser() *User

SanitizedUser returns the user object without sensitive information

type UserDetailResponse

type UserDetailResponse struct {
	UserID   string `bson:"user_id" json:"userID"`
	Username string `bson:"username" json:"username"`
	Email    string `bson:"email" json:"email"`
}

type UserDetails

type UserDetails struct {
	ID    string `bson:"id,omitempty"`
	Email string `bson:"email,omitempty" json:"email,omitempty"`
	Name  string `bson:"name,omitempty" json:"name,omitempty"`
}

UserDetails is used to update user's personal details

type UserPassword

type UserPassword struct {
	Username    string `json:"username,omitempty"`
	OldPassword string `json:"oldPassword,omitempty"`
	NewPassword string `json:"newPassword,omitempty"`
}

UserPassword defines structure for password related requests

type UserWithProject

type UserWithProject struct {
	Audit    `bson:",inline"`
	ID       string     `bson:"_id" json:"id"`
	Username string     `bson:"username" json:"username"`
	Email    string     `bson:"email" json:"email"`
	Name     string     `bson:"name" json:"name"`
	Projects []*Project `bson:"projects" json:"projects"`
}

Jump to

Keyboard shortcuts

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