This commit is contained in:
2026-01-13 15:36:55 +03:00
parent 4925283ede
commit 9bd5354250
12 changed files with 56 additions and 5795 deletions

View File

@@ -4,7 +4,6 @@ import (
"database/sql"
"errors"
"kurumibot/database"
"log"
"math"
"time"
@@ -52,7 +51,6 @@ type User struct {
func GetOrCreateUser(tgId int, name string) (*User, error) {
user, err := GetUser(tgId)
log.Println(errors.Is(err, gorm.ErrRecordNotFound))
if errors.Is(err, gorm.ErrRecordNotFound) {
_, err = CreateUser(tgId, name)
if err != nil {

View File

@@ -8,6 +8,8 @@ import (
type Waifu struct {
ID int
OwnerID int
Owner *User
Name string
Rarity int
ExpBonus decimal.Decimal
@@ -15,9 +17,7 @@ type Waifu struct {
MarketPrice decimal.Decimal
Fandom string
Image string
OwnerID int
Owner *User
RpPrompt string
}
func GetAllWaifus() ([]*Waifu, error) {
@@ -50,7 +50,7 @@ func GetFreeWaifusWithRarity(rarity int) ([]*Waifu, error) {
return waifus, tx.Error
}
func GetWaifuById(id int) (*Waifu, error) {
func GetWaifuById(id uint) (*Waifu, error) {
waifu := new(Waifu)
tx := database.PostgresDatabase.Joins("Owner").Find(waifu, id)
return waifu, tx.Error