func eventBlockRemove(w http.ResponseWriter, r *http.Request, t auth.Token) (err error) {
	if !permission.Check(t, permission.PermEventBlockRemove) {
		return permission.ErrUnauthorized
	}
	uuid := r.URL.Query().Get(":uuid")
	if !bson.IsObjectIdHex(uuid) {
		msg := fmt.Sprintf("uuid parameter is not ObjectId: %s", uuid)
		return &errors.HTTP{Code: http.StatusBadRequest, Message: msg}
	}
	objID := bson.ObjectIdHex(uuid)
	evt, err := event.New(&event.Opts{
		Target: event.Target{Type: event.TargetTypeEventBlock, Value: objID.Hex()},
		Kind:   permission.PermEventBlockRemove,
		Owner:  t,
		CustomData: []map[string]interface{}{
			{"name": "ID", "value": objID.Hex()},
		},
		Allowed: event.Allowed(permission.PermEventBlockReadEvents),
	})
	if err != nil {
		return err
	}
	defer func() { evt.Done(err) }()
	err = event.RemoveBlock(objID)
	if _, ok := err.(*event.ErrActiveEventBlockNotFound); ok {
		return &errors.HTTP{Code: http.StatusNotFound, Message: err.Error()}
	}
	return err
}
func eventBlockRemove(w http.ResponseWriter, r *http.Request, t auth.Token) (err error) {
	if !permission.Check(t, permission.PermEventBlockRemove) {
		return permission.ErrUnauthorized
	}
	uuid := r.URL.Query().Get(":uuid")
	if !bson.IsObjectIdHex(uuid) {
		msg := fmt.Sprintf("uuid parameter is not ObjectId: %s", uuid)
		return &errors.HTTP{Code: http.StatusBadRequest, Message: msg}
	}
	objID := bson.ObjectIdHex(uuid)
	evt, err := event.New(&event.Opts{
		Target: event.Target{Type: event.TargetTypeEventBlock, Value: objID.Hex()},
		Kind:   permission.PermEventBlockRemove,
		Owner:  t,
		CustomData: []map[string]interface{}{
			{"name": "ID", "value": objID.Hex()},
		},
		Allowed: event.Allowed(permission.PermEventBlockReadEvents),
	})
	if err != nil {
		return err
	}
	defer func() { evt.Done(err) }()
	err = event.RemoveBlock(objID)
	if _, ok := err.(*event.ErrActiveEventBlockNotFound); ok {
		return &errors.HTTP{Code: http.StatusNotFound, Message: err.Error()}
	}
	return err
}
func eventBlockRemove ( w http . ResponseWriter , r * http . Request , t auth . Token ) ( err error ) { if ! permission . Check ( t , permission . PermEventBlockRemove ) { return permission . ErrUnauthorized } uuid := r . URL . Query ( ) . Get ( " " ) if ! bson . IsObjectIdHex ( uuid ) { msg := fmt . Sprintf ( " " , uuid ) return & errors . HTTP { Code : http . StatusBadRequest , Message : msg } } objID := bson . ObjectIdHex ( uuid ) evt , err := event . New ( & event . Opts { Target : event . Target { Type : event . TargetTypeEventBlock , Value : objID . Hex ( ) } , Kind : permission . PermEventBlockRemove , Owner : t , CustomData : [ ] map [ string ] interface { } { { " " : " " , " " : objID . Hex ( ) } , } , Allowed : event . Allowed ( permission . PermEventBlockReadEvents ) , } ) if err != nil { return err } defer func ( ) { evt . Done ( err ) } ( ) err = event . RemoveBlock ( objID ) if _ , ok := err . ( * event . ErrActiveEventBlockNotFound ) ; ok { return & errors . HTTP { Code : http . StatusNotFound , Message : err . Error ( ) } } return err }
// title: remove event block
// path: /events/blocks/{uuid}
// method: DELETE
// responses:
//   200: OK
//   400: Invalid uuid
//   401: Unauthorized
//   404: Active block with provided uuid not found
title : remove event block path : / events / blocks / { uuid } method : DELETE responses : 200 : OK 400 : Invalid uuid 401 : Unauthorized 404 : Active block with provided uuid not found