ai work
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user