feat(telegram-autodelete): Create DB entities, service
First Steps of bringing the feature of the telegram-autodelete to this program. I think this will get the new uf-api
This commit is contained in:
parent
304f706dd6
commit
3ebf1472df
5 changed files with 39 additions and 11 deletions
14
src/app/service/telegram_bot_message.go
Normal file
14
src/app/service/telegram_bot_message.go
Normal file
|
@ -0,0 +1,14 @@
|
|||
package service
|
||||
|
||||
import (
|
||||
"ulmer-furs.de/pretix-proxy/v2/config"
|
||||
"ulmer-furs.de/pretix-proxy/v2/entities"
|
||||
)
|
||||
|
||||
func Create_new_telegram_bot_message(message entities.Telegram_Bot_Message) error {
|
||||
result := config.Database.Create(&message)
|
||||
if result.Error != nil {
|
||||
return result.Error
|
||||
}
|
||||
return nil
|
||||
}
|
|
@ -16,7 +16,11 @@ func Connect() error {
|
|||
panic(err)
|
||||
}
|
||||
|
||||
Database.AutoMigrate(&entities.Db_Event{}, &entities.User{})
|
||||
Database.AutoMigrate(
|
||||
&entities.Db_Event{},
|
||||
&entities.User{},
|
||||
&entities.Telegram_Bot_Message{},
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package entities
|
||||
|
||||
type Environment struct {
|
||||
Domain string `env:"DOMAIN,required"`
|
||||
ApiKeyPretix string `env:"API_KEY_PRETIX,required"`
|
||||
ApiKey string `env:"API_KEY,required"`
|
||||
Secret string `env:"SECRET,required"`
|
||||
DatabasePath string `env:"DATABASE_PATH,required"`
|
||||
Debug bool `env:"DEBUG"`
|
||||
Domain string `env:"DOMAIN,required"`
|
||||
ApiKeyPretix string `env:"API_KEY_PRETIX,required"`
|
||||
ApiKey string `env:"API_KEY,required"`
|
||||
TelegramBotToken string `env:"TELEGRAM_BOT_TOKEN,required"`
|
||||
Secret string `env:"SECRET,required"`
|
||||
DatabasePath string `env:"DATABASE_PATH,required"`
|
||||
Debug bool `env:"DEBUG"`
|
||||
}
|
||||
|
|
9
src/entities/telegram_bot_message.go
Normal file
9
src/entities/telegram_bot_message.go
Normal file
|
@ -0,0 +1,9 @@
|
|||
package entities
|
||||
|
||||
import "gorm.io/gorm"
|
||||
|
||||
type Telegram_Bot_Message struct {
|
||||
gorm.Model
|
||||
MessageId string `gorm:"column:message_id;not null" validate:"required"`
|
||||
ChatId string `gorm:"column:chat_id;not null" validate:"required"`
|
||||
}
|
|
@ -4,8 +4,12 @@ go 1.19
|
|||
|
||||
require (
|
||||
github.com/go-playground/validator/v10 v10.15.4
|
||||
github.com/gofiber/contrib/jwt v1.0.7
|
||||
github.com/gofiber/fiber/v2 v2.51.0
|
||||
github.com/golang-jwt/jwt/v5 v5.1.0
|
||||
github.com/jinzhu/copier v0.4.0
|
||||
github.com/joho/godotenv v1.5.1
|
||||
golang.org/x/crypto v0.15.0
|
||||
gorm.io/driver/sqlite v1.5.3
|
||||
gorm.io/gorm v1.25.4
|
||||
)
|
||||
|
@ -15,11 +19,7 @@ require (
|
|||
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/gofiber/contrib/jwt v1.0.7 // indirect
|
||||
github.com/golang-jwt/jwt/v5 v5.1.0 // indirect
|
||||
github.com/jinzhu/copier v0.4.0 // indirect
|
||||
github.com/leodido/go-urn v1.2.4 // indirect
|
||||
golang.org/x/crypto v0.15.0 // indirect
|
||||
golang.org/x/net v0.10.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue