func (r *GormWorkItemRepository) Delete(ctx context.Context, spaceID uuid.UUID, workitemID string, suppressorID uuid.UUID) error {
	var workItem = WorkItemStorage{}
	id, err := strconv.ParseUint(workitemID, 10, 64)
	if err != nil || id == 0 {
		// treat as not found: clients don't know it must be a number
		return errors.NewNotFoundError("work item", workitemID)
	}
	workItem.ID = id
	workItem.SpaceID = spaceID
	// retrieve the current version of the work item to delete
	r.db.Select("id, version, type").Where("id = ? AND space_id = ?", workItem.ID, spaceID).Find(&workItem)
	// delete the work item
	tx := r.db.Delete(workItem)
	if err = tx.Error; err != nil {
		return errors.NewInternalError(err.Error())
	}
	if tx.RowsAffected == 0 {
		return errors.NewNotFoundError("work item", workitemID)
	}
	// store a revision of the deleted work item
	err = r.wirr.Create(context.Background(), suppressorID, RevisionTypeDelete, workItem)
	if err != nil {
		return errs.Wrapf(err, "error while deleting work item")
	}
	log.Debug(ctx, map[string]interface{}{"wi_id": workitemID, "space_id": spaceID}, "Work item deleted successfully!")
	return nil
}
// Delete deletes the work item with the given id
// returns NotFoundError or InternalError
Delete deletes the work item with the given id
returns NotFoundError or InternalError
// Delete deletes the work item with the given id // returns NotFoundError or InternalError
func (r *GormWorkItemRepository) Delete(ctx context.Context, spaceID uuid.UUID, workitemID string, suppressorID uuid.UUID) error {
	var workItem = WorkItemStorage{}
	id, err := strconv.ParseUint(workitemID, 10, 64)
	if err != nil || id == 0 {
		return errors.NewNotFoundError("work item", workitemID)
	}
	workItem.ID = id
	workItem.SpaceID = spaceID
	r.db.Select("id, version, type").Where("id = ? AND space_id = ?", workItem.ID, spaceID).Find(&workItem)
	tx := r.db.Delete(workItem)
	if err = tx.Error; err != nil {
		return errors.NewInternalError(err.Error())
	}
	if tx.RowsAffected == 0 {
		return errors.NewNotFoundError("work item", workitemID)
	}
	err = r.wirr.Create(context.Background(), suppressorID, RevisionTypeDelete, workItem)
	if err != nil {
		return errs.Wrapf(err, "error while deleting work item")
	}
	log.Debug(ctx, map[string]interface{}{"wi_id": workitemID, "space_id": spaceID}, "Work item deleted successfully!")
	return nil
}
func ( r * GormWorkItemRepository ) Delete ( ctx context . Context , spaceID uuid . UUID , workitemID string , suppressorID uuid . UUID ) error { var workItem = WorkItemStorage { } id , err := strconv . ParseUint ( workitemID , 10 , 64 ) if err != nil || id == 0 { return errors . NewNotFoundError ( " " , workitemID ) } workItem . ID = id workItem . SpaceID = spaceID r . db . Select ( " " ) . Where ( " " , workItem . ID , spaceID ) . Find ( & workItem ) tx := r . db . Delete ( workItem ) if err = tx . Error ; err != nil { return errors . NewInternalError ( err . Error ( ) ) } if tx . RowsAffected == 0 { return errors . NewNotFoundError ( " " , workitemID ) } err = r . wirr . Create ( context . Background ( ) , suppressorID , RevisionTypeDelete , workItem ) if err != nil { return errs . Wrapf ( err , " " ) } log . Debug ( ctx , map [ string ] interface { } { " " : workitemID , " " : spaceID } , " " ) return nil }
Delete deletes the work item with the given id
returns NotFoundError or InternalError
Delete deletes the work item with the given id returns NotFoundError or InternalError
// treat as not found: clients don't know it must be a number // retrieve the current version of the work item to delete // delete the work item // store a revision of the deleted work item