some fixes
This commit is contained in:
@@ -22,12 +22,12 @@ func NewFractionRepository(db *sqlx.DB) *FractionRepository {
|
||||
return &FractionRepository{db: db}
|
||||
}
|
||||
|
||||
func (rep *FractionRepository) GetAllFractions() ([]*Fraction, error) {
|
||||
func (rep *FractionRepository) GetAll() ([]*Fraction, error) {
|
||||
fractions := make([]*Fraction, 0)
|
||||
err := rep.db.Select(&fractions, "SELECT * FROM fractions ORDER BY id DESC;")
|
||||
return fractions, err
|
||||
}
|
||||
func (rep *FractionRepository) GetFraction(id int32) (*Fraction, error) {
|
||||
func (rep *FractionRepository) GetById(id int32) (*Fraction, error) {
|
||||
fraction := new(Fraction)
|
||||
err := rep.db.Get(fraction, "SELECT * FROM fractions WHERE id = $1", id)
|
||||
return fraction, err
|
||||
|
||||
@@ -119,7 +119,7 @@ func GetUser(telegramId int) (*User, error) {
|
||||
}
|
||||
if user.FractionID.Valid {
|
||||
fractionRep := NewFractionRepository(database.PostgresDatabase)
|
||||
user.Fraction, err = fractionRep.GetFraction(user.FractionID.Int32)
|
||||
user.Fraction, err = fractionRep.GetById(user.FractionID.Int32)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user