func (r *GormRepository) Delete(ctx context.Context, ID uuid.UUID) error {
	if ID == uuid.Nil {
		log.Error(ctx, map[string]interface{}{
			"space_id": ID.String(),
		}, "unable to find the space by ID")
		return errors.NewNotFoundError("space", ID.String())
	}
	space := Space{ID: ID}
	tx := r.db.Delete(space)

	if err := tx.Error; err != nil {
		log.Error(ctx, map[string]interface{}{
			"space_id": ID.String(),
		}, "unable to delete the space")
		return errors.NewInternalError(err.Error())
	}
	if tx.RowsAffected == 0 {
		log.Error(ctx, map[string]interface{}{
			"space_id": ID.String(),
		}, "none row was affected by the deletion operation")
		return errors.NewNotFoundError("space", ID.String())
	}

	return nil
}
// Delete deletes the space with the given id
// returns NotFoundError or InternalError
Delete deletes the space with the given id
returns NotFoundError or InternalError
// Delete deletes the space with the given id // returns NotFoundError or InternalError
func (r *GormRepository) Delete(ctx context.Context, ID uuid.UUID) error {
	if ID == uuid.Nil {
		log.Error(ctx, map[string]interface{}{
			"space_id": ID.String(),
		}, "unable to find the space by ID")
		return errors.NewNotFoundError("space", ID.String())
	}
	space := Space{ID: ID}
	tx := r.db.Delete(space)
	if err := tx.Error; err != nil {
		log.Error(ctx, map[string]interface{}{
			"space_id": ID.String(),
		}, "unable to delete the space")
		return errors.NewInternalError(err.Error())
	}
	if tx.RowsAffected == 0 {
		log.Error(ctx, map[string]interface{}{
			"space_id": ID.String(),
		}, "none row was affected by the deletion operation")
		return errors.NewNotFoundError("space", ID.String())
	}
	return nil
}
func ( r * GormRepository ) Delete ( ctx context . Context , ID uuid . UUID ) error { if ID == uuid . Nil { log . Error ( ctx , map [ string ] interface { } { " " : ID . String ( ) , } , " " ) return errors . NewNotFoundError ( " " , ID . String ( ) ) } space := Space { ID : ID } tx := r . db . Delete ( space ) if err := tx . Error ; err != nil { log . Error ( ctx , map [ string ] interface { } { " " : ID . String ( ) , } , " " ) return errors . NewInternalError ( err . Error ( ) ) } if tx . RowsAffected == 0 { log . Error ( ctx , map [ string ] interface { } { " " : ID . String ( ) , } , " " ) return errors . NewNotFoundError ( " " , ID . String ( ) ) } return nil }
Delete deletes the space with the given id
returns NotFoundError or InternalError
Delete deletes the space with the given id returns NotFoundError or InternalError