-
Notifications
You must be signed in to change notification settings - Fork 58
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
base: master
Are you sure you want to change the base?
Iter1 #20
Conversation
return c.String(http.StatusUnprocessableEntity, "Invalid order") | ||
} | ||
|
||
// if !utils.Valid(order) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А почему это закоментил?
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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}) |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Надо вынести структуру из метода
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Можно ли как то лаконичнее сделать все нужные мне структуры из файла models.go ?
Получается что часть из них повторяет поля друг друга, но называются по разному. Не хотелось там плодить одинаковые ответы. Можно ли как то это красивее сделать ?
No description provided.