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