Full fix for getProject route, testing, integration testing and frontend-API code
This commit is contained in:
parent
741ad50ccf
commit
0c2617d0cb
7 changed files with 82 additions and 2 deletions
|
@ -17,6 +17,7 @@ type GlobalState interface {
|
|||
SubmitWeeklyReport(c *fiber.Ctx) error
|
||||
GetWeeklyReport(c *fiber.Ctx) error
|
||||
SignReport(c *fiber.Ctx) error
|
||||
GetProject(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
|
||||
|
|
|
@ -66,6 +66,10 @@ func (gs *GState) ProjectRoleChange(c *fiber.Ctx) error {
|
|||
func (gs *GState) GetProject(c *fiber.Ctx) error {
|
||||
// Extract the project ID from the request parameters or body
|
||||
projectID := c.Params("projectID")
|
||||
if projectID == "" {
|
||||
return c.Status(400).SendString("No project ID provided")
|
||||
}
|
||||
println("Getting project with ID: ", projectID)
|
||||
|
||||
// Parse the project ID into an integer
|
||||
projectIDInt, err := strconv.Atoi(projectID)
|
||||
|
@ -80,6 +84,7 @@ func (gs *GState) GetProject(c *fiber.Ctx) error {
|
|||
}
|
||||
|
||||
// Return the project as JSON
|
||||
println("Returning project: ", project.Name)
|
||||
return c.JSON(project)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue