routes

package
v0.0.0-...-dafb160 Latest Latest
Warning

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

Go to latest
Published: May 13, 2023 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthenticateNonReaders

func AuthenticateNonReaders(username string, password string, jwt string, role string) model.User

@param - username @type - string

@param - password @type - string

@param - role @type - string @description - Role a user has

@rtype - model.User @description - Authenticates the user based off a non Reader role.

func AuthenticateReaders

func AuthenticateReaders(username string, password string) model.User

@param - email @type - string

@param - password @type - string @rtype - model.User @description - Authenticates only Reader users(examples include public facing sites)

func CheckIfBucketExist

func CheckIfBucketExist(s3sc *s3.S3, bucketName string) bool

func CloseClientDB

func CloseClientDB()

func ConnectToMongo

func ConnectToMongo() *mongo.Client

func CreateAWSSession

func CreateAWSSession() *session.Session

Creates a reusable session for AWS S3 usage

func CreateArticle

func CreateArticle(input *model.CreateArticleInfo) (*model.Article, error)

func CreateDefaultAdmin

func CreateDefaultAdmin()

func CreateDocument

func CreateDocument(index string, data string, uuid string, userName string, password string)

func CreateProject

func CreateProject(input *model.CreateProjectInput) (*model.Project, error)

Creates a AWS bucket given project paramaters

func CreateProjectBucket

func CreateProjectBucket(s3sc *s3.S3, bucketName string)

func CreateUser

func CreateUser(input *model.UserCreation) (*model.User, error)

func CreateZincUser

func CreateZincUser(username string, password string, email string)

func Decode

func Decode(s string) []byte

func Decrypt

func Decrypt(textToDecrypt string) (string, error)

Decrypt method is to extract back the encrypted text

func DeleteAllProjectsBuckets

func DeleteAllProjectsBuckets(username string)

Deletes all projects buckets tied to a specific user

func DeleteAllUsers

func DeleteAllUsers(jwt string) (string, error)

func DeleteArticle

func DeleteArticle(bucket *model.DeleteBucketInfo) (string, error)

func DeleteArticleFolder

func DeleteArticleFolder(s3sc *s3.S3, iterator s3manager.BatchDeleteIterator, bucketName string) error

Deletes individual article folders within a user's project bucket

func DeleteArticles

func DeleteArticles(input *model.DeleteAllArticlesInput) (string, error)

func DeleteBucket

func DeleteBucket(s3sc *s3.S3, bucketName string)

Deletes a bucket specified by bucketname

func DeleteDocument

func DeleteDocument(index string, data string, uuid string, userName string, password string)

func DeleteIndex

func DeleteIndex(index string, username string, password string)

func DeleteProject

func DeleteProject(input *model.DeleteProjectType) (string, error)

Delete a project and all its articles and assets.

func DeleteProjects

func DeleteProjects(input *model.DeleteAllProjects) (string, error)

func DeleteUser

func DeleteUser(input *model.DeleteUser) (string, error)

func DeleteZincUser

func DeleteZincUser(uuid string, zincUsername string, zincPassword string)

func EncodeToBase64

func EncodeToBase64(b []byte) string

func Encrypt

func Encrypt(textToEncrypt string) (string, error)

Encrypt method is to encrypt or hide any classified text

func FetchArticles

func FetchArticles(input *model.ArticlesPrivate) (*model.Articles, error)

func FetchArticlesZinc

func FetchArticlesZinc(input *model.GetZincArticleInput) (*model.Articles, error)

func FetchUsers

func FetchUsers(jwt string) (*model.Users, error)

func FindArticle

func FindArticle(input *model.FindArticlePrivateType) (*model.Article, error)

func FindArticlePublic

func FindArticlePublic(input *model.FindArticlePublicType) (*model.Article, error)

func GalleryFindImages

func GalleryFindImages(jwt string) (*model.GalleryImages, error)

func GetProjects

func GetProjects(input *model.GetProjectType) (*model.Projects, error)

func Info

func Info(message string)

func JWTValidityCheck

func JWTValidityCheck(jwtToken string) (string, error)

@param - jwtToken @type - string

@rtype - string, err @description - Validates the JWT is properly signed within the CMS

func Login

func Login(username string, password string) (*model.LoginData, error)

@param - email @type - string

@param - password @type - string @rtype - string, err @description - Authenticates the user, and returns a JWT.

func Logout

func Logout(jwt string) (string, error)

func MarshalBinary

func MarshalBinary(userData map[string]string) ([]byte, error)

func ProcessImages

func ProcessImages(storage map[string]any) bytes.Buffer

Takes in a map, and processes the image to be able to upload to AWS

func RedisClientInstation

func RedisClientInstation() *redis.Client

func RedisUserInfo

func RedisUserInfo(jwt string, redisClient *redis.Client) map[string]string

func SearchDocuments

func SearchDocuments(indexName string, searchTerm string, userName string, password string, pageNumber string) []byte

func SearchResults

func SearchResults(query string, zincBaseUrl string, userName string, password string, indexName string) []byte

func UpdateArticle

func UpdateArticle(input *model.UpdatedArticleInfo) (*model.Article, error)

func UpdateDocument

func UpdateDocument(index string, data string, userName string, password string, uuid string)

func UploadArticleImages

func UploadArticleImages(input *model.UploadArticleImageInput) (string, error)

func UploadAvatarImageCreation

func UploadAvatarImageCreation(input *model.UserCreation) string

func UploadFileToS3

func UploadFileToS3(input *model.CreateArticleInfo, zincpassword string) string

func UploadImageArticle

func UploadImageArticle(information map[string]any, jwt string) string

func UploadImageDB

func UploadImageDB(image model.Image, url string, jwt string, uuid string) (model.Image, error)

func UploadUpdatedFileToS3

func UploadUpdatedFileToS3(input *model.UpdatedArticleInfo, zincpassword string) string

func ZincLogin

func ZincLogin(uuid string) (string, string)

Types

type ArticleJson

type ArticleJson struct {
	Name        string
	Author      string
	Date        string
	ImageUrl    string
	Content     string
	Description string
}

type Total

type Total struct {
	Value int64 `json:"value"`
}

type UserData

type UserData struct {
	Password       string `json:"password"`
	Role           string `json:"role"`
	Username       string `json:"username"`
	Name           string `json:"name"`
	ProfilePicture string `json:"profilePicture"`
}

type Zinc

type Zinc struct {
	Took     int  `json:"took"`
	TimedOut bool `json:"timed_out"`
	Shards   struct {
		Total      int `json:"total"`
		Successful int `json:"successful"`
		Skipped    int `json:"skipped"`
		Failed     int `json:"failed"`
	} `json:"_shards"`
	Hits struct {
		Total struct {
			Value int `json:"value"`
		} `json:"total"`
		MaxScore float64 `json:"max_score"`
		Hits     []struct {
			Index     string    `json:"_index"`
			Type      string    `json:"_type"`
			ID        string    `json:"_id"`
			Score     float64   `json:"_score"`
			Timestamp time.Time `json:"@timestamp"`
			Source    struct {
				ContentData    string    `json:"ContentData"`
				DateWritten    time.Time `json:"DateWritten"`
				Description    string    `json:"Description"`
				Project        string    `json:"Project"`
				Tags           string    `json:"Tags"`
				Title          string    `json:"Title"`
				TitleCard      string    `json:"TitleCard"`
				UUID           string    `json:"UUID"`
				URL            string    `json:"Url"`
				Username       string    `json:"Username"`
				Name           string    `json:"Name"`
				ProfilePicture string    `json:"ProfilePicture"`
			} `json:"_source"`
		} `json:"hits"`
	} `json:"hits"`
}

Jump to

Keyboard shortcuts

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