services

package
v0.0.0-...-c11cb33 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2022 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Client         = Init()
	UnableToUpload = errors.New("Unable to upload image")
)

Functions

func Close

func Close()

func FilenameToImageID

func FilenameToImageID(filename string) string

func GetGCS

func GetGCS() *storage.Client

func GetSignedURLs

func GetSignedURLs(userID string) map[string]string

func Init

func Init() *storage.Client

func NewImageService

func NewImageService() *imageService

func NewUserService

func NewUserService() *userService

func ReverseGeocode

func ReverseGeocode(lat, lng *float64) (string, string, error)

Types

type GeoLocation

type GeoLocation struct {
	Items []struct {
		Address struct {
			CountryName string `json:"countryName"`
			City        string `json:"city"`
		} `json:"address"`
		Title string `json:"title"`
	} `json:"items"`
}

type ImageInfo

type ImageInfo struct {
	ID      string    `json:"id"`
	Url     string    `json:"url"`
	City    string    `json:"city"`
	Country string    `json:"country"`
	Lat     float64   `json:"lat"`
	Lng     float64   `json:"lng"`
	Date    time.Time `json:"date"`
}

type ImageService

type ImageService interface {
	GetAllImages(ctx context.Context, userID *primitive.ObjectID) ([]ImageInfo, error)
	CreateImage(userID *primitive.ObjectID, lat *float64, lng *float64, country *string,
		city *string, date *time.Time) (string, error)
	UploadImage(image *multipart.File, userID, imageID, file_extension string) error
	StoreImage(image *multipart.File, userID, image_id, file_extension string) error
	GetMetadata(image *multipart.File) (float64, float64, time.Time, error)
}

type UserService

type UserService interface {
	GetUsers(ctx context.Context) ([]models.User, error)
	GetUserByID(user_id string) (models.User, error)
	GetUser(name, email string) (models.User, error)
	CreateUser(name string, email string, pass []byte) error
	CheckUserExists(name, email string) error
	SaveRefreshToken(refreshToken string, userID primitive.ObjectID) error
}

Jump to

Keyboard shortcuts

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