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: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateEmail

func ValidateEmail(email string) string

Validates subscribers's email

Types

type Frequency

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

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 RepoRequest

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

type SubToken

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

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 SubscriberRequest

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

Jump to

Keyboard shortcuts

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