52 lines
2.2 KiB
Go
52 lines
2.2 KiB
Go
package handlers
|
|
|
|
import (
|
|
"ttime/internal/database"
|
|
|
|
"github.com/gofiber/fiber/v2"
|
|
)
|
|
|
|
// The actual interface that we will use
|
|
type GlobalState interface {
|
|
Register(c *fiber.Ctx) error // To register a new user
|
|
UserDelete(c *fiber.Ctx) error // To delete a user
|
|
Login(c *fiber.Ctx) error // To get the token
|
|
LoginRenew(c *fiber.Ctx) error // To renew the token
|
|
CreateProject(c *fiber.Ctx) error // To create a new project
|
|
GetUserProjects(c *fiber.Ctx) error // To get all projects
|
|
SubmitWeeklyReport(c *fiber.Ctx) error
|
|
GetWeeklyReport(c *fiber.Ctx) error
|
|
SignReport(c *fiber.Ctx) error
|
|
GetProject(c *fiber.Ctx) error
|
|
AddUserToProjectHandler(c *fiber.Ctx) error
|
|
PromoteToAdmin(c *fiber.Ctx) error
|
|
GetWeeklyReportsUserHandler(c *fiber.Ctx) error
|
|
IsProjectManagerHandler(c *fiber.Ctx) error
|
|
// GetProject(c *fiber.Ctx) error // To get a specific project
|
|
// UpdateProject(c *fiber.Ctx) error // To update a project
|
|
// DeleteProject(c *fiber.Ctx) error // To delete a project
|
|
// CreateTask(c *fiber.Ctx) error // To create a new task
|
|
// GetTasks(c *fiber.Ctx) error // To get all tasks
|
|
// GetTask(c *fiber.Ctx) error // To get a specific task
|
|
// UpdateTask(c *fiber.Ctx) error // To update a task
|
|
// DeleteTask(c *fiber.Ctx) error // To delete a task
|
|
// CreateCollection(c *fiber.Ctx) error // To create a new collection
|
|
// GetCollections(c *fiber.Ctx) error // To get all collections
|
|
// GetCollection(c *fiber.Ctx) error // To get a specific collection
|
|
// UpdateCollection(c *fiber.Ctx) error // To update a collection
|
|
// DeleteCollection(c *fiber.Ctx) error // To delete a collection
|
|
// SignCollection(c *fiber.Ctx) error // To sign a collection
|
|
ListAllUsers(c *fiber.Ctx) error // To get a list of all users in the application database
|
|
ListAllUsersProject(c *fiber.Ctx) error // To get a list of all users for a specific project
|
|
ProjectRoleChange(c *fiber.Ctx) error // To change a users role in a project
|
|
}
|
|
|
|
// "Constructor"
|
|
func NewGlobalState(db database.Database) GlobalState {
|
|
return &GState{Db: db}
|
|
}
|
|
|
|
// The global state, which implements all the handlers
|
|
type GState struct {
|
|
Db database.Database
|
|
}
|