Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Repository ¶
type Repository struct { App *config.AppConfig DB database.DatabaseRepo }
Repository is the router repository type.
var Repo *Repository
Repo is the router repository.
func NewMongoDBRepo ¶
func NewMongoDBRepo(a *config.AppConfig, db *mongo.Database) *Repository
NewMongoDBRepo returns a new instance of a repository for the mongo driver.
func NewTestRepo ¶
func NewTestRepo(a *config.AppConfig) *Repository
NewTestDBRepo returns a new repository for testing purposes.
func (*Repository) Auth ¶
func (m *Repository) Auth(next http.Handler) http.Handler
Auth checks if the requests is authorized to access the endpoint.
func (*Repository) IsPostCreatorOrAdmin ¶
func (m *Repository) IsPostCreatorOrAdmin(next http.Handler) http.Handler
IsPostCreatorOrAdmin is a middleware to check if the user got the permission to modify or delete the target post.
func (*Repository) IsUserOrAdmin ¶
func (m *Repository) IsUserOrAdmin(next http.Handler) http.Handler
IsUserOrAdmin is a middleware to check if the user got the permission to change or delete the target user.
Click to show internal directories.
Click to hide internal directories.