This commit is contained in:
Artem Tsyrulnikov
2026-01-18 13:59:47 +03:00
parent d8202e1141
commit 62e8f98429
62 changed files with 156 additions and 190 deletions

View File

@@ -39,7 +39,8 @@ services:
tg_bot: tg_bot:
build: build:
context: telegram_bot context: .
dockerfile: tg_bot/Dockerfile
depends_on: depends_on:
- backend - backend
environment: environment:
@@ -50,7 +51,8 @@ services:
tg_parser: tg_parser:
build: build:
context: tg_parser context: .
dockerfile: tg_parser/Dockerfile
depends_on: depends_on:
- postgres - postgres
environment: environment:

9
pkg/go.mod Normal file
View File

@@ -0,0 +1,9 @@
module github.com/TelegramExchange/pkg
go 1.24.4
require (
github.com/gotd/td v0.136.0
github.com/jackc/pgx/v5 v5.7.6
github.com/rs/zerolog v1.34.0
)

13
pkg/go.sum Normal file
View File

@@ -0,0 +1,13 @@
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gotd/td v0.136.0/go.mod h1:mStcqs/9FXhNhWnPTguptSwqkQbRIwXLw3SCSpzPJxM=
github.com/jackc/pgx/v5 v5.7.6/go.mod h1:aruU7o91Tc2q2cFp5h4uP3f6ztExVpyVv88Xl/8Vl8M=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0=
github.com/rs/zerolog v1.34.0/go.mod h1:bJsvje4Z08ROH4Nhs5iH600c3IkWhwp44iRc54W6wYQ=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

View File

@@ -5,7 +5,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"github.com/TelegramExchange/tgex-parser/pkg/postgres" "github.com/TelegramExchange/pkg/postgres"
"github.com/jackc/pgx/v5" "github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgconn" "github.com/jackc/pgx/v5/pgconn"
"github.com/jackc/pgx/v5/pgxpool" "github.com/jackc/pgx/v5/pgxpool"

View File

@@ -1,42 +0,0 @@
package handlers
import (
"strings"
"example.com/m/bot"
"example.com/m/screens"
)
// HandleGlobalCallback обрабатывает глобальные callbacks из уведомлений
// Возвращает новый State если callback был обработан, иначе nil
func HandleGlobalCallback(callbackData string) bot.State {
// pending_channel:{channel_id} - выбор workspace для нового канала
if strings.HasPrefix(callbackData, "pending_channel:") {
parts := strings.Split(callbackData, ":")
if len(parts) == 2 {
channelID := parts[1]
return &screens.SelectWorkspace{
ChannelID: channelID,
BackState: &screens.MainMenu{},
}
}
}
// workspace_invite_accept:{invite_id} - принятие приглашения в workspace
if strings.HasPrefix(callbackData, "workspace_invite_accept:") {
parts := strings.Split(callbackData, ":")
if len(parts) == 2 {
inviteID := parts[1]
return &screens.AcceptWorkspaceInvite{
InviteID: inviteID,
}
}
}
// Здесь можно добавлять другие глобальные callback паттерны
// Например:
// if strings.HasPrefix(callbackData, "notification:") { ... }
// if strings.HasPrefix(callbackData, "alert:") { ... }
return nil
}

View File

@@ -1,38 +0,0 @@
package logger
import (
"os"
"time"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
)
type Config struct {
AppName string `envconfig:"APP_NAME" required:"true"`
AppVersion string `envconfig:"APP_VERSION" required:"true"`
Level string `default:"error" envconfig:"LOGGER_LEVEL"`
PrettyConsole bool `default:"false" envconfig:"LOGGER_PRETTY_CONSOLE"`
}
func Init(c Config) {
zerolog.TimeFieldFormat = time.RFC3339
zerolog.SetGlobalLevel(zerolog.InfoLevel)
level, err := zerolog.ParseLevel(c.Level)
if err != nil {
zerolog.SetGlobalLevel(level)
}
log.Logger = log.With().
// Caller().
// Str("app_name", c.AppName).
// Str("app_version", c.AppVersion).
Logger()
if c.PrettyConsole {
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr, TimeFormat: "15:04:05"})
}
log.Info().Msg("Logger initialized")
}

View File

@@ -1,13 +1,14 @@
FROM golang:1.25-alpine AS build FROM golang:1.25-alpine AS build
WORKDIR /app WORKDIR /app/tg_bot
# Modules layer # Modules layer
COPY go.mod go.sum ./ COPY tg_bot/go.mod tg_bot/go.sum ./
COPY pkg /app/pkg
RUN go mod download RUN go mod download
# Build layer # Build layer
COPY . . COPY tg_bot /app/tg_bot
RUN CGO_ENABLED=0 GOOS=linux go build -o /tg_bot . RUN CGO_ENABLED=0 GOOS=linux go build -o /tg_bot .
FROM alpine:latest AS run FROM alpine:latest AS run

View File

@@ -7,8 +7,8 @@ import (
"strings" "strings"
"sync" "sync"
"example.com/m/adapter/backend"
"github.com/NicoNex/echotron/v3" "github.com/NicoNex/echotron/v3"
"github.com/TelegramExchange/tgex-backend/tg_bot/backend"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
) )

View File

@@ -1,8 +1,11 @@
module example.com/m module github.com/TelegramExchange/tgex-backend/tg_bot
go 1.24.4 go 1.24.4
require github.com/rs/zerolog v1.34.0 require (
github.com/rs/zerolog v1.34.0
github.com/TelegramExchange/pkg v0.0.0
)
require ( require (
github.com/NicoNex/echotron/v3 v3.43.0 // indirect github.com/NicoNex/echotron/v3 v3.43.0 // indirect
@@ -11,3 +14,5 @@ require (
golang.org/x/sys v0.39.0 // indirect golang.org/x/sys v0.39.0 // indirect
golang.org/x/time v0.5.0 // indirect golang.org/x/time v0.5.0 // indirect
) )
replace github.com/TelegramExchange/pkg => ../pkg

View File

@@ -2,21 +2,19 @@ package main
import ( import (
"os" "os"
"strings"
"time" "time"
"example.com/m/adapter/backend"
"example.com/m/bot"
"example.com/m/handlers"
"example.com/m/pkg/logger"
"example.com/m/screens"
"github.com/NicoNex/echotron/v3" "github.com/NicoNex/echotron/v3"
"github.com/TelegramExchange/pkg/logger"
"github.com/TelegramExchange/tgex-backend/tg_bot/backend"
"github.com/TelegramExchange/tgex-backend/tg_bot/bot"
"github.com/TelegramExchange/tgex-backend/tg_bot/screens"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
) )
func main() { func main() {
logger.Init(logger.Config{ logger.Init(logger.Config{
AppName: "tgex-bot",
AppVersion: "v0.0.1",
PrettyConsole: true, PrettyConsole: true,
}) })
@@ -39,8 +37,22 @@ func main() {
panic("Unknown command: " + command) panic("Unknown command: " + command)
} }
var handleGlobalCallback = func(callbackData string) bot.State {
id, ok := strings.CutPrefix(callbackData, "pending_channel:")
if ok {
return &screens.SelectWorkspace{ChannelID: id, BackState: &screens.MainMenu{}}
}
id, ok = strings.CutPrefix(callbackData, "workspace_invite_accept:")
if ok {
return &screens.AcceptWorkspaceInvite{InviteID: id}
}
return nil
}
newBot := func(chatID int64) echotron.Bot { newBot := func(chatID int64) echotron.Bot {
return bot.NewBot(chatID, botToken, commandRouter, backendClient, handlers.HandleGlobalCallback) return bot.NewBot(chatID, botToken, commandRouter, backendClient, handleGlobalCallback)
} }
dsp := echotron.NewDispatcher(botToken, newBot) dsp := echotron.NewDispatcher(botToken, newBot)
@@ -68,10 +80,10 @@ func main() {
} }
func mustEnv(key string) string { func mustEnv(key string) string {
value := os.Getenv(key) v := os.Getenv(key)
if value == "" { if v == "" {
log.Fatal().Str("env", key).Msg("missing required environment variable") log.Fatal().Str("env", key).Msg("missing required environment variable")
} }
return value return v
} }

View File

@@ -3,8 +3,8 @@ package screens
import ( import (
"context" "context"
"example.com/m/bot"
"github.com/NicoNex/echotron/v3" "github.com/NicoNex/echotron/v3"
"github.com/TelegramExchange/tgex-backend/tg_bot/bot"
) )
type AcceptWorkspaceInvite struct { type AcceptWorkspaceInvite struct {

View File

@@ -7,10 +7,10 @@ import (
"strconv" "strconv"
"strings" "strings"
"example.com/m/adapter/backend"
"example.com/m/bot"
"example.com/m/ui"
"github.com/NicoNex/echotron/v3" "github.com/NicoNex/echotron/v3"
"github.com/TelegramExchange/tgex-backend/tg_bot/backend"
"github.com/TelegramExchange/tgex-backend/tg_bot/bot"
"github.com/TelegramExchange/tgex-backend/tg_bot/screens/ui"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
) )

View File

@@ -1,8 +1,8 @@
package screens package screens
import ( import (
"example.com/m/bot"
"github.com/NicoNex/echotron/v3" "github.com/NicoNex/echotron/v3"
"github.com/TelegramExchange/tgex-backend/tg_bot/bot"
) )
const addProjectInstructionText = ` const addProjectInstructionText = `

View File

@@ -4,9 +4,9 @@ import (
"context" "context"
"fmt" "fmt"
"example.com/m/bot"
"example.com/m/ui"
"github.com/NicoNex/echotron/v3" "github.com/NicoNex/echotron/v3"
"github.com/TelegramExchange/tgex-backend/tg_bot/bot"
"github.com/TelegramExchange/tgex-backend/tg_bot/screens/ui"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
) )

View File

@@ -5,10 +5,10 @@ import (
"fmt" "fmt"
"strings" "strings"
"example.com/m/adapter/backend"
"example.com/m/bot"
"example.com/m/ui"
"github.com/NicoNex/echotron/v3" "github.com/NicoNex/echotron/v3"
"github.com/TelegramExchange/tgex-backend/tg_bot/backend"
"github.com/TelegramExchange/tgex-backend/tg_bot/bot"
"github.com/TelegramExchange/tgex-backend/tg_bot/screens/ui"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
) )

View File

@@ -4,9 +4,9 @@ import (
"fmt" "fmt"
"strings" "strings"
"example.com/m/bot"
"example.com/m/ui"
"github.com/NicoNex/echotron/v3" "github.com/NicoNex/echotron/v3"
"github.com/TelegramExchange/tgex-backend/tg_bot/bot"
"github.com/TelegramExchange/tgex-backend/tg_bot/screens/ui"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
) )

View File

@@ -1,8 +1,8 @@
package screens package screens
import ( import (
"example.com/m/bot"
"github.com/NicoNex/echotron/v3" "github.com/NicoNex/echotron/v3"
"github.com/TelegramExchange/tgex-backend/tg_bot/bot"
) )
const msgEditCreativeText = ` const msgEditCreativeText = `

View File

@@ -5,9 +5,9 @@ import (
"fmt" "fmt"
"strings" "strings"
"example.com/m/bot"
"example.com/m/ui"
"github.com/NicoNex/echotron/v3" "github.com/NicoNex/echotron/v3"
"github.com/TelegramExchange/tgex-backend/tg_bot/bot"
"github.com/TelegramExchange/tgex-backend/tg_bot/screens/ui"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
) )

View File

@@ -4,8 +4,8 @@ import (
"context" "context"
"fmt" "fmt"
"example.com/m/bot"
"github.com/NicoNex/echotron/v3" "github.com/NicoNex/echotron/v3"
"github.com/TelegramExchange/tgex-backend/tg_bot/bot"
) )
type Login struct{} type Login struct{}

View File

@@ -1,8 +1,8 @@
package screens package screens
import ( import (
"example.com/m/bot"
"github.com/NicoNex/echotron/v3" "github.com/NicoNex/echotron/v3"
"github.com/TelegramExchange/tgex-backend/tg_bot/bot"
) )
type MainMenu struct{} type MainMenu struct{}

View File

@@ -6,9 +6,9 @@ import (
"strings" "strings"
"time" "time"
"example.com/m/bot"
"example.com/m/ui"
"github.com/NicoNex/echotron/v3" "github.com/NicoNex/echotron/v3"
"github.com/TelegramExchange/tgex-backend/tg_bot/bot"
"github.com/TelegramExchange/tgex-backend/tg_bot/screens/ui"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
) )

View File

@@ -5,9 +5,9 @@ import (
"fmt" "fmt"
"strings" "strings"
"example.com/m/adapter/backend"
"example.com/m/bot"
"github.com/NicoNex/echotron/v3" "github.com/NicoNex/echotron/v3"
"github.com/TelegramExchange/tgex-backend/tg_bot/backend"
"github.com/TelegramExchange/tgex-backend/tg_bot/bot"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
) )

View File

@@ -5,9 +5,9 @@ import (
"fmt" "fmt"
"strings" "strings"
"example.com/m/adapter/backend"
"example.com/m/bot"
"github.com/NicoNex/echotron/v3" "github.com/NicoNex/echotron/v3"
"github.com/TelegramExchange/tgex-backend/tg_bot/backend"
"github.com/TelegramExchange/tgex-backend/tg_bot/bot"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
) )

View File

@@ -8,10 +8,10 @@ import (
"strings" "strings"
"time" "time"
"example.com/m/adapter/backend"
"example.com/m/bot"
"example.com/m/ui"
"github.com/NicoNex/echotron/v3" "github.com/NicoNex/echotron/v3"
"github.com/TelegramExchange/tgex-backend/tg_bot/backend"
"github.com/TelegramExchange/tgex-backend/tg_bot/bot"
ui2 "github.com/TelegramExchange/tgex-backend/tg_bot/screens/ui"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
) )
@@ -128,7 +128,7 @@ func (s *PurchaseOptionalDetails) HandleCallback(b *bot.Bot, u *echotron.Update)
} }
case "opt_payment_date": case "opt_payment_date":
b.SetState(ui.NewDateTimePicker(ui.DateTimePickerConfig{ b.SetState(ui2.NewDateTimePicker(ui2.DateTimePickerConfig{
Title: "Дата оплаты", Title: "Дата оплаты",
Key: "payment_date", Key: "payment_date",
IncludeTime: true, IncludeTime: true,
@@ -381,8 +381,8 @@ func (s *PurchaseOptionalDetails) formatDateTime(value *time.Time) string {
if value == nil { if value == nil {
return "—" return "—"
} }
local := value.In(ui.MskLocation) local := value.In(ui2.MskLocation)
return fmt.Sprintf("%s %02d %s %s", ui.WeekdayName(local.Weekday()), local.Day(), ui.MonthShort(local.Month()), local.Format("15:04")) return fmt.Sprintf("%s %02d %s %s", ui2.WeekdayName(local.Weekday()), local.Day(), ui2.MonthShort(local.Month()), local.Format("15:04"))
} }
func (s *PurchaseOptionalDetails) formatText(value string) string { func (s *PurchaseOptionalDetails) formatText(value string) string {
@@ -685,7 +685,7 @@ func (s *PurchaseOptionalDetails) renderParamChannels(b *bot.Bot, mode bot.Rende
if s.ParamPage*perPage >= total { if s.ParamPage*perPage >= total {
s.ParamPage = 0 s.ParamPage = 0
} }
start, end := ui.GetPageBounds(s.ParamPage, perPage, total) start, end := ui2.GetPageBounds(s.ParamPage, perPage, total)
// Устанавливаем режим по умолчанию // Устанавливаем режим по умолчанию
if s.ChannelEditMode == "" { if s.ChannelEditMode == "" {
@@ -757,8 +757,8 @@ func (s *PurchaseOptionalDetails) renderParamChannels(b *bot.Bot, mode bot.Rende
} }
} }
pages := ui.CalculatePages(total, perPage) pages := ui2.CalculatePages(total, perPage)
if navRow := ui.BuildNavigationRow(ui.PaginationConfig{ if navRow := ui2.BuildNavigationRow(ui2.PaginationConfig{
CurrentPage: s.ParamPage, CurrentPage: s.ParamPage,
TotalPages: pages, TotalPages: pages,
}); navRow != nil { }); navRow != nil {
@@ -877,7 +877,7 @@ func (s *PurchaseOptionalDetails) openCommonEditor(b *bot.Bot, param string) {
case "placement": case "placement":
s.InputMode = "" s.InputMode = ""
s.ReturnMode = "" s.ReturnMode = ""
b.SetState(ui.NewDateTimePicker(ui.DateTimePickerConfig{ b.SetState(ui2.NewDateTimePicker(ui2.DateTimePickerConfig{
Title: "Дата и время размещения", Title: "Дата и время размещения",
Key: "placement_datetime", Key: "placement_datetime",
IncludeTime: true, IncludeTime: true,
@@ -909,7 +909,7 @@ func (s *PurchaseOptionalDetails) openChannelEditor(b *bot.Bot, param, username
switch param { switch param {
case "placement": case "placement":
s.InputMode = "placement_channels" s.InputMode = "placement_channels"
b.SetState(ui.NewDateTimePicker(ui.DateTimePickerConfig{ b.SetState(ui2.NewDateTimePicker(ui2.DateTimePickerConfig{
Title: "Дата и время размещения", Title: "Дата и время размещения",
Key: "placement_datetime:" + username, Key: "placement_datetime:" + username,
IncludeTime: true, IncludeTime: true,
@@ -970,7 +970,7 @@ func (s *PurchaseOptionalDetails) pasteParamValue(param, username string) {
s.PlacementByChannel[username] = nil s.PlacementByChannel[username] = nil
return return
} }
value := s.PlacementCopy.In(ui.MskLocation) value := s.PlacementCopy.In(ui2.MskLocation)
s.PlacementByChannel[username] = &value s.PlacementByChannel[username] = &value
case "cost": case "cost":
if s.CostCopy == nil { if s.CostCopy == nil {

View File

@@ -4,8 +4,8 @@ import (
"context" "context"
"fmt" "fmt"
"example.com/m/bot"
"github.com/NicoNex/echotron/v3" "github.com/NicoNex/echotron/v3"
"github.com/TelegramExchange/tgex-backend/tg_bot/bot"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
) )

View File

@@ -6,10 +6,10 @@ import (
"regexp" "regexp"
"strings" "strings"
"example.com/m/adapter/backend"
"example.com/m/bot"
"example.com/m/ui"
"github.com/NicoNex/echotron/v3" "github.com/NicoNex/echotron/v3"
"github.com/TelegramExchange/tgex-backend/tg_bot/backend"
"github.com/TelegramExchange/tgex-backend/tg_bot/bot"
"github.com/TelegramExchange/tgex-backend/tg_bot/screens/ui"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
) )

View File

@@ -5,9 +5,9 @@ import (
"fmt" "fmt"
"strings" "strings"
"example.com/m/bot"
"example.com/m/ui"
"github.com/NicoNex/echotron/v3" "github.com/NicoNex/echotron/v3"
"github.com/TelegramExchange/tgex-backend/tg_bot/bot"
"github.com/TelegramExchange/tgex-backend/tg_bot/screens/ui"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
) )

View File

@@ -6,8 +6,8 @@ import (
"strings" "strings"
"time" "time"
"example.com/m/bot"
"github.com/NicoNex/echotron/v3" "github.com/NicoNex/echotron/v3"
"github.com/TelegramExchange/tgex-backend/tg_bot/bot"
) )
const ( const (

View File

@@ -1,13 +1,14 @@
FROM golang:1.25-alpine AS build FROM golang:1.25-alpine AS build
WORKDIR /app WORKDIR /app/tg_parser
# Modules layer # Modules layer
COPY go.mod go.sum ./ COPY tg_parser/go.mod tg_parser/go.sum ./
COPY pkg /app/pkg
RUN go mod download RUN go mod download
# Build layer # Build layer
COPY . . COPY tg_parser /app/tg_parser
RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o /parser . RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o /parser .
FROM alpine:latest AS run FROM alpine:latest AS run

View File

@@ -5,13 +5,13 @@ import (
"fmt" "fmt"
"os" "os"
"github.com/TelegramExchange/tgex-parser/pkg/logger" "github.com/TelegramExchange/pkg/logger"
"github.com/TelegramExchange/tgex-parser/pkg/postgres" "github.com/TelegramExchange/pkg/postgres"
"github.com/TelegramExchange/pkg/telegram"
"github.com/joho/godotenv" "github.com/joho/godotenv"
"github.com/kelseyhightower/envconfig" "github.com/kelseyhightower/envconfig"
"github.com/TelegramExchange/tgex-parser/internal/controller/worker" "github.com/TelegramExchange/tgex-backend/tg_parser/internal/controller/worker"
"github.com/TelegramExchange/tgex-parser/pkg/telegram"
) )
type HTTP struct { type HTTP struct {

View File

@@ -1,4 +1,4 @@
module github.com/TelegramExchange/tgex-parser module github.com/TelegramExchange/tgex-backend/tg_parser
go 1.25.0 go 1.25.0
@@ -8,6 +8,7 @@ require (
github.com/joho/godotenv v1.5.1 github.com/joho/godotenv v1.5.1
github.com/kelseyhightower/envconfig v1.4.0 github.com/kelseyhightower/envconfig v1.4.0
github.com/rs/zerolog v1.34.0 github.com/rs/zerolog v1.34.0
github.com/TelegramExchange/pkg v0.0.0
) )
require ( require (
@@ -49,3 +50,5 @@ require (
gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect
rsc.io/qr v0.2.0 // indirect rsc.io/qr v0.2.0 // indirect
) )
replace github.com/TelegramExchange/pkg => ../pkg

View File

@@ -6,8 +6,8 @@ import (
"github.com/jackc/pgx/v5/pgtype" "github.com/jackc/pgx/v5/pgtype"
"github.com/TelegramExchange/tgex-parser/internal/domain" "github.com/TelegramExchange/pkg/transaction"
"github.com/TelegramExchange/tgex-parser/pkg/transaction" "github.com/TelegramExchange/tgex-backend/tg_parser/internal/domain"
) )
func (d *Database) CreatePost(ctx context.Context, post domain.Post) error { func (d *Database) CreatePost(ctx context.Context, post domain.Post) error {

View File

@@ -7,8 +7,8 @@ import (
"github.com/google/uuid" "github.com/google/uuid"
"github.com/jackc/pgx/v5/pgtype" "github.com/jackc/pgx/v5/pgtype"
"github.com/TelegramExchange/tgex-parser/internal/domain" "github.com/TelegramExchange/pkg/transaction"
"github.com/TelegramExchange/tgex-parser/pkg/transaction" "github.com/TelegramExchange/tgex-backend/tg_parser/internal/domain"
) )
func (d *Database) CreateViewsSnapshot(ctx context.Context, snapshot domain.ViewsSnapshot) error { func (d *Database) CreateViewsSnapshot(ctx context.Context, snapshot domain.ViewsSnapshot) error {

View File

@@ -6,8 +6,8 @@ import (
"github.com/jackc/pgx/v5/pgtype" "github.com/jackc/pgx/v5/pgtype"
"github.com/TelegramExchange/tgex-parser/internal/domain" "github.com/TelegramExchange/pkg/transaction"
"github.com/TelegramExchange/tgex-parser/pkg/transaction" "github.com/TelegramExchange/tgex-backend/tg_parser/internal/domain"
) )
func (d *Database) DeletePost(ctx context.Context, p domain.Post) error { func (d *Database) DeletePost(ctx context.Context, p domain.Post) error {

View File

@@ -6,8 +6,8 @@ import (
"github.com/jackc/pgx/v5/pgtype" "github.com/jackc/pgx/v5/pgtype"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"github.com/TelegramExchange/tgex-parser/internal/domain" "github.com/TelegramExchange/pkg/transaction"
"github.com/TelegramExchange/tgex-parser/pkg/transaction" "github.com/TelegramExchange/tgex-backend/tg_parser/internal/domain"
) )
func (d *Database) GetChannels(ctx context.Context) []domain.Channel { func (d *Database) GetChannels(ctx context.Context) []domain.Channel {

View File

@@ -6,8 +6,8 @@ import (
"github.com/jackc/pgx/v5/pgtype" "github.com/jackc/pgx/v5/pgtype"
"github.com/TelegramExchange/tgex-parser/internal/domain" "github.com/TelegramExchange/pkg/transaction"
"github.com/TelegramExchange/tgex-parser/pkg/transaction" "github.com/TelegramExchange/tgex-backend/tg_parser/internal/domain"
) )
func (d *Database) GetChannelsWithTrackedPosts(ctx context.Context) ([]domain.Channel, error) { func (d *Database) GetChannelsWithTrackedPosts(ctx context.Context) ([]domain.Channel, error) {

View File

@@ -6,8 +6,8 @@ import (
"github.com/jackc/pgx/v5/pgtype" "github.com/jackc/pgx/v5/pgtype"
"github.com/TelegramExchange/tgex-parser/internal/domain" "github.com/TelegramExchange/pkg/transaction"
"github.com/TelegramExchange/tgex-parser/pkg/transaction" "github.com/TelegramExchange/tgex-backend/tg_parser/internal/domain"
) )
func (d *Database) GetTrackedPosts(ctx context.Context, channel domain.Channel) ([]domain.Post, error) { func (d *Database) GetTrackedPosts(ctx context.Context, channel domain.Channel) ([]domain.Post, error) {

View File

@@ -6,8 +6,8 @@ import (
"github.com/jackc/pgx/v5/pgtype" "github.com/jackc/pgx/v5/pgtype"
"github.com/TelegramExchange/tgex-parser/internal/domain" "github.com/TelegramExchange/pkg/transaction"
"github.com/TelegramExchange/tgex-parser/pkg/transaction" "github.com/TelegramExchange/tgex-backend/tg_parser/internal/domain"
) )
func (d *Database) UpdateChannel(ctx context.Context, channel domain.Channel) error { func (d *Database) UpdateChannel(ctx context.Context, channel domain.Channel) error {

View File

@@ -4,7 +4,7 @@ import (
"context" "context"
"fmt" "fmt"
"github.com/TelegramExchange/tgex-parser/internal/domain" "github.com/TelegramExchange/tgex-backend/tg_parser/internal/domain"
"github.com/gotd/td/tg" "github.com/gotd/td/tg"
) )

View File

@@ -4,7 +4,7 @@ import (
"context" "context"
"fmt" "fmt"
"github.com/TelegramExchange/tgex-parser/internal/domain" "github.com/TelegramExchange/tgex-backend/tg_parser/internal/domain"
"github.com/gotd/td/tg" "github.com/gotd/td/tg"
) )

View File

@@ -4,7 +4,7 @@ import (
"context" "context"
"fmt" "fmt"
"github.com/TelegramExchange/tgex-parser/internal/domain" "github.com/TelegramExchange/tgex-backend/tg_parser/internal/domain"
"github.com/gotd/td/tg" "github.com/gotd/td/tg"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
) )

View File

@@ -4,7 +4,7 @@ import (
"context" "context"
"fmt" "fmt"
"github.com/TelegramExchange/tgex-parser/internal/domain" "github.com/TelegramExchange/tgex-backend/tg_parser/internal/domain"
"github.com/google/uuid" "github.com/google/uuid"
"github.com/gotd/td/tg" "github.com/gotd/td/tg"
) )

View File

@@ -1,7 +1,7 @@
package telegram package telegram
import ( import (
"github.com/TelegramExchange/tgex-parser/pkg/telegram" "github.com/TelegramExchange/pkg/telegram"
"github.com/gotd/td/tg" "github.com/gotd/td/tg"
) )

View File

@@ -12,15 +12,15 @@ import (
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"github.com/TelegramExchange/tgex-parser/config" "github.com/TelegramExchange/pkg/postgres"
"github.com/TelegramExchange/tgex-parser/internal/adapter/database" "github.com/TelegramExchange/pkg/telegram"
tgadapter "github.com/TelegramExchange/tgex-parser/internal/adapter/telegram" "github.com/TelegramExchange/pkg/transaction"
"github.com/TelegramExchange/tgex-parser/internal/controller/httpserver" "github.com/TelegramExchange/tgex-backend/tg_parser/config"
"github.com/TelegramExchange/tgex-parser/internal/controller/worker" "github.com/TelegramExchange/tgex-backend/tg_parser/internal/adapter/database"
"github.com/TelegramExchange/tgex-parser/internal/usecase" tgadapter "github.com/TelegramExchange/tgex-backend/tg_parser/internal/adapter/telegram"
"github.com/TelegramExchange/tgex-parser/pkg/postgres" "github.com/TelegramExchange/tgex-backend/tg_parser/internal/controller/httpserver"
"github.com/TelegramExchange/tgex-parser/pkg/telegram" "github.com/TelegramExchange/tgex-backend/tg_parser/internal/controller/worker"
"github.com/TelegramExchange/tgex-parser/pkg/transaction" "github.com/TelegramExchange/tgex-backend/tg_parser/internal/usecase"
) )
func Run(ctx context.Context, c config.Config) error { func Run(ctx context.Context, c config.Config) error {

View File

@@ -6,7 +6,7 @@ import (
"net/http" "net/http"
"strings" "strings"
"github.com/TelegramExchange/tgex-parser/internal/usecase" "github.com/TelegramExchange/tgex-backend/tg_parser/internal/usecase"
"github.com/gotd/td/tgerr" "github.com/gotd/td/tgerr"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
) )

View File

@@ -7,7 +7,7 @@ import (
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"github.com/TelegramExchange/tgex-parser/internal/usecase" "github.com/TelegramExchange/tgex-backend/tg_parser/internal/usecase"
) )
type ChannelConfig struct { type ChannelConfig struct {

View File

@@ -6,7 +6,7 @@ import (
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"github.com/TelegramExchange/tgex-parser/internal/usecase" "github.com/TelegramExchange/tgex-backend/tg_parser/internal/usecase"
) )
type ViewsConfig struct { type ViewsConfig struct {

View File

@@ -3,7 +3,7 @@ package usecase
import ( import (
"context" "context"
"github.com/TelegramExchange/tgex-parser/internal/domain" "github.com/TelegramExchange/tgex-backend/tg_parser/internal/domain"
) )
func (uc *UseCase) FetchChannelMeta(ctx context.Context, username string) (domain.Channel, error) { func (uc *UseCase) FetchChannelMeta(ctx context.Context, username string) (domain.Channel, error) {

View File

@@ -4,10 +4,10 @@ import (
"context" "context"
"fmt" "fmt"
"github.com/TelegramExchange/tgex-parser/pkg/transaction" "github.com/TelegramExchange/pkg/transaction"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"github.com/TelegramExchange/tgex-parser/internal/domain" "github.com/TelegramExchange/tgex-backend/tg_parser/internal/domain"
) )
func (uc *UseCase) FetchChannels(ctx context.Context) error { func (uc *UseCase) FetchChannels(ctx context.Context) error {

View File

@@ -6,7 +6,7 @@ import (
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"github.com/TelegramExchange/tgex-parser/internal/domain" "github.com/TelegramExchange/tgex-backend/tg_parser/internal/domain"
) )
func (uc *UseCase) FetchViews(ctx context.Context) error { func (uc *UseCase) FetchViews(ctx context.Context) error {

View File

@@ -3,7 +3,7 @@ package usecase
import ( import (
"context" "context"
"github.com/TelegramExchange/tgex-parser/internal/domain" "github.com/TelegramExchange/tgex-backend/tg_parser/internal/domain"
) )
type Telegram interface { type Telegram interface {

View File

@@ -5,9 +5,9 @@ import (
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"github.com/TelegramExchange/tgex-parser/config" "github.com/TelegramExchange/pkg/logger"
"github.com/TelegramExchange/tgex-parser/internal/app" "github.com/TelegramExchange/tgex-backend/tg_parser/config"
"github.com/TelegramExchange/tgex-parser/pkg/logger" "github.com/TelegramExchange/tgex-backend/tg_parser/internal/app"
) )
func main() { func main() {