log middleware

This commit is contained in:
2025-09-29 09:14:39 +03:00
parent 49ffe9ae03
commit e15d56196d
27 changed files with 641 additions and 164 deletions

28
database/psql/works.go Normal file
View File

@@ -0,0 +1,28 @@
package psql
import (
"kurumibot/database"
"github.com/shopspring/decimal"
)
type Work struct {
ID int
Name string
RequiredLevel int
MoneyIncome decimal.Decimal
MinExp int
MaxExp int
}
func GetWorkById(id int) (*Work, error) {
work := new(Work)
tx := database.PostgresDatabase.First(work, id)
return work, tx.Error
}
func GetAllWorks() ([]*Work, error) {
works := make([]*Work, 0)
tx := database.PostgresDatabase.Order("id").Find(&works)
return works, tx.Error
}