File tree Expand file tree Collapse file tree 3 files changed +8
-17
lines changed
Expand file tree Collapse file tree 3 files changed +8
-17
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ ADD CONSTRAINT fk_teams
1818FOREIGN KEY (team_id)
1919REFERENCES teams(id)
2020ON UPDATE CASCADE
21- ON DELETE CASCADE ;
21+ ON DELETE SET NULL ;
2222
2323ALTER TABLE vit_details
2424ADD CONSTRAINT fk_details
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -244,13 +244,6 @@ func LeaveTeam(ctx echo.Context) error {
244244 })
245245 }
246246
247- if err := services .UpdateUserTeamDetails (uuid .Nil , user .ID ); err != nil {
248- return ctx .JSON (http .StatusInternalServerError , map [string ]string {
249- "message" : err .Error (),
250- "status" : "failed to leave team" ,
251- })
252- }
253-
254247 if team .LeaderID == user .ID {
255248 if err := services .DeleteTeam (user .TeamID , user .ID ); err != nil {
256249 return ctx .JSON (http .StatusInternalServerError , map [string ]string {
@@ -265,6 +258,13 @@ func LeaveTeam(ctx echo.Context) error {
265258 })
266259 }
267260
261+ if err := services .UpdateUserTeamDetails (uuid .Nil , user .ID ); err != nil {
262+ return ctx .JSON (http .StatusInternalServerError , map [string ]string {
263+ "message" : err .Error (),
264+ "status" : "failed to leave team" ,
265+ })
266+ }
267+
268268 return ctx .JSON (http .StatusOK , map [string ]string {
269269 "message" : "team left successfully" ,
270270 "status" : "success" ,
You can’t perform that action at this time.
0 commit comments