Delete an entities.Discord
(ctx context.Context, userID entities.UserID, discordID uuid.UUID)
| 86 | |
| 87 | // Delete an entities.Discord |
| 88 | func (service *DiscordService) Delete(ctx context.Context, userID entities.UserID, discordID uuid.UUID) error { |
| 89 | ctx, span := service.tracer.Start(ctx) |
| 90 | defer span.End() |
| 91 | |
| 92 | ctxLogger := service.tracer.CtxLogger(service.logger, span) |
| 93 | |
| 94 | if _, err := service.repository.Load(ctx, userID, discordID); err != nil { |
| 95 | msg := fmt.Sprintf("cannot load discord integration with userID [%s] and discordID [%s]", userID, discordID) |
| 96 | return service.tracer.WrapErrorSpan(span, stacktrace.PropagateWithCode(err, stacktrace.GetCode(err), msg)) |
| 97 | } |
| 98 | |
| 99 | if err := service.repository.Delete(ctx, userID, discordID); err != nil { |
| 100 | msg := fmt.Sprintf("cannot delete discord integration with id [%s] and discordID [%s]", discordID, userID) |
| 101 | return service.tracer.WrapErrorSpan(span, stacktrace.Propagate(err, msg)) |
| 102 | } |
| 103 | |
| 104 | ctxLogger.Info(fmt.Sprintf("deleted discord integration with id [%s] and user id [%s]", discordID, userID)) |
| 105 | return nil |
| 106 | } |
| 107 | |
| 108 | // DiscordStoreParams are parameters for creating a new entities.Discord |
| 109 | type DiscordStoreParams struct { |