2023-01-22 10:12:55 -08:00
|
|
|
package dto
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2024-04-23 07:15:38 -07:00
|
|
|
"git.jamestombleson.com/jtom38/newsbot-api/internal/database"
|
|
|
|
"git.jamestombleson.com/jtom38/newsbot-api/internal/domain/models"
|
2023-01-22 10:12:55 -08:00
|
|
|
)
|
|
|
|
|
2023-01-31 12:39:54 -08:00
|
|
|
func (c *DtoClient) ListDiscordWebhookQueue(ctx context.Context, limit int32) {
|
2023-01-22 10:12:55 -08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-01-31 12:39:54 -08:00
|
|
|
func (c *DtoClient) ListDiscordWebhookQueueDetails(ctx context.Context, limit int32) ([]models.DiscordQueueDetailsDto, error) {
|
2023-01-22 10:12:55 -08:00
|
|
|
var res []models.DiscordQueueDetailsDto
|
|
|
|
|
|
|
|
items, err := c.db.ListDiscordQueueItems(ctx, limit)
|
|
|
|
if err != nil {
|
|
|
|
return res, err
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, item := range items {
|
|
|
|
article, err := c.GetArticleDetails(ctx, item.ID)
|
|
|
|
if err != nil {
|
|
|
|
return res, err
|
|
|
|
}
|
|
|
|
|
|
|
|
res = append(res, models.DiscordQueueDetailsDto{
|
|
|
|
ID: item.ID,
|
|
|
|
Article: article,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
return res, nil
|
|
|
|
}
|
|
|
|
|
2023-01-31 12:39:54 -08:00
|
|
|
func (c *DtoClient) ConvertToDiscordQueueDto(i database.Discordqueue) models.DiscordQueueDto {
|
2023-01-22 10:12:55 -08:00
|
|
|
return models.DiscordQueueDto{
|
|
|
|
ID: i.ID,
|
|
|
|
Articleid: i.Articleid,
|
|
|
|
}
|
|
|
|
}
|