Skip to content

Commit

Permalink
fix: groups user
Browse files Browse the repository at this point in the history
  • Loading branch information
Spacelocust committed Jul 16, 2024
1 parent f9c6b4b commit a54eb63
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions api/internal/server/mission.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (s *Server) CreateMission(c *gin.Context) {

if err := db.
Preload("GroupUserMissions.Stratagems").
Preload("GroupUserMissions.User").
Preload("GroupUserMissions.GroupUser.User").
First(&newMission, "id = ?", newMission.ID).
Error; err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
Expand Down Expand Up @@ -177,7 +177,7 @@ func (s *Server) GetMission(c *gin.Context) {

if err := db.
Preload("GroupUserMissions.Stratagems").
Preload("GroupUserMissions.User").
Preload("GroupUserMissions.GroupUser.User").
First(&mission, "id = ?", missionID).
Error; err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
Expand Down Expand Up @@ -274,7 +274,7 @@ func (s *Server) UpdateMission(c *gin.Context) {
// Get the updated mission with the group user missions
if err := db.
Preload("GroupUserMissions.Stratagems").
Preload("GroupUserMissions.User").
Preload("GroupUserMissions.GroupUser.User").
First(&updatedMission, "id = ?", missionID).
Error; err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
Expand Down Expand Up @@ -725,7 +725,7 @@ func (s *Server) UpdateGroupUserMission(c *gin.Context) {
}

// Update the group user mission
if err := db.Model(&groupUserMission).Preload("User").Association("Stratagems").Replace(newStratagems); err != nil {
if err := db.Model(&groupUserMission).Preload("GroupUser.User").Association("Stratagems").Replace(newStratagems); err != nil {
s.InternalErrorResponse(c, err)
return
}
Expand Down

0 comments on commit a54eb63

Please sign in to comment.