MCPcopy
hub / github.com/eyebluecn/tank / DeleteBatch

Method DeleteBatch

code/rest/matter_controller.go:438–470  ·  view source on GitHub ↗
(writer http.ResponseWriter, request *http.Request)

Source from the content-addressed store, hash-verified

436}
437
438func (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.
473func (this *MatterController) CleanExpiredDeletedMatters(writer http.ResponseWriter, request *http.Request) *result.WebResult {

Callers

nothing calls this directly

Calls 8

ExtractRequestStringFunction · 0.92
checkUserMethod · 0.80
CheckWritableByUuidMethod · 0.80
AtomicDeleteMethod · 0.80
SuccessMethod · 0.80
WarnMethod · 0.65
FindByUuidMethod · 0.45

Tested by

no test coverage detected