Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iter1 #20

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Iter1 #20

wants to merge 9 commits into from

Conversation

kindenko
Copy link

@kindenko kindenko commented Oct 4, 2023

No description provided.

return c.String(http.StatusUnprocessableEntity, "Invalid order")
}

// if !utils.Valid(order) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А почему это закоментил?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Раскоменчу
При проверке тяжело было генерить подходящие под условие номера заказа

func GetUserLoginFromToken(tokenString string) (string, error) {
claims := &Claims{}
_, err := jwt.ParseWithClaims(tokenString, claims,
func(t *jwt.Token) (interface{}, error) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вынеси это в отдельную функцию для простоты восприятия

AccrualSys string `env:"FILE_STORAGE_PATH"`
}

var cfg AppConfig
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А зачем глобальная переменная? Думаю стоит уйти от этого

return c.String(http.StatusBadRequest, "Invalid request type")
}

_ = s.DB.First(&userDB, models.Users{Login: userReq.Login})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это возвращает ошибку? Если да, то надо обработать

expiresTime := time.Now().Add(3 * time.Hour)
token, err := auth.GenerateToken(userDB)

if err != nil {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Почему тут 2 ошибки?


func (s *Server) GetOrderByParam(c echo.Context) error {
var order models.Orders
type Response struct {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Надо вынести структуру из метода

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно ли как то лаконичнее сделать все нужные мне структуры из файла models.go ?

Получается что часть из них повторяет поля друг друга, но называются по разному. Не хотелось там плодить одинаковые ответы. Можно ли как то это красивее сделать ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants