server

package
v0.0.0-...-77bc736 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApplicantRole int64 = 0
	AdminRole     int64 = 1
	EmployerRole  int64 = 2
)
View Source
const ClaimValidity = 1 * time.Hour

Variables

This section is empty.

Functions

func AdminLogin

func AdminLogin(env *HandlerConfig) http.HandlerFunc

func ChangeAdminAccountPassword

func ChangeAdminAccountPassword(env *HandlerConfig) http.HandlerFunc

func ChangeEmployerAccountPassword

func ChangeEmployerAccountPassword(env *HandlerConfig) http.HandlerFunc

func ChangeMyAdminAccountPassword

func ChangeMyAdminAccountPassword(env *HandlerConfig) http.HandlerFunc

func ChangeMyEmployerAccountPassword

func ChangeMyEmployerAccountPassword(env *HandlerConfig) http.HandlerFunc

func CreateAdminAccount

func CreateAdminAccount(env *HandlerConfig) http.HandlerFunc

CreateAdminAccount creates a new AdminAccount, and returns the id of the created row

func CreateEmployer

func CreateEmployer(env *HandlerConfig) http.HandlerFunc

CreateEmployer creates a new Employer, and returns the id of the created row

func CreateEmployerAccount

func CreateEmployerAccount(env *HandlerConfig) http.HandlerFunc

CreateEmployerAccount creates a new EmployerAccount, and returns the id of the created row

func DeleteAdminAccount

func DeleteAdminAccount(env *HandlerConfig) http.HandlerFunc

DeleteAdminAccount handler receives an id as a path parameter, deletes the corresponding AdminAccount, and returns a http.StatusNoContent on success

func DeleteEmployer

func DeleteEmployer(env *HandlerConfig) http.HandlerFunc

DeleteEmployer handler receives an id as a path parameter, deletes the corresponding Employer, and returns a http.StatusNoContent on success

func DeleteEmployerAccount

func DeleteEmployerAccount(env *HandlerConfig) http.HandlerFunc

DeleteEmployerAccount handler receives an id as a path parameter, deletes the corresponding EmployerAccount, and returns a http.StatusNoContent on success

func DeleteJobPost

func DeleteJobPost(env *HandlerConfig) http.HandlerFunc

func EmployersLogin

func EmployersLogin(env *HandlerConfig) http.HandlerFunc

func GeneratePasswordHash

func GeneratePasswordHash(password string) (string, error)

func GetAdminAccount

func GetAdminAccount(env *HandlerConfig) http.HandlerFunc

GetAdminAccount receives an id as a path parameter, and returns the corresponding AdminAccount

func GetEmployer

func GetEmployer(env *HandlerConfig) http.HandlerFunc

GetEmployer receives an id as a path parameter, and returns the corresponding Employer

func GetEmployerAccount

func GetEmployerAccount(env *HandlerConfig) http.HandlerFunc

GetEmployerAccount receives an id as a path parameter, and returns the corresponding EmployerAccount

func GetJobPost

func GetJobPost(env *HandlerConfig) http.HandlerFunc

func GetMyAdminAccount

func GetMyAdminAccount(env *HandlerConfig) http.HandlerFunc

func GetMyEmployerAccount

func GetMyEmployerAccount(env *HandlerConfig) http.HandlerFunc

func GetStatus

func GetStatus(env *HandlerConfig) http.HandlerFunc

func ListAdminAccounts

func ListAdminAccounts(env *HandlerConfig) http.HandlerFunc

func ListEmployerAccounts

func ListEmployerAccounts(env *HandlerConfig) http.HandlerFunc

func ListEmployers

func ListEmployers(env *HandlerConfig) http.HandlerFunc

func ListJobPosts

func ListJobPosts(env *HandlerConfig) http.HandlerFunc

func Me

func Me(jwtSecret []byte, handler func(http.ResponseWriter, *http.Request)) func(http.ResponseWriter, *http.Request)

func New

func New(port int, cert []byte, key []byte, dbQueries *db.Queries) (*http.Server, error)

func NewLesVieuxRouter

func NewLesVieuxRouter(config *HandlerConfig) http.Handler

Types

type ChangeAdminAccountPasswordParams

type ChangeAdminAccountPasswordParams struct {
	Password string `json:"password"`
}

type ChangeAdminAccountPasswordResponse

type ChangeAdminAccountPasswordResponse struct {
	ID int64 `json:"id"`
}

type ChangeEmployerAccountPasswordParams

type ChangeEmployerAccountPasswordParams struct {
	Password string `json:"password"`
}

type ChangeEmployerAccountPasswordResponse

type ChangeEmployerAccountPasswordResponse struct {
	ID int64 `json:"id"`
}

type CreateAdminAccountParams

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

type CreateAdminAccountResponse

type CreateAdminAccountResponse struct {
	ID int64 `json:"id"`
}

type CreateEmployerAccountParams

type CreateEmployerAccountParams struct {
	Email    string `json:"email"`
	Role     int64  `json:"role"`
	Password string `json:"password"`
}

type CreateEmployerAccountResponse

type CreateEmployerAccountResponse struct {
	ID int64 `json:"id"`
}

type CreateEmployerParams

type CreateEmployerParams struct {
	Name string `json:"name"`
}

type CreateEmployerResponse

type CreateEmployerResponse struct {
	ID int64 `json:"id"`
}

type CreateJobPostResponse

type CreateJobPostResponse struct {
	ID int64 `json:"id"`
}

type EmployerLoginParams

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

type EmployerLoginResponse

type EmployerLoginResponse struct {
	Token string `json:"token"`
}

type GetAdminAccountResponse

type GetAdminAccountResponse struct {
	ID    int64  `json:"id"`
	Email string `json:"email"`
}

type GetEmployerAccountResponse

type GetEmployerAccountResponse struct {
	ID    int64  `json:"id"`
	Email string `json:"email"`
	Role  int64  `json:"role"`
}

type GetEmployerResponse

type GetEmployerResponse struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
}

type GetJobPostResponse

type GetJobPostResponse struct {
	ID         int64  `json:"id"`
	Title      string `json:"title"`
	Content    string `json:"content"`
	Status     string `json:"status"`
	CreatedAt  string `json:"created_at"`
	EmployerID int64  `json:"employer_id"`
}

type GetStatusResponse

type GetStatusResponse struct {
	Initialized bool   `json:"initialized"`
	Version     string `json:"version"`
}

type HandlerConfig

type HandlerConfig struct {
	DBQueries *db.Queries
	JWTSecret []byte
}

type LoginParams

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

type LoginResponse

type LoginResponse struct {
	Token string `json:"token"`
}

type UpdateJobPostParams

type UpdateJobPostParams struct {
	Title   string `json:"title"`
	Content string `json:"content"`
	Status  string `json:"status"`
}

type UpdateJobPostResponse

type UpdateJobPostResponse struct {
	ID int64 `json:"id"`
}

Jump to

Keyboard shortcuts

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