route

package
v0.0.0-...-77088b8 Latest Latest
Warning

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

Go to latest
Published: May 22, 2022 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDir

func IsDir(f http.File) bool

IsDir checks if the given file is a directory

func NewRouter

func NewRouter(dbConnection *sqlx.DB, redisClient *redis.Client, jobServer *machinery.Server, appConfig config.AppConfig) (chi.Router, error)

NewRouter creates a new router for chi

Types

type AuthTokenResponseData

type AuthTokenResponseData struct {
	AccessToken string `json:"accessToken"`
}

AuthTokenResponseData is the response data for when an access token is refreshed

type AuthenticationMiddleware

type AuthenticationMiddleware struct {
	// contains filtered or unexported fields
}

AuthenticationMiddleware is a middleware that requires a valid JWT token to be passed via the Authorization header

func (*AuthenticationMiddleware) Middleware

func (m *AuthenticationMiddleware) Middleware(next http.Handler) http.Handler

Middleware returns the middleware handler

type AvatarUploadResponseData

type AvatarUploadResponseData struct {
	UserID string `json:"userID"`
	URL    string `json:"url"`
}

AvatarUploadResponseData is the response data for a user profile is uploaded

type ClientLog

type ClientLog struct {
	Level      string `json:"level"`
	Message    string `json:"message"`
	Logger     string `json:"logger"`
	Stacktrace string `json:"stacktrace"`
	Timestamp  string `json:"timestamp"`
}

type ClientLogs

type ClientLogs struct {
	Logs []ClientLog `json:"logs"`
}

type ConfirmUserRequestData

type ConfirmUserRequestData struct {
	ConfirmToken string
}

ConfirmUserRequestData is the request data for upgrading an invited user to a normal user

type FrontendHandler

type FrontendHandler struct {
	// contains filtered or unexported fields
}

FrontendHandler serves an embed React client through chi

func (FrontendHandler) ServeHTTP

func (h FrontendHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP attempts to serve a requested file for the embedded React client

type InstallRequestData

type InstallRequestData struct {
	User NewUserAccount
}

InstallRequestData is the request data for installing new Taskcafe app

type LoginRequestData

type LoginRequestData struct {
	Username string
	Password string
}

LoginRequestData is the request data when a user logs in

type LoginResponseData

type LoginResponseData struct {
	UserID   string `json:"userID"`
	Complete bool   `json:"complete"`
}

LoginResponseData is the response data for when a user logs in

type LogoutResponseData

type LogoutResponseData struct {
	Status string `json:"status"`
}

LogoutResponseData is the response data for when a user logs out

type NewUserAccount

type NewUserAccount struct {
	FullName string `json:"fullname"`
	Username string
	Password string
	Initials string
	Email    string
}

NewUserAccount is the request data for a new user

type PublicSettingsResponse

type PublicSettingsResponse struct {
	IsConfigured            bool `json:"isConfigured"`
	AllowPublicRegistration bool `json:"allowPublicRegistration"`
}

type RegisterUserRequestData

type RegisterUserRequestData struct {
	User NewUserAccount
}

RegisterUserRequestData is the request data for registering a new user (duh)

type RegisteredUserResponseData

type RegisteredUserResponseData struct {
	Setup bool `json:"setup"`
}

type Setup

type Setup struct {
	ConfirmToken string `json:"confirmToken"`
}

type TaskcafeHandler

type TaskcafeHandler struct {
	AppConfig config.AppConfig
	// contains filtered or unexported fields
}

TaskcafeHandler contains all the route handlers

func (*TaskcafeHandler) ConfirmUser

func (h *TaskcafeHandler) ConfirmUser(w http.ResponseWriter, r *http.Request)

func (*TaskcafeHandler) Frontend

func (h *TaskcafeHandler) Frontend(w http.ResponseWriter, r *http.Request)

Frontend serves the index.html file

func (*TaskcafeHandler) HandleClientLog

func (h *TaskcafeHandler) HandleClientLog(w http.ResponseWriter, r *http.Request)

func (*TaskcafeHandler) LoginHandler

func (h *TaskcafeHandler) LoginHandler(w http.ResponseWriter, r *http.Request)

LoginHandler creates a new refresh & access token for the user if given the correct credentials

func (*TaskcafeHandler) LogoutHandler

func (h *TaskcafeHandler) LogoutHandler(w http.ResponseWriter, r *http.Request)

LogoutHandler removes all refresh tokens to log out user

func (*TaskcafeHandler) ProfileImageUpload

func (h *TaskcafeHandler) ProfileImageUpload(w http.ResponseWriter, r *http.Request)

ProfileImageUpload handles a user uploading a new avatar profile image

func (*TaskcafeHandler) PublicSettings

func (h *TaskcafeHandler) PublicSettings(w http.ResponseWriter, r *http.Request)

func (*TaskcafeHandler) RegisterUser

func (h *TaskcafeHandler) RegisterUser(w http.ResponseWriter, r *http.Request)

func (*TaskcafeHandler) ValidateAuthTokenHandler

func (h *TaskcafeHandler) ValidateAuthTokenHandler(w http.ResponseWriter, r *http.Request)

type ValidateAuthTokenResponse

type ValidateAuthTokenResponse struct {
	Valid  bool   `json:"valid"`
	UserID string `json:"userID"`
}

Jump to

Keyboard shortcuts

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