(writer http.ResponseWriter, request *http.Request)
| 436 | } |
| 437 | |
| 438 | func (this *MatterController) DeleteBatch(writer http.ResponseWriter, request *http.Request) *result.WebResult { |
| 439 | |
| 440 | uuids := util.ExtractRequestString(request, "uuids") |
| 441 | |
| 442 | user := this.checkUser(request) |
| 443 | spaceUuid := util.ExtractRequestOptionalString(request, "spaceUuid", user.SpaceUuid) |
| 444 | space := this.spaceService.CheckWritableByUuid(request, user, spaceUuid) |
| 445 | |
| 446 | uuidArray := strings.Split(uuids, ",") |
| 447 | matters := make([]*Matter, 0) |
| 448 | for _, uuid := range uuidArray { |
| 449 | |
| 450 | matter := this.matterDao.FindByUuid(uuid) |
| 451 | |
| 452 | if matter == nil { |
| 453 | this.logger.Warn("%s not exist anymore", uuid) |
| 454 | continue |
| 455 | } |
| 456 | |
| 457 | if matter.SpaceUuid != space.Uuid { |
| 458 | panic(result.UNAUTHORIZED) |
| 459 | } |
| 460 | |
| 461 | matters = append(matters, matter) |
| 462 | } |
| 463 | |
| 464 | for _, matter := range matters { |
| 465 | |
| 466 | this.matterService.AtomicDelete(request, matter, user, space) |
| 467 | } |
| 468 | |
| 469 | return this.Success("OK") |
| 470 | } |
| 471 | |
| 472 | // manual clean expired deleted matters. |
| 473 | func (this *MatterController) CleanExpiredDeletedMatters(writer http.ResponseWriter, request *http.Request) *result.WebResult { |
nothing calls this directly
no test coverage detected