utils

package
v0.0.0-...-8af04d2 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrNotProjectMember            = "You are not a member of this project"
	ErrNotOrgMember                = "You are not a member of this organization"
	ErrNotOrgAdmin                 = "You are not an admin of this organization"
	ErrNoAdminPermissionForProject = "You do not have permission to perform this operation on this project"
	ErrReachOrgLimit               = "You have reached the organization limit"
	ErrReachProjectLimit           = "You have reached the project limit"
)

Variables

This section is empty.

Functions

func EncodeMD5

func EncodeMD5(value string) string

EncodeMD5 md5 encryption

func GenerateTokens

func GenerateTokens(userId uuid.UUID, isSuperAdmin bool) (string, string, error)

func GetBurndown

func GetBurndown(tx *gorm.DB, sprintId uuid.UUID) ([]*model.SprintBurndown, int, error)

func GetOrgRole

func GetOrgRole(org model.Org, orgUser []model.OrgUser, user model.User) generalv1.Role

func GetProjectRole

func GetProjectRole(project model.Project, user model.User) generalv1.Role

func IsLegalName

func IsLegalName(name string) bool

func IsOrgAdmin

func IsOrgAdmin(org model.Org, orgUser []model.OrgUser, user model.User) bool

func IsOrgMember

func IsOrgMember(org model.Org, orgUser []model.OrgUser, user model.User) bool

func IsProjectAdmin

func IsProjectAdmin(project model.Project, user model.User) bool

func IsProjectMember

func IsProjectMember(project model.Project, user model.User) bool

func IsSprintMember

func IsSprintMember(sprintMembers []*projectv1.SprintMember, user model.User) bool

func Pagination

func Pagination(oldPage, oldSize int32) (page, size int32)

func ParseToken

func ParseToken(token string) (jwt.MapClaims, error)

ParseToken parsing token

func UpdateBurndown

func UpdateBurndown(tx *gorm.DB, sprintId uuid.UUID, correctDate time.Time, taskCount int32, hours float32) error

Types

type Options

type Options struct {
	Network    string
	GRPCAddr   string
	HTTPAddr   string
	OpenAPIDir string
	Mux        []runtime.ServeMuxOption
}

type UserClaims

type UserClaims struct {
	Id             uuid.UUID `json:"id"`
	IsSuperAdmin   bool      `json:"is_super_admin"`
	ExpirationTime time.Time `json:"exp"`
}

func GetTokenDetails

func GetTokenDetails(ctx context.Context) (UserClaims, error)

Jump to

Keyboard shortcuts

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