entity

package
v0.0.0-...-010a373 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashPassword

func HashPassword(password string) ([]byte, error)

func ValidateEmail

func ValidateEmail(email string) string

Validates user's email

func ValidateUser

func ValidateUser(user *UserDTO) string

Validates user's [name, password, email]

func VerifyPassword

func VerifyPassword(hashedPassword string, userPassword string) error

Types

type AccessDetail

type AccessDetail struct {
	Uuid   string
	UserID string
}

User by session db that is authorize user's session

type Frequency

type Frequency string
const (
	Day  Frequency = "day"
	Week Frequency = "week"
	Hour Frequency = "hour"
)

type Login

type Login struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

type Notify

type Notify struct {
	Hour      int          `json:"hour" bson:"hour"`
	Minute    int          `json:"minute" bson:"minute"`
	Weekday   time.Weekday `json:"weekday" bson:"weekday"`
	Frequency Frequency    `json:"frequency" bson:"frequency"`
}

type Package

type Package struct {
	Name       string         `json:"name" bson:"name"`
	Version    PackageVersion `json:"version" bson:"version"`
	File       string         `json:"file" bson:"file"`
	IsOutdated bool           `json:"isOutdated" bson:"isOutdated"`
}

func ToPackageDTOs

func ToPackageDTOs(rawPackages map[string]string, file string) []*Package

type PackageVersion

type PackageVersion struct {
	Current string `json:"current" bson:"current"`
	Last    string `json:"last" bson:"last"`
}

type Repo

type Repo struct {
	ID          primitive.ObjectID `json:"id,omitempty" bson:"_id,omitempty"`
	UserID      primitive.ObjectID `json:"userID" bson:"userID"`
	Name        string             `json:"name" bson:"name"`
	Owner       string             `json:"owner" bson:"owner"`
	Path        string             `json:"path" bson:"path"`
	Provider    string             `json:"provider" bson:"provider"`
	PackageList []*Package         `json:"packageList, omitempty" bson:"packageList,omitempty"`
	CreatedAt   time.Time          `json:"createdAt" bson:"createdAt"`
}

func ToRepo

func ToRepo(repoDTO *RepoDTO) *Repo

type RepoDTO

type RepoDTO struct {
	ID          *string    `json:"id,omitempty"`
	UserID      string     `json:"userID"`
	Name        string     `json:"name"`
	Owner       string     `json:"owner"`
	Path        string     `json:"path"`
	Provider    string     `json:"provider"`
	PackageList []*Package `json:"packageList, omitempty"`
}

func ToRepoDTO

func ToRepoDTO(repo *Repo) *RepoDTO

func ToRepoDTOs

func ToRepoDTOs(repos []*Repo) []*RepoDTO

type RepoIDRequest

type RepoIDRequest struct {
	ID string `json:"id"`
}

type RepoUrlRequest

type RepoUrlRequest struct {
	Url string `json:"url"`
}

type Response

type Response struct {
	Message string      `json:"message"`
	Status  int         `json:"status"`
	Data    interface{} `json:"data"`
}

func ToResponse

func ToResponse(message string, status int, data interface{}) *Response

type SignUp

type SignUp struct {
	Name     string `json:"name"`
	Email    string `json:"email"`
	Password string `json:"password"`
}

type SubToken

type SubToken struct {
	Token   string
	Uuid    string
	Expires int64
	SubID   string
	RepoID  string
	Email   string
}

Public Token that is consumed by confirmation mail and update notify preferences

type Subscriber

type Subscriber struct {
	ID          primitive.ObjectID `json:"id,omitempty" bson:"_id,omitempty"`
	RepoID      primitive.ObjectID `json:"repoID" bson:"repoID"`
	Email       string             `json:"email" bson:"email"`
	IsConfirmed bool               `json:"isConfirmed" bson:"isConfirmed"`
	Notify      *Notify            `json:"notify,omitempty" bson:"notify,omitempty"`
	CreatedAt   time.Time          `json:"createdAt" bson:"createdAt"`
}

func ToSubscriber

func ToSubscriber(subscribeDTO *SubscriberDTO) *Subscriber

type SubscriberDTO

type SubscriberDTO struct {
	ID          *string `json:"id,omitempty"`
	RepoID      string  `json:"repoID"`
	Email       string  `json:"email"`
	IsConfirmed bool    `json:"isConfirmed"`
	Notify      *Notify `json:"notify,omitempty"`
}

func ToSubscriberDTO

func ToSubscriberDTO(subscriber *Subscriber) *SubscriberDTO

func ToSubscriberDTOs

func ToSubscriberDTOs(subscribers []*Subscriber) []*SubscriberDTO

type SubscriberIDRequest

type SubscriberIDRequest struct {
	ID string `json:"id"`
}

type SubscriberRequest

type SubscriberRequest struct {
	RepoID *string `json:"repoID,omitempty"`
	Email  *string `json:"email,omitempty"`
	Notify *Notify `json:"notify,omitempty"`
}

type Token

type Token struct {
	Token      string
	Uuid       string
	Expires    int64
	UserID     string
	Email      string
	Authorized bool
}

type TokenDetails

type TokenDetails struct {
	AccessToken  *Token
	RefreshToken *Token
}

type TokenResponse

type TokenResponse struct {
	AccessToken  string `json:"accessToken"`
	RefreshToken string `json:"refreshToken"`
}

func TokenDetailsToResponse

func TokenDetailsToResponse(details *TokenDetails) *TokenResponse

type User

type User struct {
	ID          primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	Name        string             `json:"name" bson:"name"`
	Email       string             `json:"email" bson:"email"`
	IsConfirmed bool               `json:"isConfirmed" bson:"isConfirmed"`
	Password    string             `json:"password" bson:"password"`
	CreatedAt   time.Time          `json:"createdAt" bson:"createdAt"`
}

func ToUser

func ToUser(userDTO *UserDTO) *User

type UserDTO

type UserDTO struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	IsConfirmed bool   `json:"isConfirmed"`
	Email       string `json:"email"`
	Password    string `json:"password"`
}

func AuthToUserDTO

func AuthToUserDTO(user *SignUp) *UserDTO

func ToUserDTO

func ToUserDTO(user *User) *UserDTO

type UserResponse

type UserResponse struct {
	Name  string `json:"name" bson:"name"`
	Email string `json:"email" bson:"email"`
}

func ToUserResponse

func ToUserResponse(user *UserDTO) *UserResponse

Jump to

Keyboard shortcuts

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