diff --git a/docker-compose.yml b/docker-compose.yml index 2c0ad54..fbdd6a9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,6 @@ version: '3' services: + api: build: . ports: diff --git a/internal/controllers/admin_teams_controller.go b/internal/controllers/admin_teams_controller.go index fad3607..a056a6b 100644 --- a/internal/controllers/admin_teams_controller.go +++ b/internal/controllers/admin_teams_controller.go @@ -188,3 +188,35 @@ func GetTeamLeader(ctx echo.Context) error { }) } + +/*func GetAllFresherTeams(ctx echo.Context) error { + team, err := teamService.GetAllFresherTeam() + if err != nil { + return ctx.JSON(http.StatusBadRequest, map[string]string{ + "message": "Failed to fetch teams", + "data": err.Error(), + "status": "false", + }) + } + return ctx.JSON(http.StatusAccepted, map[string]interface{}{ + "message": "Successfully fetched teams", + "data": team, + "status": "true", + }) +} + +func GetAllFemaleTeams(ctx echo.Context) error { + team, err := teamService.GetAllFemaleTeams() + if err != nil { + return ctx.JSON(http.StatusBadRequest, map[string]string{ + "message": "Failed to fetch teams", + "data": err.Error(), + "status": "false", + }) + } + return ctx.JSON(http.StatusAccepted, map[string]interface{}{ + "message": "Successfully fetched teams", + "data": team, + "status": "true", + }) +}*/ diff --git a/internal/controllers/idea_controller.go b/internal/controllers/idea_controller.go index e8b22c1..b032264 100644 --- a/internal/controllers/idea_controller.go +++ b/internal/controllers/idea_controller.go @@ -73,7 +73,7 @@ func CreateIdea(ctx echo.Context) error { user := ctx.Get("user").(*models.User) if user.TeamID == uuid.Nil { - return ctx.JSON(http.StatusForbidden, map[string]string{ + return ctx.JSON(http.StatusConflict, map[string]string{ "message": "user is not in a team", "status": "fail", }) @@ -142,7 +142,7 @@ func UpdateIdea(ctx echo.Context) error { } if !user.IsLeader { - return ctx.JSON(http.StatusUnauthorized, map[string]string{ + return ctx.JSON(http.StatusForbidden, map[string]string{ "message": "user is not a leader", "status": "fail", }) diff --git a/internal/controllers/project_controller.go b/internal/controllers/project_controller.go index c30ae68..e660a3a 100644 --- a/internal/controllers/project_controller.go +++ b/internal/controllers/project_controller.go @@ -72,7 +72,7 @@ func CreateProject(ctx echo.Context) error { user := ctx.Get("user").(*models.User) if user.TeamID == uuid.Nil { - return ctx.JSON(http.StatusForbidden, map[string]string{ + return ctx.JSON(http.StatusConflict, map[string]string{ "message": "user is not in a team", "status": "fail", }) @@ -135,14 +135,14 @@ func UpdateProject(ctx echo.Context) error { user := ctx.Get("user").(*models.User) if !user.IsLeader { - return ctx.JSON(http.StatusUnauthorized, map[string]string{ + return ctx.JSON(http.StatusForbidden, map[string]string{ "message": "user is not a leader", "status": "fail", }) } if user.TeamID == uuid.Nil { - return ctx.JSON(http.StatusForbidden, map[string]string{ + return ctx.JSON(http.StatusConflict, map[string]string{ "message": "The user is not in a team", "status": "fail", }) diff --git a/internal/routes/admin_routes.go b/internal/routes/admin_routes.go index 995da33..e4e9140 100644 --- a/internal/routes/admin_routes.go +++ b/internal/routes/admin_routes.go @@ -28,4 +28,7 @@ func AdminRoutes(incomingRoutes *echo.Echo) { admin.GET("/projects/all", controllers.GetAllProject) admin.GET("/ideas/all", controllers.GetAllIdeas) + + //admin.GET("/team/freshers", controllers.GetAllFresherTeams) + //admin.GET("/team/females", controllers.GetAllFemaleTeams) }