закупы в бэк

This commit is contained in:
Artem Tsyrulnikov
2026-01-06 19:25:01 +03:00
parent cb6bdd5580
commit 87643735a1
10 changed files with 334 additions and 30 deletions

View File

@@ -105,8 +105,8 @@ func (s *PurchaseDetails) renderDetails(b *bot.Bot, mode bot.RenderMode, jwt str
text += fmt.Sprintf("%d. %s <b>%s</b>\n", i+1, statusSymbol, channelName)
// Стоимость
if ch.PlannedCost != nil {
text += fmt.Sprintf(" ▸ Стоимость: %.0f₽\n", *ch.PlannedCost)
if ch.Details != nil && ch.Details.Cost != nil {
text += fmt.Sprintf(" ▸ Стоимость: %.0f₽\n", ch.Details.Cost.Value)
}
// Комментарий

View File

@@ -221,10 +221,20 @@ func (s *SelectChannelsForPurchase) createPurchase(b *bot.Bot, jwt string) {
// Преобразуем каналы в формат API
var apiChannels []backend.CreatePurchaseChannelInput
for _, ch := range s.Channels {
var details *backend.PurchaseChannelDetails
if ch.PlannedCost != nil {
cost := backend.CostInfo{
Type: "fixed",
Value: *ch.PlannedCost,
}
details = &backend.PurchaseChannelDetails{
Cost: &cost,
}
}
apiChannels = append(apiChannels, backend.CreatePurchaseChannelInput{
Username: ch.Username,
PlannedCost: ch.PlannedCost,
Comment: ch.Comment,
Username: ch.Username,
Comment: ch.Comment,
Details: details,
})
}