Merge branch 'frontend' into gruppDM
This commit is contained in:
commit
520e2f74f0
1 changed files with 3 additions and 3 deletions
|
@ -31,7 +31,7 @@ func GetAllWeeklyReports(c *fiber.Ctx) error {
|
||||||
return c.Status(400).SendString("Missing project name")
|
return c.Status(400).SendString("Missing project name")
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the token user is not an admin, check if the target user is the same as the token user
|
// If the user is not a project manager, they can only view their own reports
|
||||||
pm, err := db.GetDb(c).IsProjectManager(username, projectName)
|
pm, err := db.GetDb(c).IsProjectManager(username, projectName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Info("Error checking if user is project manager:", err)
|
log.Info("Error checking if user is project manager:", err)
|
||||||
|
@ -44,9 +44,9 @@ func GetAllWeeklyReports(c *fiber.Ctx) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve weekly reports for the user in the project from the database
|
// Retrieve weekly reports for the user in the project from the database
|
||||||
reports, err := db.GetDb(c).GetAllWeeklyReports(username, projectName)
|
reports, err := db.GetDb(c).GetAllWeeklyReports(target_user, projectName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Error getting weekly reports for user:", username, "in project:", projectName, ":", err)
|
log.Error("Error getting weekly reports for user:", target_user, "in project:", projectName, ":", err)
|
||||||
return c.Status(500).SendString(err.Error())
|
return c.Status(500).SendString(err.Error())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue