| Conditions | 2 |
| Total Lines | 6 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | package controllers |
||
| 14 | func GetUserFromContext(ctx *fiber.Ctx) (domain.User, error) { |
||
| 15 | if ctx.Locals("user") == nil { |
||
| 16 | log.WithContext(ctx.UserContext()).Error("User not found in context") |
||
| 17 | return domain.User{}, errors.New("User is not initialized") |
||
| 18 | } |
||
| 19 | return ctx.Locals("user").(domain.User), nil |
||
| 20 | } |
||
| 52 |