workspaces добавлено

This commit is contained in:
Artem Tsyrulnikov
2026-01-20 13:40:24 +03:00
parent 5d6aa99880
commit 4269b9ae67
15 changed files with 255 additions and 343 deletions

View File

@@ -10,7 +10,6 @@ import (
)
type Placements struct {
WorkspaceID string
ProjectID string
ProjectTitle string
ProjectTelegramID int64
@@ -20,23 +19,11 @@ type Placements struct {
}
func (s *Placements) Enter(b *bot.Bot, mode bot.RenderMode) {
jwt := b.Session.JWT
if jwt == "" {
log.Error().Msg("JWT is empty in session")
b.SendNew("❌ Ошибка авторизации. Попробуйте /start", Keyboard())
return
}
s.renderPurchases(b, mode, jwt)
s.renderPurchases(b, mode)
}
func (s *Placements) renderPurchases(b *bot.Bot, mode bot.RenderMode, jwt string) {
resp, err := b.Backend.GetPlacements(
context.Background(),
jwt,
s.WorkspaceID,
s.ProjectID,
)
func (s *Placements) renderPurchases(b *bot.Bot, mode bot.RenderMode) {
resp, err := b.Backend.GetPlacements(context.Background(), b.Session.JWT, b.Session.WorkspaceID, s.ProjectID)
if err != nil {
log.Error().Err(err).Msg("Failed to get placements")
b.SendNew("❌ Не удалось загрузить размещения", Keyboard())
@@ -114,7 +101,6 @@ func (s *Placements) HandleCallback(b *bot.Bot, u *echotron.Update) {
case "add_purchase":
b.SetState(&AddPurchase{
WorkspaceID: s.WorkspaceID,
ProjectID: s.ProjectID,
ProjectTitle: s.ProjectTitle,
ProjectTelegramID: s.ProjectTelegramID,
@@ -129,7 +115,6 @@ func (s *Placements) HandleCallback(b *bot.Bot, u *echotron.Update) {
if len(data) > 10 && data[:10] == "placement:" {
placementID := data[10:]
b.SetState(&PlacementDetails{
WorkspaceID: s.WorkspaceID,
ProjectID: s.ProjectID,
PlacementID: placementID,
BackState: s,